Stay organized with collections
Save and categorize content based on your preferences.
SeekMap
class SeekMap
Maps seek positions to SeekPoints
in the stream.
A SeekPoint
is a position in the stream from which a player may successfully start playing media samples.
Summary
Constants
UNKNOWN_DURATION
static val UNKNOWN_DURATION: Int
Returned by getDurationMicros()
when the duration is unknown.
Value: -2147483648
Public methods
getDurationMicros
fun getDurationMicros(): Long
Returns the duration of the stream in microseconds or UNKNOWN_DURATION
if the duration is unknown.
getSeekPoints
fun getSeekPoints(timeMicros: Long): Pair<MediaParser.SeekPoint!, MediaParser.SeekPoint!>
Obtains SeekPoints
for the specified seek time in microseconds.
getSeekPoints(timeMicros).first
contains the latest seek point for samples with timestamp equal to or smaller than timeMicros
.
getSeekPoints(timeMicros).second
contains the earliest seek point for samples with timestamp equal to or greater than timeMicros
. If a seek point exists for timeMicros
, the returned pair will contain the same SeekPoint
twice.
Parameters |
timeMicros |
Long: A seek time in microseconds. |
isSeekable
fun isSeekable(): Boolean
Returns whether seeking is supported.
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,["# MediaParser.SeekMap\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nSeekMap\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/media/MediaParser.SeekMap \"View this page in Java\") \n\n```\nclass SeekMap\n```\n\n|---|----------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.media.MediaParser.SeekMap](#) |\n\nMaps seek positions to [SeekPoints](/reference/kotlin/android/media/MediaParser.SeekPoint) in the stream.\n\nA [SeekPoint](/reference/kotlin/android/media/MediaParser.SeekPoint) is a position in the stream from which a player may successfully start playing media samples.\n\nSummary\n-------\n\n| Constants ||\n|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [UNKNOWN_DURATION](#UNKNOWN_DURATION:kotlin.Int) Returned by [getDurationMicros()](#getDurationMicros()) when the duration is unknown. |\n\n| Public methods ||\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | [getDurationMicros](#getDurationMicros())`()` Returns the duration of the stream in microseconds or [UNKNOWN_DURATION](#UNKNOWN_DURATION:kotlin.Int) if the duration is unknown. |\n| [Pair](../util/Pair.html#)\\\u003c[MediaParser.SeekPoint](/reference/kotlin/android/media/MediaParser.SeekPoint)!, [MediaParser.SeekPoint](/reference/kotlin/android/media/MediaParser.SeekPoint)!\\\u003e | [getSeekPoints](#getSeekPoints(kotlin.Long))`(`timeMicros:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Obtains [SeekPoints](/reference/kotlin/android/media/MediaParser.SeekPoint) for the specified seek time in microseconds. |\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isSeekable](#isSeekable())`()` Returns whether seeking is supported. |\n\nConstants\n---------\n\n### UNKNOWN_DURATION\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val UNKNOWN_DURATION: Int\n```\n\nReturned by [getDurationMicros()](#getDurationMicros()) when the duration is unknown. \n\n Value: -2147483648\n\nPublic methods\n--------------\n\n### getDurationMicros\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getDurationMicros(): Long\n```\n\nReturns the duration of the stream in microseconds or [UNKNOWN_DURATION](#UNKNOWN_DURATION:kotlin.Int) if the duration is unknown. \n\n### getSeekPoints\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getSeekPoints(timeMicros: Long): Pair\u003cMediaParser.SeekPoint!, MediaParser.SeekPoint!\u003e\n```\n\nObtains [SeekPoints](/reference/kotlin/android/media/MediaParser.SeekPoint) for the specified seek time in microseconds.\n\n`getSeekPoints(timeMicros).first` contains the latest seek point for samples with timestamp equal to or smaller than `timeMicros`.\n\n`getSeekPoints(timeMicros).second` contains the earliest seek point for samples with timestamp equal to or greater than `timeMicros`. If a seek point exists for `timeMicros`, the returned pair will contain the same [SeekPoint](/reference/kotlin/android/media/MediaParser.SeekPoint) twice.\n\n| Parameters ||\n|--------------|------------------------------------------------------------------------------------------------------------|\n| `timeMicros` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): A seek time in microseconds. |\n\n| Return ||\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|\n| [Pair](../util/Pair.html#)\u003c[MediaParser.SeekPoint](/reference/kotlin/android/media/MediaParser.SeekPoint)!,` `[MediaParser.SeekPoint](/reference/kotlin/android/media/MediaParser.SeekPoint)!\u003e | The corresponding [SeekPoints](/reference/kotlin/android/media/MediaParser.SeekPoint). This value cannot be `null`. |\n\n### isSeekable\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun isSeekable(): Boolean\n```\n\nReturns whether seeking is supported."]]