Stay organized with collections
Save and categorize content based on your preferences.
public
static
interface
MediaPlayer.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
public abstract void onMediaTimeDiscontinuity (MediaPlayer mp,
MediaTimestamp mts)
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 . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# MediaPlayer.OnMediaTimeDiscontinuityListener\n\nAdded in [API level 28](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nMediaPlayer.OnMediaTimeDiscontinuityListener\n============================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/media/MediaPlayer.OnMediaTimeDiscontinuityListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nMediaPlayer.OnMediaTimeDiscontinuityListener\n`\n\n\n`\n\n\n`\n\n|------------------------------------------------------------|\n| android.media.MediaPlayer.OnMediaTimeDiscontinuityListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface definition of a callback to be invoked when discontinuity in the normal progression\nof the media time is detected.\nThe \"normal progression\" of media time is defined as the expected increase of the playback\nposition when playing media, relative to the playback speed (for instance every second, media\ntime increases by two seconds when playing at 2x). \n\nDiscontinuities are encountered in the following cases:\n\n- when the player is starved for data and cannot play anymore\n- when the player encounters a playback error\n- when the a seek operation starts, and when it's completed\n- when the playback speed changes\n- when the playback state changes\n- when the player is reset\n\nSee the [MediaPlayer.setOnMediaTimeDiscontinuityListener(OnMediaTimeDiscontinuityListener, Handler)](/reference/android/media/MediaPlayer#setOnMediaTimeDiscontinuityListener(android.media.MediaPlayer.OnMediaTimeDiscontinuityListener,%20android.os.Handler)) method to set a listener for these events.\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onMediaTimeDiscontinuity](/reference/android/media/MediaPlayer.OnMediaTimeDiscontinuityListener#onMediaTimeDiscontinuity(android.media.MediaPlayer,%20android.media.MediaTimestamp))`(`[MediaPlayer](/reference/android/media/MediaPlayer)` mp, `[MediaTimestamp](/reference/android/media/MediaTimestamp)` mts) ` Called to indicate a time discontinuity has occured. |\n\nPublic methods\n--------------\n\n### onMediaTimeDiscontinuity\n\nAdded in [API level 28](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onMediaTimeDiscontinuity (MediaPlayer mp, \n MediaTimestamp mts)\n```\n\nCalled to indicate a time discontinuity has occured.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `mp` | `MediaPlayer`: the MediaPlayer for which the discontinuity has occured. This value cannot be `null`. \u003cbr /\u003e |\n| `mts` | `MediaTimestamp`: the timestamp that correlates media time, system time and clock rate, or [MediaTimestamp.TIMESTAMP_UNKNOWN](/reference/android/media/MediaTimestamp#TIMESTAMP_UNKNOWN) in an error case. This value cannot be `null`. \u003cbr /\u003e |"]]