Google is committed to advancing racial equity for Black communities. See how.

Callback

abstract class Callback
kotlin.Any
   ↳ 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 setCallback.

Summary

Public constructors

Public methods

open Unit

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

open Unit
onAddQueueItem(description: MediaDescriptionCompat!, index: Int)

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

open Unit
onCommand(command: String!, extras: Bundle!, cb: ResultReceiver!)

Called when a controller has sent a custom command to this session.

open Unit
onCustomAction(action: String!, extras: Bundle!)

Called when a MediaControllerCompat wants a PlaybackStateCompat.CustomAction to be performed.

open Unit

Override to handle requests to fast forward.

open Boolean
onMediaButtonEvent(mediaButtonEvent: Intent!)

Override to handle media button events.

open Unit

Override to handle requests to pause playback.

open Unit

Override to handle requests to begin playback.

open Unit
onPlayFromMediaId(mediaId: String!, extras: Bundle!)

Override to handle requests to play a specific mediaId that was provided by your app.

open Unit
onPlayFromSearch(query: String!, extras: Bundle!)

Override to handle requests to begin playback from a search query.

open Unit
onPlayFromUri(uri: Uri!, extras: Bundle!)

Override to handle requests to play a specific media item represented by a URI.

open Unit

Override to handle requests to prepare playback.

open Unit
onPrepareFromMediaId(mediaId: String!, extras: Bundle!)

Override to handle requests to prepare for playing a specific mediaId that was provided by your app.

open Unit
onPrepareFromSearch(query: String!, extras: Bundle!)

Override to handle requests to prepare playback from a search query.

open Unit
onPrepareFromUri(uri: Uri!, extras: Bundle!)

Override to handle requests to prepare a specific media item represented by a URI.

open Unit

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

open Unit

Called when a MediaControllerCompat wants to remove a QueueItem at the specified position in the play queue.

open Unit

Override to handle requests to rewind.

open Unit
onSeekTo(pos: Long)

Override to handle requests to seek to a specific position in ms.

open Unit

Override to handle requests to enable/disable captioning.

open Unit

Override to handle the item being rated.

open Unit
onSetRating(rating: RatingCompat!, extras: Bundle!)

Override to handle the item being rated.

open Unit
onSetRepeatMode(repeatMode: Int)

Override to handle the setting of the repeat mode.

open Unit
onSetShuffleMode(shuffleMode: Int)

Override to handle the setting of the shuffle mode.

open Unit

Override to handle requests to skip to the next media item.

open Unit

Override to handle requests to skip to the previous media item.

open Unit

Override to handle requests to play an item with a given id from the play queue.

open Unit

Override to handle requests to stop playback.

Public constructors

<init>

Callback()

Public methods

onAddQueueItem

open fun onAddQueueItem(description: MediaDescriptionCompat!): Unit

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

Parameters
description MediaDescriptionCompat!: The MediaDescriptionCompat for creating the QueueItem to be inserted.

onAddQueueItem

open fun onAddQueueItem(description: MediaDescriptionCompat!, index: Int): Unit

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

Parameters
description MediaDescriptionCompat!: The MediaDescriptionCompat for creating the QueueItem to be inserted.
index MediaDescriptionCompat!: The index at which the created QueueItem is to be inserted.

onCommand

open fun onCommand(command: String!, extras: Bundle!, cb: ResultReceiver!): Unit

Called when a controller has sent a custom command to this session. The owner of the session may handle custom commands but is not required to.

Parameters
command String!: The command name.
extras String!: Optional parameters for the command, may be null.
cb String!: A result receiver to which a result may be sent by the command, may be null.

onCustomAction

open fun onCustomAction(action: String!, extras: Bundle!): Unit

Called when a MediaControllerCompat wants a PlaybackStateCompat.CustomAction to be performed.

Parameters
action String!: The action that was originally sent in the PlaybackStateCompat.CustomAction.
extras String!: Optional extras specified by the MediaControllerCompat.

onFastForward

open fun onFastForward(): Unit

Override to handle requests to fast forward.

onMediaButtonEvent

open fun onMediaButtonEvent(mediaButtonEvent: Intent!): Boolean

Override to handle media button events.

The double tap of KeyEvent#KEYCODE_MEDIA_PLAY_PAUSE or will ca