PlayerEventCallback

abstract class PlayerEventCallback
kotlin.Any
   ↳ 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

Public methods
open Unit

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

open Unit

Called when the player is prepared, i.

open Unit

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

open Unit

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

open Unit

Called to report buffering events for a data source.

open Unit

Called to indicate that the playback speed has changed.

Public constructors

<init>

PlayerEventCallback()

Public methods

onSeekCompleted

open fun onSeekCompleted(mpb: MediaPlayerInterface, position: Long): Unit

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

Parameters
mpb MediaPlayerInterface: the player that has completed seeking.
position MediaPlayerInterface: the previous seeking request.

See Also

onMediaPrepared

open fun onMediaPrepared(mpb: MediaPlayerInterface, dsd: DataSourceDesc): Unit

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 MediaPlayerInterface: the data source that the player is prepared to play.

onCurrentDataSourceChanged

open fun onCurrentDataSourceChanged(mpb: MediaPlayerInterface, dsd: DataSourceDesc?): Unit

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

Parameters
mpb MediaPlayerInterface: the player whose data source changed.
dsd MediaPlayerInterface: the new current data source. null, if no more data sources available.

onPlayerStateChanged

open fun onPlayerStateChanged(mpb: MediaPlayerInterface, state: Int): Unit

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 MediaPlayerInterface: the new state of the player.

onBufferingStateChanged

open fun onBufferingStateChanged(mpb: MediaPlayerInterface, dsd: DataSourceDesc, state: Int): Unit

Called to report buffering events for a data source.

Parameters
mpb MediaPlayerInterface: the player that is buffering
dsd MediaPlayerInterface: the data source for which buffering is happening.
state MediaPlayerInterface: the new buffering state.

onPlaybackSpeedChanged

open fun onPlaybackSpeedChanged(mpb: MediaPlayerInterface, speed: Float): Unit

Called to indicate that the playback speed has changed.

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