Added in API level 28

OnMediaTimeDiscontinuityListener

interface OnMediaTimeDiscontinuityListener
android.media.MediaPlayer.OnMediaTimeDiscontinuityListener

Interface definition of a callback to be invoked when discontinuity in the normal progression of the media time is detected. The "normal progression" of media time is defined as the expected increase of the playback position when playing media, relative to the playback speed (for instance every second, media time increases by two seconds when playing at 2x).
Discontinuities are encountered in the following cases:

  • when the player is starved for data and cannot play anymore
  • when the player encounters a playback error
  • when the a seek operation starts, and when it's completed
  • when the playback speed changes
  • when the playback state changes
  • when the player is reset
See the MediaPlayer#setOnMediaTimeDiscontinuityListener(OnMediaTimeDiscontinuityListener, Handler) method to set a listener for these events.

Summary

Public methods
abstract Unit

Called to indicate a time discontinuity has occured.

Public methods

onMediaTimeDiscontinuity

Added in API level 28
abstract fun onMediaTimeDiscontinuity(
    mp: MediaPlayer,
    mts: MediaTimestamp
): Unit

Called to indicate a time discontinuity has occured.

Parameters
mp MediaPlayer: the MediaPlayer for which the discontinuity has occured. This value cannot be null.
mts MediaTimestamp: the timestamp that correlates media time, system time and clock rate, or MediaTimestamp#TIMESTAMP_UNKNOWN in an error case. This value cannot be null.