public static abstract class SessionPlayer.PlayerCallback
extends 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.


Public constructors


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.