Google se compromete a impulsar la igualdad racial para las comunidades afrodescendientes. Obtén información al respecto.

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 when the player's current audio attributes are changed.

Parameters
player SessionPlayer: the player whose audio attributes are changed

attributes AudioAttributesCompat: the new current audio attributes

onBufferingStateChanged

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

Called when a buffering events for a media item happened.

Parameters
player SessionPlayer: the player that is buffering

item MediaItem: the media item for which buffering is happening

buffState int: the new buffering state

onCurrentMediaItemChanged

public void onCurrentMediaItemChanged (SessionPlayer player, 
                MediaItem item)

Called when the player's current media item has changed. Generally called after a new media item is set through SessionPlayer.setPlaylist(List, MediaMetadata) or SessionPlayer.setMediaItem(MediaItem), or after skipping to a different item in a given playlist.

Parameters
player SessionPlayer: the player whose media item changed

item MediaItem: the new current media item

onPlaybackCompleted

public void onPlaybackCompleted (SessionPlayer player)

Called when the player finished playing. Playback state would be also set SessionPlayer.PLAYER_STATE_PAUSED with it.

This will be called only when the repeat mode is set to SessionPlayer.REPEAT_MODE_NONE.

Parameters
player SessionPlayer: the player whose playback is completed

onPlaybackSpeedChanged

public void onPlaybackSpeedChanged (SessionPlayer player, 
                float playbackSpeed)

Called when the playback speed has changed.

Parameters
player SessionPlayer: the player that has changed the playback speed

playbackSpeed float: the new playback speed

onPlayerStateChanged

public void onPlayerStateChanged (SessionPlayer player, 
                int playerState)

Called when the state of the player has changed.

Parameters
player SessionPlayer: the player whose state has changed

playerState int: the new state of the player

onPlaylistChanged

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

Called when a playlist is changed. It's also called after SessionPlayer.setPlaylist(List, MediaMetadata) or SessionPlayer.setMediaItem(MediaItem).

Parameters
player SessionPlayer: the player that has changed the playlist and playlist metadata

list List: new playlist

metadata MediaMetadata: new metadata

onPlaylistMetadataChanged

public void onPlaylistMetadataChanged (SessionPlayer player, 
                MediaMetadata metadata)

Called when a playlist metadata is changed.

Parameters
player SessionPlayer: the player that has changed the playlist metadata

metadata MediaMetadata: new metadata

onRepeatModeChanged

public void onRepeatModeChanged (SessionPlayer player, 
                int repeatMode)

Called when the repeat mode is changed.

SessionPlayer.getPreviousMediaItemIndex() and SessionPlayer.getNextMediaItemIndex() values can be outdated when this callback is called if the current media item is the first or last item in the playlist.

Parameters
player SessionPlayer: player for this event

repeatMode int: repeat mode

onSeekCompleted

public void onSeekCompleted (SessionPlayer player, 
                long position)

Called when SessionPlayer.seekTo(long) is completed.

Parameters
player SessionPlayer: the player that has completed seeking

position long: the previous seeking request

onShuffleModeChanged

public void onShuffleModeChanged (SessionPlayer player, 
                int shuffleMode)

Called when the shuffle mode is changed.

SessionPlayer.getPreviousMediaItemIndex() and SessionPlayer.getNextMediaItemIndex() values can be outdated when this callback is called if the current media item is the first or last item in the playlist.

Parameters
player SessionPlayer: playlist agent for this event

shuffleMode int: shuffle mode

onSubtitleData

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

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

Parameters
player SessionPlayer: the player that reports the new subtitle data

item MediaItem: the MediaItem of this media item

track SessionPlayer.TrackInfo: the track that has the subtitle data

data SubtitleData: the subtitle data

onTrackDeselected

public void onTrackDeselected (SessionPlayer player, 
                SessionPlayer.TrackInfo trackInfo)

Called when a track is deselected.

This callback will generally be called only after calling SessionPlayer.deselectTrack(TrackInfo).

Parameters
player SessionPlayer: the player associated with this callback

trackInfo SessionPlayer.TrackInfo: the deselected track

onTrackSelected

public void onTrackSelected (SessionPlayer player, 
                SessionPlayer.TrackInfo trackInfo)

Called when a track is selected.

Parameters
player SessionPlayer: the player associated with this callback

trackInfo SessionPlayer.TrackInfo: the selected track

onTracksChanged

public 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.

When it's called, you should invalidate previous track information and use the new tracks to call SessionPlayer.selectTrack(TrackInfo) or SessionPlayer.deselectTrack(TrackInfo).

Parameters
player SessionPlayer: the player associated with this callback

tracks List: the list of tracks. It can be empty

onVideoSizeChanged

public 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.

This callback is generally called when player updates video size, but will also be called when onCurrentMediaItemChanged(SessionPlayer, MediaItem) is called.

Parameters
player SessionPlayer: the player associated with this callback

size VideoSize: the size of the video