|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.evolution.player.ui.musicplayer.MusicPlayer
public abstract class MusicPlayer
A music player can play a given media.
It's guaranteed that the first call on a music player object is a call to
open(LocalMediaInfo, IStateCallback)
and the last call is a call to
stop()
, both methods are only called once. start()
is
always called before stop()
. pause()
is always called
before resume()
and only if canPause()
is true.
Clients must implement.
MusicPlayerProvider
Nested Class Summary | |
---|---|
static interface |
MusicPlayer.IStateCallback
A state callback is used by the player to notify the music player controller about state changes. |
Constructor Summary | |
---|---|
MusicPlayer()
|
Method Summary | |
---|---|
boolean |
canChangeVolume()
Is this player able to change the volume of the song it plays? |
abstract boolean |
canPause()
True if this player is able to pause the playback. |
boolean |
canSeek()
Does this music player support seeking? |
abstract void |
open(LocalMediaInfo info,
MusicPlayer.IStateCallback callback)
Prepare this music player to start playing the given media. |
abstract void |
pause()
Pause the playback. |
abstract void |
resume()
Resume the playback. |
void |
seek(int percentage)
Seek to the given percentage in the file, that is 0 is the beginning, 100 the end and 50 is the middle of the song. |
void |
setVolume(int volume)
Set the volume of the current song. |
abstract void |
start()
Start playing the media. |
abstract void |
stop()
Stop playing the media. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MusicPlayer()
Method Detail |
---|
public abstract void open(LocalMediaInfo info, MusicPlayer.IStateCallback callback) throws java.io.IOException
IOException
if the media can not be
opened for some reason.
info
- the media to be playedcallback
- the callback to notify about state changes
java.io.IOException
- if the media can not be readpublic abstract void start()
public abstract void stop()
public abstract boolean canPause()
public abstract void pause()
canPause()
returns
true.
public abstract void resume()
pause()
has been
called.
public boolean canSeek()
public void seek(int percentage)
percentage
- the percentage of played time after seek returnspublic boolean canChangeVolume()
public void setVolume(int volume)
canChangeVolume()
returns true
volume
- the volume in the range [0, 100]
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |