belongs to Maven artifact androidx.media:media:1.0.0-alpha1

MediaPlayerInterface.PlayerEventCallback

public static abstract class MediaPlayerInterface.PlayerEventCallback
extends Object

java.lang.Object
   ↳ androidx.media.MediaPlayerInterface.PlayerEventCallback


A callback class to receive notifications for events on the media player. See MediaPlayerInterface.registerPlayerEventCallback(Executor, PlayerEventCallback) to register this callback.

Summary

Public constructors

MediaPlayerInterface.PlayerEventCallback()

Public methods

void onBufferingStateChanged(MediaPlayerInterface mpb, DataSourceDesc dsd, int state)

Called to report buffering events for a data source.

void onCurrentDataSourceChanged(MediaPlayerInterface mpb, DataSourceDesc dsd)

Called when the player's current data source has changed.

void onMediaPrepared(MediaPlayerInterface mpb, DataSourceDesc dsd)

Called when the player is prepared, i.e.

void onPlaybackSpeedChanged(MediaPlayerInterface mpb, float speed)

Called to indicate that the playback speed has changed.

void onPlayerStateChanged(MediaPlayerInterface mpb, int state)

Called to indicate that the state of the player has changed.

void onSeekCompleted(MediaPlayerInterface mpb, long position)

Called to indicate that MediaPlayerInterface.seekTo(long) is completed.

Inherited methods

Public constructors

MediaPlayerInterface.PlayerEventCallback

MediaPlayerInterface.PlayerEventCallback ()

Public methods

onBufferingStateChanged

void onBufferingStateChanged (MediaPlayerInterface mpb, 
                DataSourceDesc dsd, 
                int state)

Called to report buffering events for a data source.

Parameters
mpb MediaPlayerInterface: the player that is buffering

dsd DataSourceDesc: the data source for which buffering is happening.

state int: the new buffering state.

onCurrentDataSourceChanged

void onCurrentDataSourceChanged (MediaPlayerInterface mpb, 
                DataSourceDesc dsd)

Called when the player's current data source has changed.

Parameters
mpb MediaPlayerInterface: the player whose data source changed.

dsd DataSourceDesc: the new current data source. null, if no more data sources available.

onMediaPrepared

void onMediaPrepared (MediaPlayerInterface mpb, 
                DataSourceDesc dsd)

Called when the player is prepared, i.e. it is ready to play the content referenced by the given data source.

Parameters
mpb MediaPlayerInterface: the player that is prepared.

dsd DataSourceDesc: the data source that the player is prepared to play.

onPlaybackSpeedChanged

void onPlaybackSpeedChanged (MediaPlayerInterface mpb, 
                float speed)

Called to indicate that the playback speed has changed.

Parameters
mpb MediaPlayerInterface: the player that has changed the playback speed.

speed float: the new playback speed.

onPlayerStateChanged

void onPlayerStateChanged (MediaPlayerInterface mpb, 
                int state)

Called to indicate that the state of the player has changed. See MediaPlayerInterface.getPlayerState() for polling the player state.

Parameters
mpb MediaPlayerInterface: the player whose state has changed.

state int: the new state of the player.

onSeekCompleted

void onSeekCompleted (MediaPlayerInterface mpb, 
                long position)

Called to indicate that MediaPlayerInterface.seekTo(long) is completed.

Parameters
mpb MediaPlayerInterface: the player that has completed seeking.

position long: the previous seeking request.