|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.bff.javampd.MPDPlayer
public class MPDPlayer
MPDPlayer represents a player controller to a MPD server. To obtain
an instance of the class you must use the getMPDPlayer method from
the MPD connection class. This class does not have a public constructor
(singleton model) so the object must be obtained from the connection object.
| Nested Class Summary | |
|---|---|
static class |
MPDPlayer.PlayerStatus
The status of the player. |
| Method Summary | |
|---|---|
void |
addPlayerChangeListener(PlayerChangeListener pcl)
Adds a PlayerChangeListener to this object to receive
PlayerChangeEvents. |
void |
addVolumeChangeListener(VolumeChangeListener vcl)
Adds a VolumeChangeListener to this object to receive
VolumeChangeEvents. |
protected void |
firePlayerChangeEvent(int id)
Sends the appropriate PlayerChangeEvent to all registered
PlayerChangeListeners. |
protected void |
fireVolumeChangeEvent(int volume)
Sends the appropriate VolumeChangeEvent to all registered
VolumeChangeListener. |
int |
getBitrate()
Returns the instantaneous bitrate of the currently playing song. |
MPDSong |
getCurrentSong()
Returns the current song either playing or queued for playing. |
long |
getElapsedTime()
Returns the elapsed time of the current song in seconds. |
MPDPlayer.PlayerStatus |
getStatus()
Returns the current status of the player. |
int |
getVolume()
Returns the current volume of the player. |
int |
getXFade()
Returns the cross fade of the player in seconds. |
boolean |
isRepeat()
Returns if the player is repeating. |
void |
mute()
Mutes the volume of the player. |
void |
pause()
Pauses the player. |
void |
play()
Starts the player. |
void |
playId(MPDSong song)
Starts the player with the specified song. |
void |
playNext()
Plays the next song in the playlist. |
void |
playPrev()
Plays the previous song in the playlist. |
void |
removePlayerChangedListener(PlayerChangeListener pcl)
Removes a PlayerChangeListener from this object. |
void |
removeVolumeChangedListener(VolumeChangeListener vcl)
Removes a VolumeChangeListener from this object. |
void |
seek(long secs)
Seeks to the desired location in the current song. |
void |
seekId(MPDSong song,
long secs)
Seeks to the desired location in the specified song. |
void |
setRepeat(boolean shouldRepeat)
Sets the repeating status of the player. |
void |
setVolume(int volume)
Sets the volume of the player. |
void |
setXFade(int xFade)
Sets the cross fade of the player in seconds. |
void |
stop()
Stops the player. |
void |
unMute()
Unmutes the volume of the player. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public MPDSong getCurrentSong()
throws MPDConnectionException,
MPDPlayerException
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the commandpublic void addPlayerChangeListener(PlayerChangeListener pcl)
PlayerChangeListener to this object to receive
PlayerChangeEvents.
pcl - the PlayerChangeListener to addpublic void removePlayerChangedListener(PlayerChangeListener pcl)
PlayerChangeListener from this object.
pcl - the PlayerChangeListener to removeprotected void firePlayerChangeEvent(int id)
PlayerChangeEvent to all registered
PlayerChangeListeners.
id - the event id to sendpublic void addVolumeChangeListener(VolumeChangeListener vcl)
VolumeChangeListener to this object to receive
VolumeChangeEvents.
vcl - the VolumeChangeListener to addpublic void removeVolumeChangedListener(VolumeChangeListener vcl)
VolumeChangeListener from this object.
vcl - the VolumeChangeListener to removeprotected void fireVolumeChangeEvent(int volume)
VolumeChangeEvent to all registered
VolumeChangeListener.
volume - the new volume
public void play()
throws MPDConnectionException,
MPDPlayerException
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public void playId(MPDSong song)
throws MPDConnectionException,
MPDPlayerException
song - the song to start the player with
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public void seek(long secs)
throws MPDConnectionException,
MPDPlayerException
secs - the location to seek to
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public void seekId(MPDSong song,
long secs)
throws MPDConnectionException,
MPDPlayerException
song - the song to seek insecs - the location to seek to
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public void stop()
throws MPDConnectionException,
MPDPlayerException
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public void pause()
throws MPDConnectionException,
MPDPlayerException
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public void playNext()
throws MPDConnectionException,
MPDPlayerException
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public void playPrev()
throws MPDConnectionException,
MPDPlayerException
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public void mute()
throws MPDConnectionException,
MPDPlayerException
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public void unMute()
throws MPDConnectionException,
MPDPlayerException
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public int getBitrate()
throws MPDConnectionException,
MPDPlayerException
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public int getVolume()
throws MPDConnectionException,
MPDPlayerException
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public void setVolume(int volume)
throws MPDConnectionException,
MPDPlayerException
volume - the volume level (0-100)
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public boolean isRepeat()
throws MPDConnectionException,
MPDPlayerException
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public void setRepeat(boolean shouldRepeat)
throws MPDConnectionException,
MPDPlayerException
shouldRepeat - should the player repeat the current song
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public int getXFade()
throws MPDConnectionException,
MPDPlayerException
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public void setXFade(int xFade)
throws MPDConnectionException,
MPDPlayerException
xFade - the amount of cross fade to set in seconds
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public long getElapsedTime()
throws MPDConnectionException,
MPDPlayerException
MPDPlayerException - if the MPD responded with an error
MPDConnectionException - if there is a problem sending the command
public MPDPlayer.PlayerStatus getStatus()
throws MPDException
MPDException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||