Timeline.Window
class Timeline.Window
Holds information about a window in a Timeline. A window usually corresponds to one playlist item and defines a region of media currently available for playback along with additional information such as whether seeking is supported within the window. The figure below shows some of the information defined by a window, as well as how this information relates to corresponding Periods in the timeline.
Summary
Public constructors |
|---|
Window()Creates window. |
Public functions |
|
|---|---|
Boolean |
|
java-static Timeline.Window! |
@UnstableApiRestores a |
Long |
Returns the current time in milliseconds since the Unix epoch. |
Long |
Returns the default position relative to the start of the window at which to begin playback, in milliseconds. |
Long |
Returns the default position relative to the start of the window at which to begin playback, in microseconds. |
Long |
Returns the duration of the window in milliseconds, or |
Long |
Returns the duration of this window in microseconds, or |
Long |
Returns the position of the start of this window relative to the start of the first period belonging to it, in milliseconds. |
Long |
Returns the position of the start of this window relative to the start of the first period belonging to it, in microseconds. |
Int |
hashCode() |
Boolean |
isLive()Returns whether this is a live stream. |
Timeline.Window! |
@CanIgnoreReturnValueSets the data held by this window. |
Bundle! |
Returns a |
Public properties |
|
|---|---|
Long |
The default position relative to the start of the window at which to begin playback, in microseconds. |
Long |
The duration of this window in microseconds, or |
Long |
The offset between |
Int |
The index of the first period that belongs to this window. |
Boolean |
Whether this window may change when the timeline is updated. |
Boolean |
Whether this window contains placeholder information because the real information has yet to be loaded. |
Boolean |
Whether it's possible to seek within this window. |
Int |
The index of the last period that belongs to this window. |
MediaItem.LiveConfiguration? |
The |
Any? |
The manifest of the window. |
MediaItem! |
The |
Long |
The position of the start of this window relative to the start of the first period belonging to it, in microseconds. |
Long |
The start time of the presentation to which this window belongs in milliseconds since the Unix epoch, or |
Any? |
This property is deprecated. |
Any! |
A unique identifier for the window. |
Long |
The window's start time in milliseconds since the Unix epoch, or |
Constants
SINGLE_WINDOW_UID
const val SINGLE_WINDOW_UID: Any!
A uid for a window that must be used for single-window Timelines.
Public constructors
Public functions
fromBundle
@UnstableApi
java-static fun fromBundle(bundle: Bundle!): Timeline.Window!
Restores a Window from a Bundle.
getCurrentUnixTimeMs
fun getCurrentUnixTimeMs(): Long
Returns the current time in milliseconds since the Unix epoch.
This method applies known corrections made available by the media such that this time corresponds to the clock of the media origin server.
getDefaultPositionMs
fun getDefaultPositionMs(): Long
Returns the default position relative to the start of the window at which to begin playback, in milliseconds. May be TIME_UNSET if and only if the window was populated with a non-zero default position projection, and if the specified projection cannot be performed whilst remaining within the bounds of the window.
getDefaultPositionUs
fun getDefaultPositionUs(): Long
Returns the default position relative to the start of the window at which to begin playback, in microseconds. May be TIME_UNSET if and only if the window was populated with a non-zero default position projection, and if the specified projection cannot be performed whilst remaining within the bounds of the window.
getDurationMs
fun getDurationMs(): Long
Returns the duration of the window in milliseconds, or TIME_UNSET if unknown.
getDurationUs
fun getDurationUs(): Long
Returns the duration of this window in microseconds, or TIME_UNSET if unknown.
getPositionInFirstPeriodMs
fun getPositionInFirstPeriodMs(): Long
Returns the position of the start of this window relative to the start of the first period belonging to it, in milliseconds.
getPositionInFirstPeriodUs
fun getPositionInFirstPeriodUs(): Long
Returns the position of the start of this window relative to the start of the first period belonging to it, in microseconds.
set
@CanIgnoreReturnValue
@UnstableApi
fun set(
uid: Any!,
mediaItem: MediaItem?,
manifest: Any?,
presentationStartTimeMs: Long,
windowStartTimeMs: Long,
elapsedRealtimeEpochOffsetMs: Long,
isSeekable: Boolean,
isDynamic: Boolean,
liveConfiguration: MediaItem.LiveConfiguration?,
defaultPositionUs: Long,
durationUs: Long,
firstPeriodIndex: Int,
lastPeriodIndex: Int,
positionInFirstPeriodUs: Long
): Timeline.Window!
Sets the data held by this window.
toBundle
@UnstableApi
fun toBundle(): Bundle!
Returns a Bundle representing the information stored in this object.
It omits the uid and manifest fields. The uid of an instance restored by fromBundle will be a fake Object and the manifest of the instance will be null.
Public properties
defaultPositionUs
@UnstableApi
val defaultPositionUs: Long
The default position relative to the start of the window at which to begin playback, in microseconds. May be TIME_UNSET if and only if the window was populated with a non-zero default position projection, and if the specified projection cannot be performed whilst remaining within the bounds of the window.
durationUs
@UnstableApi
val durationUs: Long
The duration of this window in microseconds, or TIME_UNSET if unknown.
elapsedRealtimeEpochOffsetMs
val elapsedRealtimeEpochOffsetMs: Long
The offset between elapsedRealtime and the time since the Unix epoch according to the clock of the media origin server, or TIME_UNSET if unknown or not applicable.
Note that the current Unix time can be retrieved using getCurrentUnixTimeMs and is calculated as SystemClock.elapsedRealtime() + elapsedRealtimeEpochOffsetMs.
firstPeriodIndex
val firstPeriodIndex: Int
The index of the first period that belongs to this window.
isPlaceholder
val isPlaceholder: Boolean
Whether this window contains placeholder information because the real information has yet to be loaded.
liveConfiguration
val liveConfiguration: MediaItem.LiveConfiguration?
The MediaItem.LiveConfiguration that is used or null if isLive returns false.
manifest
val manifest: Any?
The manifest of the window. May be null.
The concrete type depends on the media sources producing the timeline window. Examples provided by Media3 media source modules are
androidx.media3.exoplayer.dash.manifest.DashManifest,
androidx.media3.exoplayer.hls.HlsManifest and
androidx.media3.exoplayer.smoothstreaming.SSManifest.
positionInFirstPeriodUs
@UnstableApi
val positionInFirstPeriodUs: Long
The position of the start of this window relative to the start of the first period belonging to it, in microseconds.
presentationStartTimeMs
val presentationStartTimeMs: Long
The start time of the presentation to which this window belongs in milliseconds since the Unix epoch, or TIME_UNSET if unknown or not applicable. For informational purposes only.
uid
val uid: Any!
A unique identifier for the window. Single-window Timelines must use SINGLE_WINDOW_UID.
windowStartTimeMs
val windowStartTimeMs: Long
The window's start time in milliseconds since the Unix epoch, or TIME_UNSET if unknown or not applicable.