|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.qtunes.player.spi.PlayerImpl
public class PlayerImpl
A Player plays tracks to one or more speakers (technically a SourceDataLine
which may be a local speaker, an Airtunes speaker or some other type (eg RTSP, uPnP etc.)
Each player maintains it's own playlist and tracks may be cued, reordered, skipped
and so on as you'd expect.
| Constructor Summary | |
|---|---|
PlayerImpl()
|
|
| Method Summary | |
|---|---|
void |
addSpeaker(Speaker speaker)
Add a Speaker to the Player. |
java.util.Collection<Speaker> |
getAvailableSpeakers()
Get the collection of speakers that could be used by this Player and that aren't currently in use elsewhere. |
ServiceContext |
getContext()
Return the ServiceContext that was passed into Service.startService(org.qtunes.core.ServiceContext) |
Track |
getCurrentTrack()
Return the currently playing Track, or null if no track is playing |
int |
getCurrentTrackIndex()
Return the index in the list of tracks returned from Player.getPlaylist()
that is currently playing. |
java.lang.String |
getDisplayName()
Return a nice name for this Player for display to the user |
ManualPlaylist |
getPlaylist()
Return the Playlist |
long |
getRemaining()
Return the number of milliseconds remaining in the playlist. |
int |
getRepeat()
Get the repeat mode, as set by Player.setRepeat(int) |
int |
getRevision()
Return the revision number. |
boolean |
getShuffle()
Get the shuffle mode, as set by Player.setShuffle(boolean) |
java.util.Collection<Speaker> |
getSpeakers()
Return the list of Speaker objects current in use by this Player |
int |
getTrackPosition()
Return the number of milliseconds into the currently playing track. |
int |
getVolume()
Return the current volume |
void |
handleEvent(java.lang.String name,
java.util.Map<?,?> properties)
|
boolean |
isPaused()
Return true if the player is paused, false if it's playing or stopped. |
void |
playNext()
Skip to the next track in the playlist. |
void |
playPrevious()
Skip to the previous track in the playlist. |
void |
removeSpeaker(Speaker speaker)
Remove a Speaker to the Player. |
java.util.Map<java.lang.String,java.lang.Object> |
reportState()
Return a Map describing the state of this Service, for serialization back to any client that needs to know (eg webplayer) - so values should be serializable objects, eg Lists, Maps or simple objects. |
void |
run()
The main play thread. |
void |
seek(int ms)
Seek to the specified millisecond value in the current track If the value is outsize the valid range this method does nothing |
void |
setCurrentTrackIndex(int ix)
Set the currently playing track |
void |
setPaused(boolean paused)
Set the player to be paused (true) or playing (false). |
void |
setRepeat(int repeat)
Set the style of repeat - none (0), track only (1) or playlist (2) |
void |
setShuffle(boolean shuffle)
Set whether to shuffle the playlist |
void |
setVolume(int volume)
Set the current volume |
void |
startService(ServiceContext context)
Start the Service |
void |
stop()
|
void |
stopService(ServiceContext context)
Stop the Service |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PlayerImpl()
| Method Detail |
|---|
public void run()
run in interface java.lang.Runnablepublic void playNext()
Player
playNext in interface Playerpublic void playPrevious()
Player
playPrevious in interface Playerpublic void setCurrentTrackIndex(int ix)
Player
setCurrentTrackIndex in interface Playerpublic void stop()
public void seek(int ms)
Player
seek in interface Playerpublic void setPaused(boolean paused)
Player
setPaused in interface Playerpublic boolean isPaused()
Player
isPaused in interface Playerpublic int getTrackPosition()
Player
getTrackPosition in interface Playerpublic long getRemaining()
Player
getRemaining in interface Playerpublic void setShuffle(boolean shuffle)
Player
setShuffle in interface Playerpublic void setRepeat(int repeat)
Player
setRepeat in interface Playerpublic int getRepeat()
PlayerPlayer.setRepeat(int)
getRepeat in interface Playerpublic boolean getShuffle()
PlayerPlayer.setShuffle(boolean)
getShuffle in interface Playerpublic int getCurrentTrackIndex()
PlayerPlayer.getPlaylist()
that is currently playing. If no track is playing return -1
getCurrentTrackIndex in interface Playerpublic Track getCurrentTrack()
getCurrentTrack in interface Playerpublic void setVolume(int volume)
Player
setVolume in interface Playervolume - the volume, between 0 and 100public int getVolume()
Player
getVolume in interface Playerpublic int getRevision()
Player
getRevision in interface Playerpublic java.lang.String getDisplayName()
Player
getDisplayName in interface Playerpublic ManualPlaylist getPlaylist()
getPlaylist in interface Playerpublic java.util.Collection<Speaker> getAvailableSpeakers()
Player
getAvailableSpeakers in interface Playerpublic void addSpeaker(Speaker speaker)
PlayerSpeaker.setPlayer(org.qtunes.player.Player).
addSpeaker in interface Playerpublic void removeSpeaker(Speaker speaker)
PlayerSpeaker.setPlayer(org.qtunes.player.Player).
removeSpeaker in interface Playerpublic java.util.Collection<Speaker> getSpeakers()
PlayerSpeaker objects current in use by this Player
getSpeakers in interface Playerpublic void startService(ServiceContext context)
Service
startService in interface Servicecontext - the ServiceContext for this Servicepublic void stopService(ServiceContext context)
Service
stopService in interface Servicecontext - the ServiceContext for this Service (same as was passed into start)public ServiceContext getContext()
ServiceService.startService(org.qtunes.core.ServiceContext)
getContext in interface Servicepublic java.util.Map<java.lang.String,java.lang.Object> reportState()
Service
reportState in interface Service
public void handleEvent(java.lang.String name,
java.util.Map<?,?> properties)
handleEvent in interface Listener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||