java.lang.Object | |
↳ | com.neomades.media.Player |
![]() |
Player base.
This abstract class provides basic functions of a player.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
long | TIME_UNKNOWN | Long value for unknown time |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
long |
getCurrentTime()
Returns the current time in milliseconds.
| ||||||||||
long |
getDuration()
Returns the duration of the media in milliseconds.
| ||||||||||
int |
getVolume()
Returns the volume level in percent (between 0 and 100).
| ||||||||||
boolean |
isLooping()
If the player is looping or non-looping.
| ||||||||||
boolean |
isMuted()
Returns if the player is muted.
| ||||||||||
boolean |
isPlaying()
Returns if the current player is playing
| ||||||||||
void |
pause()
Pauses a media (playback can be resumed with
play() )
| ||||||||||
void |
play()
Plays or resumes a media asynchronously.
| ||||||||||
void |
play(long startTime)
Plays a media asynchronously at the specified
startTime
parameter. | ||||||||||
void |
prepare()
Prepare buffering the media to play.
| ||||||||||
void |
release()
Releases memory and media data.
| ||||||||||
void |
setCurrentTime(long time)
Sets the current time where the player is positioned.
| ||||||||||
void |
setLooping(boolean looping)
Sets the player to be looping or non-looping.
| ||||||||||
void |
setMuted(boolean muted)
Set the player to be muted or not.
| ||||||||||
void |
setPlayerListener(PlayerListener listener)
Sets a player event listener.
| ||||||||||
void |
setVolume(int volume)
Sets the track volume.
| ||||||||||
void |
stop()
Stop a media and back to the position 0 of the media.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Long value for unknown time
Returns the current time in milliseconds.
Returns the duration of the media in milliseconds.
This function could return TIME_UNKNOWN
in some cases :
Returns the volume level in percent (between 0 and 100).
If the player is looping or non-looping.
Returns if the player is muted.
Returns if the current player is playing
Plays or resumes a media asynchronously.
Plays a media asynchronously at the specified startTime
parameter.
startTime | time where to start to play. |
---|
Prepare buffering the media to play.
Releases memory and media data.
The player will not be longer available after calling this method.
Sets the current time where the player is positioned.
time | time in milliseconds |
---|
Sets the player to be looping or non-looping.
looping | infinite loop or no loop |
---|
Set the player to be muted or not.
muted | if the player should be muted |
---|
Sets a player event listener.
listener | the player listener |
---|
Sets the track volume.
The real volume depends on two volume levels (the track volume and the main volume).
realVolume = mainVolume x trackVolume
By default, the mainVolume
and trackVolume
are
equal to 100.
If the volume given in parameter is less than zero, the volume will be 0. For values greater than 100 volume will be 100.
volume | between 0 and 100 |
---|
Stop a media and back to the position 0 of the media.