com.evolution.player.ui.musicplayer
Interface IMusicPlayerController


public interface IMusicPlayerController

A music player controller can be used to control a music player.

Since:
0.6
See Also:
EvolutionPlayerUI.getMusicPlayerController()

Nested Class Summary
static class IMusicPlayerController.MusicPlayerControllerListener
          A music player controller listener is informed about state changes in the music player.
 
Method Summary
 void addPlayListener(IMusicPlayerController.MusicPlayerControllerListener listener)
          Add the given listener to the list of controller listeners.
 boolean canChangeVolume()
          Can the volume of the current song be changed?
 boolean canPause()
          Can the current song be paused?
 boolean canSeek()
          Can the current song be seeked?
 LocalMediaInfo getCurrent()
          Returns the song currently played.
 long getTimePlayed()
          The amount of milliseconds the current song as been played so far.
 int getVolume()
          The volume of the current song in the range [0, 100]
 boolean isPaused()
          Is the player in the pause state?
 void next()
          Play the next song, this is either a randomly chosen song or a song previously added with pushSong(LocalMediaInfo).
 void pause()
          Pause the playback, only has an effect if canPause() returns true for the same song.
 void play(LocalMediaInfo media)
          Start playing the given song.
 void previous()
          Play the previously played song, if the current song has been played for less then a couple of seconds, replay the current song otherwise.
 void pushSong(LocalMediaInfo media)
          Push the given media to the next play list.
 void removePlayListener(IMusicPlayerController.MusicPlayerControllerListener listener)
          Remove the given listener from the list of controller listeners.
 void resume()
          Resume the playback, only has an effect if isPaused() returns true.
 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 music player.
 void start()
          Start playing some random chosen song.
 void stop()
          Stop playing the current song.
 

Method Detail

start

void start()
Start playing some random chosen song.


stop

void stop()
Stop playing the current song.


isPaused

boolean isPaused()
Is the player in the pause state?

Returns:
true if the player is paused

canPause

boolean canPause()
Can the current song be paused?

Returns:
true if pause() has any effect for the current song

pause

void pause()
Pause the playback, only has an effect if canPause() returns true for the same song.


resume

void resume()
Resume the playback, only has an effect if isPaused() returns true.


next

void next()
Play the next song, this is either a randomly chosen song or a song previously added with pushSong(LocalMediaInfo).


previous

void previous()
Play the previously played song, if the current song has been played for less then a couple of seconds, replay the current song otherwise.


getCurrent

LocalMediaInfo getCurrent()
Returns the song currently played.

Returns:
the current song

play

void play(LocalMediaInfo media)
Start playing the given song.

Parameters:
media - the media to play

pushSong

void pushSong(LocalMediaInfo media)
Push the given media to the next play list. The next play is is a FIFO list which is used by next(). If the list is empty a random song will be chosen, otherwise the first song in the list will be used and removed from the list. pushSong(LocalMediaInfo) adds the given media to the end of the list.

Parameters:
media - the media to add to the next list

getTimePlayed

long getTimePlayed()
The amount of milliseconds the current song as been played so far.

Returns:
the amount played in milliseconds

addPlayListener

void addPlayListener(IMusicPlayerController.MusicPlayerControllerListener listener)
Add the given listener to the list of controller listeners.

Parameters:
listener - the listener to add

removePlayListener

void removePlayListener(IMusicPlayerController.MusicPlayerControllerListener listener)
Remove the given listener from the list of controller listeners.

Parameters:
listener - the listener to remove

canSeek

boolean canSeek()
Can the current song be seeked?

Returns:
true if the current song can be seeked.

seek

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.

Parameters:
percentage - the percentage of played time after seek returns

canChangeVolume

boolean canChangeVolume()
Can the volume of the current song be changed?

Returns:
true if the volume can be changed

setVolume

void setVolume(int volume)
Set the volume of the music player. This has only an effect for songs for which canChangeVolume() returns true.

Parameters:
volume - the volume to set in the range [0, 100]

getVolume

int getVolume()
The volume of the current song in the range [0, 100]

Returns:
the volume in the range [0, 100]