Timeline.Window


class Timeline.Window : Bundleable


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.

Information defined by a timeline window

Summary

Constants

const Bundleable.Creator<Timeline.Window!>!

This property is deprecated.

Use fromBundle instead.

const Any!

A uid for a window that must be used for single-window Timelines.

Public constructors

Creates window.

Public functions

Boolean
equals(obj: Any?)
java-static Timeline.Window!

Restores a Window from a Bundle.

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 TIME_UNSET if unknown.

Long

Returns the duration of this window in microseconds, or TIME_UNSET if unknown.

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
Boolean

Returns whether this is a live stream.

Timeline.Window!
@CanIgnoreReturnValue
@UnstableApi
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
)

Sets the data held by this window.

Bundle!

Returns a representing the information stored in this object.

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 TIME_UNSET if unknown.

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.

Int

The index of the first period that belongs to this window.

Boolean

Whether this window may change when the timeline is updated.

Boolean

This property is deprecated.

Use isLive instead.

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 MediaItem.LiveConfiguration that is used or null if isLive returns false.

Any?

The manifest of the window.

MediaItem!

The MediaItem associated to the window.

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 TIME_UNSET if unknown or not applicable.

Any?

This property is deprecated.

Use mediaItem instead.

Any!

A unique identifier for the window.

Long

The window's start time in milliseconds since the Unix epoch, or TIME_UNSET if unknown or not applicable.

Constants

CREATOR

@UnstableApi
const val CREATORBundleable.Creator<Timeline.Window!>!

Object that can restore Period from a Bundle.

The uid of a restored instance will be a fake Object and the manifest of the instance will be null.

SINGLE_WINDOW_UID

const val SINGLE_WINDOW_UIDAny!

A uid for a window that must be used for single-window Timelines.

Public constructors

Window

Window()

Creates window.

Public functions

equals

fun equals(obj: Any?): Boolean

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.

hashCode

fun hashCode(): Int

isLive

fun isLive(): Boolean

Returns whether this is a live stream.

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 representing the information stored in this object.

It omits the uid and manifest fields. The uid of an instance restored by CREATOR will be a fake Object and the manifest of the instance will be null.

Public properties

defaultPositionUs

@UnstableApi
val defaultPositionUsLong

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 durationUsLong

The duration of this window in microseconds, or TIME_UNSET if unknown.

elapsedRealtimeEpochOffsetMs

val elapsedRealtimeEpochOffsetMsLong

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 firstPeriodIndexInt

The index of the first period that belongs to this window.

isDynamic

val isDynamicBoolean

Whether this window may change when the timeline is updated.

isLive

@UnstableApi
val isLiveBoolean

isPlaceholder

val isPlaceholderBoolean

Whether this window contains placeholder information because the real information has yet to be loaded.

isSeekable

val isSeekableBoolean

Whether it's possible to seek within this window.

lastPeriodIndex

val lastPeriodIndexInt

The index of the last period that belongs to this window.

liveConfiguration

val liveConfigurationMediaItem.LiveConfiguration?

The MediaItem.LiveConfiguration that is used or null if isLive returns false.

manifest

val manifestAny?

The manifest of the window. May be null.

mediaItem

val mediaItemMediaItem!

The MediaItem associated to the window. Not necessarily unique.

positionInFirstPeriodUs

@UnstableApi
val positionInFirstPeriodUsLong

The position of the start of this window relative to the start of the first period belonging to it, in microseconds.

presentationStartTimeMs

val presentationStartTimeMsLong

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.

tag

@UnstableApi
val tagAny?

uid

val uidAny!

A unique identifier for the window. Single-window Timelines must use SINGLE_WINDOW_UID.

windowStartTimeMs

val windowStartTimeMsLong

The window's start time in milliseconds since the Unix epoch, or TIME_UNSET if unknown or not applicable.