public abstract class

MediaControllerCompat.Callback

extends java.lang.Object

 java.lang.Object

↳androidx.media3.session.legacy.MediaControllerCompat.Callback

Overview

Callback for receiving updates on from the session. A Callback can be registered using MediaControllerCompat.registerCallback(MediaControllerCompat.Callback)

Summary

Constructors
publicCallback()

Methods
public voidbinderDied()

public voidonAudioInfoChanged(MediaControllerCompat.PlaybackInfo info)

Override to handle changes to the audio info.

public voidonCaptioningEnabledChanged(boolean enabled)

Override to handle changes to the captioning enabled status.

public voidonExtrasChanged(Bundle extras)

Override to handle changes to the MediaSessionCompat extras.

public voidonMetadataChanged(MediaMetadataCompat metadata)

Override to handle changes to the current metadata.

public voidonPlaybackStateChanged(PlaybackStateCompat state)

Override to handle changes in playback state.

public voidonQueueChanged(java.util.List<MediaSessionCompat.QueueItem> queue)

Override to handle changes to items in the queue.

public voidonQueueTitleChanged(java.lang.CharSequence title)

Override to handle changes to the queue title.

public voidonRepeatModeChanged(int repeatMode)

Override to handle changes to the repeat mode.

public voidonSessionDestroyed()

Override to handle the session being destroyed.

public voidonSessionEvent(java.lang.String event, Bundle extras)

Override to handle custom events sent by the session owner without a specified interface.

public voidonSessionReady()

Override to handle the session being ready.

public voidonShuffleModeChanged(int shuffleMode)

Override to handle changes to the shuffle mode.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Callback()

Methods

public void onSessionReady()

Override to handle the session being ready.

See also: MediaControllerCompat.isSessionReady()

public void onSessionDestroyed()

Override to handle the session being destroyed. The session is no longer valid after this call and calls to it will be ignored.

public void onSessionEvent(java.lang.String event, Bundle extras)

Override to handle custom events sent by the session owner without a specified interface. Controllers should only handle these for sessions they own.

Parameters:

event: The event from the session.
extras: Optional parameters for the event.

public void onPlaybackStateChanged(PlaybackStateCompat state)

Override to handle changes in playback state.

Parameters:

state: The new playback state of the session

public void onMetadataChanged(MediaMetadataCompat metadata)

Override to handle changes to the current metadata.

Parameters:

metadata: The current metadata for the session or null if none.

See also: MediaMetadataCompat

public void onQueueChanged(java.util.List<MediaSessionCompat.QueueItem> queue)

Override to handle changes to items in the queue.

Parameters:

queue: A list of items in the current play queue. It should include the currently playing item as well as previous and upcoming items if applicable.

See also: MediaSessionCompat.QueueItem

public void onQueueTitleChanged(java.lang.CharSequence title)

Override to handle changes to the queue title.

Parameters:

title: The title that should be displayed along with the play queue such as "Now Playing". May be null if there is no such title.

public void onExtrasChanged(Bundle extras)

Override to handle changes to the MediaSessionCompat extras.

Parameters:

extras: The extras that can include other information associated with the MediaSessionCompat.

public void onAudioInfoChanged(MediaControllerCompat.PlaybackInfo info)

Override to handle changes to the audio info.

Parameters:

info: The current audio info for this session.

public void onCaptioningEnabledChanged(boolean enabled)

Override to handle changes to the captioning enabled status.

Parameters:

enabled: true if captioning is enabled, false otherwise.

public void onRepeatModeChanged(int repeatMode)

Override to handle changes to the repeat mode.

Parameters:

repeatMode: The repeat mode. It should be one of followings: PlaybackStateCompat.REPEAT_MODE_NONE, PlaybackStateCompat.REPEAT_MODE_ONE, PlaybackStateCompat.REPEAT_MODE_ALL, PlaybackStateCompat.REPEAT_MODE_GROUP

public void onShuffleModeChanged(int shuffleMode)

Override to handle changes to the shuffle mode.

Parameters:

shuffleMode: The shuffle mode. Must be one of the following: PlaybackStateCompat.SHUFFLE_MODE_NONE, PlaybackStateCompat.SHUFFLE_MODE_ALL, PlaybackStateCompat.SHUFFLE_MODE_GROUP

public void binderDied()