MediaSessionCompat.Callback

public static abstract class MediaSessionCompat.Callback
extends Object

java.lang.Object
   ↳ android.support.v4.media.session.MediaSessionCompat.Callback


Receives transport controls, media buttons, and commands from controllers and the system. The callback may be set using MediaSessionCompat.setCallback(MediaSessionCompat.Callback).

Don't reuse the callback among the sessions. Callbacks keep internal reference to the session when it's set, so it may misbehave.

Summary

Public constructors

Callback()

Public methods

void onAddQueueItem(MediaDescriptionCompat description, int index)

Called when a MediaControllerCompat wants to add a MediaSessionCompat.QueueItem with the given description at the specified position in the play queue.

void onAddQueueItem(MediaDescriptionCompat description)

Called when a MediaControllerCompat wants to add a MediaSessionCompat.QueueItem with the given description at the end of the play queue.

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 onRemoveQueueItem(MediaDescriptionCompat description)

Called when a MediaControllerCompat wants to remove the first occurrence of the specified MediaSessionCompat.QueueItem with the given description in the play queue.

void onRemoveQueueItemAt(int index)

This method is deprecated. onRemoveQueueItem(MediaDescriptionCompat) will be called instead.

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 onSetCaptioningEnabled(boolean enabled)

Override to handle requests to enable/disable captioning.

void onSetPlaybackSpeed(float speed)

Override to handle the playback speed change.

void onSetRating(RatingCompat rating)

Override to handle the item being rated.

void onSetRating(RatingCompat rating, Bundle extras)

Override to handle the item being rated.

void onSetRepeatMode(int repeatMode)

Override to handle the setting of the repeat mode.

void onSetShuffleMode(int shuffleMode)

Override to handle the setting of the shuffle mode.

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.

Inherited methods