public abstract static class MediaSessionCompat.Callback extends Object
MediaSessionCompat.setCallback(android.support.v4.media.session.MediaSessionCompat.Callback)
.Constructor and Description |
---|
Callback() |
Modifier and Type | Method and Description |
---|---|
void |
onCommand(String command,
Bundle extras,
ResultReceiver cb)
Called when a controller has sent a custom command to this session.
|
void |
onCustomAction(String action,
Bundle extras)
Called when a
MediaControllerCompat wants a
PlaybackStateCompat.CustomAction to be performed. |
void |
onFastForward()
Override to handle requests to fast forward.
|
boolean |
onMediaButtonEvent(Intent mediaButtonEvent)
Override to handle media button events.
|
void |
onPause()
Override to handle requests to pause playback.
|
void |
onPlay()
Override to handle requests to begin playback.
|
void |
onPlayFromMediaId(String mediaId,
Bundle extras)
Override to handle requests to play a specific mediaId that was
provided by your app.
|
void |
onPlayFromSearch(String query,
Bundle extras)
Override to handle requests to begin playback from a search query.
|
void |
onPlayFromUri(Uri uri,
Bundle extras)
Override to handle requests to play a specific media item represented by a URI.
|
void |
onPrepare()
Override to handle requests to prepare playback.
|
void |
onPrepareFromMediaId(String mediaId,
Bundle extras)
Override to handle requests to prepare for playing a specific mediaId that was provided
by your app.
|
void |
onPrepareFromSearch(String query,
Bundle extras)
Override to handle requests to prepare playback from a search query.
|
void |
onPrepareFromUri(Uri uri,
Bundle extras)
Override to handle requests to prepare a specific media item represented by a URI.
|
void |
onRewind()
Override to handle requests to rewind.
|
void |
onSeekTo(long pos)
Override to handle requests to seek to a specific position in ms.
|
void |
onSetRating(RatingCompat rating)
Override to handle the item being rated.
|
void |
onSkipToNext()
Override to handle requests to skip to the next media item.
|
void |
onSkipToPrevious()
Override to handle requests to skip to the previous media item.
|
void |
onSkipToQueueItem(long id)
Override to handle requests to play an item with a given id from the
play queue.
|
void |
onStop()
Override to handle requests to stop playback.
|
public void onCommand(String command, Bundle extras, ResultReceiver cb)
command
- The command name.extras
- Optional parameters for the command, may be null.cb
- A result receiver to which a result may be sent by the command, may be null.public boolean onMediaButtonEvent(Intent mediaButtonEvent)
mediaButtonEvent
- The media button event intent.public void onPrepare()
PlaybackStateCompat.STATE_PAUSED
after the preparation is done.public void onPrepareFromMediaId(String mediaId, Bundle extras)
PlaybackStateCompat.STATE_PAUSED
after the preparation is done. The playback
of the prepared content should start in the implementation of onPlay()
. Override
onPlayFromMediaId(java.lang.String, android.os.Bundle)
to handle requests for starting playback without preparation.public void onPrepareFromSearch(String query, Bundle extras)
PlaybackStateCompat.STATE_PAUSED
after the preparation is done.
The playback of the prepared content should start in the implementation of
onPlay()
. Override onPlayFromSearch(java.lang.String, android.os.Bundle)
to handle requests for
starting playback without preparation.public void onPrepareFromUri(Uri uri, Bundle extras)
PlaybackStateCompat.STATE_PAUSED
after the preparation is done. The playback of
the prepared content should start in the implementation of onPlay()
. Override
onPlayFromUri(android.net.Uri, android.os.Bundle)
to handle requests for starting playback without preparation.public void onPlay()
public void onPlayFromMediaId(String mediaId, Bundle extras)
public void onPlayFromSearch(String query, Bundle extras)
public void onPlayFromUri(Uri uri, Bundle extras)
public void onSkipToQueueItem(long id)
public void onPause()
public void onSkipToNext()
public void onSkipToPrevious()
public void onFastForward()
public void onRewind()
public void onStop()
public void onSeekTo(long pos)
pos
- New position to move to, in milliseconds.public void onSetRating(RatingCompat rating)
rating
- public void onCustomAction(String action, Bundle extras)
MediaControllerCompat
wants a
PlaybackStateCompat.CustomAction
to be performed.action
- The action that was originally sent in the
PlaybackStateCompat.CustomAction
.extras
- Optional extras specified by the
MediaControllerCompat
.