SessionPlayer.PlayerCallback

public static abstract class SessionPlayer.PlayerCallback
extends Object

java.lang.Object
   ↳ androidx.media2.common.SessionPlayer.PlayerCallback


A callback class to receive notifications for events on the session player. See SessionPlayer.registerPlayerCallback(Executor, PlayerCallback) to register this callback.

Summary

Public constructors

PlayerCallback()

Public methods

void onAudioAttributesChanged(SessionPlayer player, AudioAttributesCompat attributes)

Called when the player's current audio attributes are changed.

void onBufferingStateChanged(SessionPlayer player, MediaItem item, int buffState)

Called when a buffering events for a media item happened.

void onCurrentMediaItemChanged(SessionPlayer player, MediaItem item)

Called when the player's current media item has changed.

void onPlaybackCompleted(SessionPlayer player)

Called when the player finished playing.

void onPlaybackSpeedChanged(SessionPlayer player, float playbackSpeed)

Called when the playback speed has changed.

void onPlayerStateChanged(SessionPlayer player, int playerState)

Called when the state of the player has changed.

void onPlaylistChanged(SessionPlayer player, List<MediaItem> list, MediaMetadata metadata)

Called when a playlist is changed.

void onPlaylistMetadataChanged(SessionPlayer player, MediaMetadata metadata)

Called when a playlist metadata is changed.

void onRepeatModeChanged(SessionPlayer player, int repeatMode)

Called when the repeat mode is changed.

void onSeekCompleted(SessionPlayer player, long position)

Called when SessionPlayer.seekTo(long) is completed.

void onShuffleModeChanged(SessionPlayer player, int shuffleMode)

Called when the shuffle mode is changed.

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

Called when the player's subtitle track has new subtitle data available.

void onTrackDeselected(SessionPlayer player, SessionPlayer.TrackInfo trackInfo)

Called when a track is deselected.

void onTrackSelected(SessionPlayer player, SessionPlayer.TrackInfo trackInfo)

Called when a track is selected.

void onTracksChanged(SessionPlayer player, 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(SessionPlayer player, VideoSize size)

Called to indicate the video size

The video size (width and height) could be 0 if there was no video, no display surface was set, or the value was not determined yet.

Inherited methods

Public constructors

PlayerCallback

public PlayerCallback ()

Public methods

onAudioAttributesChanged

public void onAudioAttributesChanged (SessionPlayer player, 
                AudioAttributesCompat attributes)

Called wh