public interface Player
Modifier and Type | Interface and Description |
---|---|
static interface |
Player.AudioDeliveredCallback
Interface used to register callback for audio data received
from native player.
|
static interface |
Player.AudioFlushCallback
Interface used to register callback for audio flush command
received from native player.
|
static interface |
Player.NotificationCallback |
static interface |
Player.OperationCallback |
Modifier and Type | Method and Description |
---|---|
boolean |
addConnectionStateCallback(ConnectionStateCallback callback) |
boolean |
addNotificationCallback(Player.NotificationCallback callback) |
void |
destroy()
Destroys the native player.
|
Metadata |
getMetadata() |
PlaybackState |
getPlaybackState() |
void |
initialize(Config config)
Initializes the native player.
|
boolean |
login(String oauthToken)
Logs in to the native player.
|
boolean |
logout()
Log out from the native player.
|
void |
pause(Player.OperationCallback callback)
Pauses currently playing track.
|
void |
playUri(Player.OperationCallback callback,
String uri,
int index,
int positionInMs)
Plays a single uri from specified index and specified position.
|
void |
queue(Player.OperationCallback callback,
String trackUri)
Queue the track.
|
void |
refreshCache()
Triggers cache refresh and possible eviction of state data.
|
boolean |
removeConnectionStateCallback(ConnectionStateCallback callback) |
boolean |
removeNotificationCallback(Player.NotificationCallback callback) |
void |
resume(Player.OperationCallback callback)
Resumes currently playing track.
|
void |
seekToPosition(Player.OperationCallback callback,
int positionInMs)
Skips currently playing song to defined position.
|
void |
setConnectivityStatus(Player.OperationCallback callback,
Connectivity status)
Sends the information about current connectivity
to native player.
|
void |
setPlaybackBitrate(Player.OperationCallback callback,
PlaybackBitrate playbackBitrate)
Set the bitrate of the player to specified value.
|
void |
setRepeat(Player.OperationCallback callback,
boolean enabled)
Turns repeating on and off.
|
void |
setShuffle(Player.OperationCallback callback,
boolean enabled)
Turns shuffling on and off.
|
void |
skipToNext(Player.OperationCallback callback)
Skips to next track.
|
void |
skipToPrevious(Player.OperationCallback callback)
Skips to previous track.
|
boolean addNotificationCallback(Player.NotificationCallback callback)
boolean removeNotificationCallback(Player.NotificationCallback callback)
void initialize(Config config)
config
- The configuration object to init native player with.void destroy()
boolean login(String oauthToken)
oauthToken
- The token to log in with.
Note: not all login errors have to be immediate.
For details refer to specific implementation.boolean logout()
boolean addConnectionStateCallback(ConnectionStateCallback callback)
boolean removeConnectionStateCallback(ConnectionStateCallback callback)
void playUri(Player.OperationCallback callback, String uri, int index, int positionInMs)
callback
- operation result callbackuri
- Uri to play with the player.index
- A zero-based index from which to play.positionInMs
- A position to start playback from.
Note: not all playback errors have to be immediate.
For details refer to specific implementation.void queue(Player.OperationCallback callback, String trackUri)
callback
- operation result callbacktrackUri
- The uri of the track to queue.void pause(Player.OperationCallback callback)
callback
- operation result callbackvoid resume(Player.OperationCallback callback)
callback
- operation result callbackvoid skipToNext(Player.OperationCallback callback)
callback
- operation result callbackvoid skipToPrevious(Player.OperationCallback callback)
callback
- operation result callbackvoid seekToPosition(Player.OperationCallback callback, int positionInMs)
callback
- operation result callbackpositionInMs
- Position to skip to.void setShuffle(Player.OperationCallback callback, boolean enabled)
callback
- operation result callbackenabled
- if true shuffle will be turned on, off otherwise.void setRepeat(Player.OperationCallback callback, boolean enabled)
callback
- operation result callbackenabled
- if true repeat will be turned on, off otherwise.void setPlaybackBitrate(Player.OperationCallback callback, PlaybackBitrate playbackBitrate)
callback
- operation result callbackplaybackBitrate
- The bitrate to set playback to. By default is is set to PlaybackBitrate.BITRATE_NORMAL
for details
void setConnectivityStatus(Player.OperationCallback callback, Connectivity status)
callback
- operation result callbackstatus
- Must be one of Connectivity
properties.void refreshCache()
Metadata getMetadata()
PlaybackState getPlaybackState()