|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
public interface PlayerListener
This interface has to be implemented by classes interested to be notified
of events fired by a Player thread.
Classes implementing this interface can either ignore
decoded bytes coming from the player or use them to drive devices such as
a spectrum analyzer or VU meter. In cases where a class implementing this
interface consumes decoded bytes to drive other devices it has to signal the
Player that it does so via method consumesDecodedBytes().
The Player takes this indication to not play audio directly in
such case. Instead the Player only passes decoded bytes to
the consumer and expects that consumer to pass back decoded bytes through method
Player.write() which actually triggers audio to be played.
Player| Method Summary | |
|---|---|
int |
cdb()
Classes implementing this interface need to use this method to signal whether or not they consume bytes from method decoded(). |
void |
decoded(Player p,
byte[] buf,
int byteCount)
handle the fact that an amount of bytes has been decoded Implementations of this method can use the decoded bytes to drive additional devices such as a spectrum analyzer for instance before passing the decoded bytes back to the player. |
void |
exception(Player p,
Exception ex)
notify listeners of an exception during playing |
void |
progress(Player p,
long progressValue)
notify listeners of the current player progress |
void |
stateChanged(Player p,
int fromStatus,
int toStatus)
notify listeners that the status of a given Player thread changed |
| Method Detail |
|---|
void stateChanged(Player p,
int fromStatus,
int toStatus)
Player thread changed
p - Player the player whose status changedfromStatus - int the status changed fromtoStatus - int the status changed to
void progress(Player p,
long progressValue)
p - Player the player that fired the eventprogressValue - long the microseconds played so far
void exception(Player p,
Exception ex)
p - Player the player that fired the eventex - Exception the exception that occurred
void decoded(Player p,
byte[] buf,
int byteCount)
handle the fact that an amount of bytes has been decoded
Implementations of this method can use the decoded bytes to drive additional devices such as a spectrum analyzer for instance before passing the decoded bytes back to the player.
p - Player the player that fired the eventbuf - byte[] the decoded bytesbyteCount - int the number of bytes in bufint cdb()
Classes implementing this interface need to use this method to signal
whether or not they consume bytes from method decoded(). When
class returns true in this method, it is required to call method
Player.write() to actually play audio.
Player.write() accordingly
|
Copyright (c) 2004, 2005 Ulrich Hilger | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||