|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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.Runnable
public void playNext()
Player
playNext
in interface Player
public void playPrevious()
Player
playPrevious
in interface Player
public void setCurrentTrackIndex(int ix)
Player
setCurrentTrackIndex
in interface Player
public void stop()
public void seek(int ms)
Player
seek
in interface Player
public void setPaused(boolean paused)
Player
setPaused
in interface Player
public boolean isPaused()
Player
isPaused
in interface Player
public int getTrackPosition()
Player
getTrackPosition
in interface Player
public long getRemaining()
Player
getRemaining
in interface Player
public void setShuffle(boolean shuffle)
Player
setShuffle
in interface Player
public void setRepeat(int repeat)
Player
setRepeat
in interface Player
public int getRepeat()
Player
Player.setRepeat(int)
getRepeat
in interface Player
public boolean getShuffle()
Player
Player.setShuffle(boolean)
getShuffle
in interface Player
public int getCurrentTrackIndex()
Player
Player.getPlaylist()
that is currently playing. If no track is playing return -1
getCurrentTrackIndex
in interface Player
public Track getCurrentTrack()
getCurrentTrack
in interface Player
public void setVolume(int volume)
Player
setVolume
in interface Player
volume
- the volume, between 0 and 100public int getVolume()
Player
getVolume
in interface Player
public int getRevision()
Player
getRevision
in interface Player
public java.lang.String getDisplayName()
Player
getDisplayName
in interface Player
public ManualPlaylist getPlaylist()
getPlaylist
in interface Player
public java.util.Collection<Speaker> getAvailableSpeakers()
Player
getAvailableSpeakers
in interface Player
public void addSpeaker(Speaker speaker)
Player
Speaker.setPlayer(org.qtunes.player.Player)
.
addSpeaker
in interface Player
public void removeSpeaker(Speaker speaker)
Player
Speaker.setPlayer(org.qtunes.player.Player)
.
removeSpeaker
in interface Player
public java.util.Collection<Speaker> getSpeakers()
Player
Speaker
objects current in use by this Player
getSpeakers
in interface Player
public void startService(ServiceContext context)
Service
startService
in interface Service
context
- the ServiceContext for this Servicepublic void stopService(ServiceContext context)
Service
stopService
in interface Service
context
- the ServiceContext for this Service (same as was passed into start)public ServiceContext getContext()
Service
Service.startService(org.qtunes.core.ServiceContext)
getContext
in interface Service
public 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 |