MediaController.ControllerCallback

public static abstract class MediaController.ControllerCallback
extends Object

java.lang.Object
   ↳ androidx.media2.session.MediaController.ControllerCallback


Interface for listening to change in activeness of the MediaSession. It's active if and only if it has set a player.

Summary

Public constructors

ControllerCallback()

Public methods

void onAllowedCommandsChanged(MediaController controller, SessionCommandGroup commands)

Called when the allowed commands are changed by session.

void onBufferingStateChanged(MediaController controller, MediaItem item, int state)

Called to report buffering events for a media item.

void onConnected(MediaController controller, SessionCommandGroup allowedCommands)

Called when the controller is successfully connected to the session.

void onCurrentMediaItemChanged(MediaController controller, MediaItem item)

Called when the current item is changed.

SessionResult onCustomCommand(MediaController controller, SessionCommand command, Bundle args)

Called when the session sent a custom command.

void onDisconnected(MediaController controller)

Called when the session refuses the controller or the controller is disconnected from the session.

void onPlaybackCompleted(MediaController controller)

Called when the playback is completed.

void onPlaybackInfoChanged(MediaController controller, MediaController.PlaybackInfo info)

Called when the session has changed anything related with the MediaController.PlaybackInfo.

void onPlaybackSpeedChanged(MediaController controller, float speed)

Called when playback speed is changed.

void onPlayerStateChanged(MediaController controller, int state)

Called when the player state is changed.

void onPlaylistChanged(MediaController controller, List<MediaItem> list, MediaMetadata metadata)

Called when a playlist is changed.

void onPlaylistMetadataChanged(MediaController controller, MediaMetadata metadata)

Called when a playlist metadata is changed.

void onRepeatModeChanged(MediaController controller, int repeatMode)

Called when the repeat mode is changed.

void onSeekCompleted(MediaController controller, long position)

Called to indicate that seeking is completed.

int onSetCustomLayout(MediaController controller, List<MediaSession.CommandButton> layout)

Called when the session set the custom layout through the MediaSession.setCustomLayout(MediaSession.ControllerInfo, List).

void onShuffleModeChanged(MediaController controller, int shuffleMode)

Called when the shuffle mode is changed.

void onSubtitleData(MediaController controller, MediaItem item, SessionPlayer.TrackInfo track, SubtitleData data)

Called when the subtitle track has new subtitle data available.

void onTrackDeselected(MediaController controller, SessionPlayer.TrackInfo trackInfo)

Called when a track is deselected.

void onTrackSelected(MediaController controller, SessionPlayer.TrackInfo trackInfo)

Called when a track is selected.

void onTracksChanged(MediaController controller, List<SessionPlayer.TrackInfo> tracks)

Called when the tracks of the current media item is changed such as 1) when tracks of a media item become available, 2) when new tracks are found during playback, or 3) when the current media item is changed.

void onVideoSizeChanged(MediaController controller, VideoSize videoSize)

Called when video size is changed.

Inherited methods