public static abstract class MediaPlayer.PlayerCallback
extends SessionPlayer.PlayerCallback

   ↳ androidx.media2.common.SessionPlayer.PlayerCallback
     ↳ androidx.media2.player.MediaPlayer.PlayerCallback

Interface definition for callbacks to be invoked when the player has the corresponding events.


Public constructors


Public methods

void onError(MediaPlayer mp, MediaItem item, int what, int extra)

Called to indicate an error.

void onInfo(MediaPlayer mp, MediaItem item, int what, int extra)

Called to indicate an info or a warning.

void onMediaTimeDiscontinuity(MediaPlayer mp, MediaItem item, MediaTimestamp timestamp)

Called when a discontinuity in the normal progression of the media time is detected.

void onTimedMetaDataAvailable(MediaPlayer mp, MediaItem item, TimedMetaData data)

Called to indicate available timed metadata

This method will be called as timed metadata is extracted from the media, in the same order as it occurs in the media.

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.

void onVideoSizeChanged(MediaPlayer mp, MediaItem item, VideoSize size)

This method is deprecated. Use onVideoSizeChanged(SessionPlayer, androidx.media2.common.VideoSize) instead.

Inherited methods