docs/doc/reference/com/google/android/exoplayer2/Timeline.Window.html
Package com.google.android.exoplayer2
All Implemented Interfaces:BundleableEnclosing class:Timeline
public static final classTimeline.Windowextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[Bundleable](Bundleable.html "interface in com.google.android.exoplayer2")
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.
-
Bundleable.Creator<T extends Bundleable>
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static Bundleable.Creator<Timeline.Window> | CREATOR |
Object that can restore Timeline.Period from a Bundle.
|
| long | defaultPositionUs |
The default position relative to the start of the window at which to begin playback, in microseconds.
|
| long | durationUs |
The duration of this window in microseconds, or C.TIME_UNSET if unknown.
|
| long | elapsedRealtimeEpochOffsetMs |
The offset between SystemClock.elapsedRealtime() and the time since the Unix epoch according to the clock of the media origin server, or C.TIME_UNSET if unknown or not applicable.
|
| int | firstPeriodIndex |
The index of the first period that belongs to this window.
|
| boolean | isDynamic |
Whether this window may change when the timeline is updated.
|
| boolean | isLive |
Deprecated.
Use isLive() instead.
|
| boolean | isPlaceholder |
Whether this window contains placeholder information because the real information has yet to be loaded.
|
| boolean | isSeekable |
Whether it's possible to seek within this window.
|
| int | lastPeriodIndex |
The index of the last period that belongs to this window.
|
| MediaItem.LiveConfiguration | liveConfiguration |
The MediaItem.LiveConfiguration that is used or null if isLive() returns false.
|
| Object | manifest |
The manifest of the window.
|
| MediaItem | mediaItem |
The MediaItem associated to the window.
|
| long | positionInFirstPeriodUs |
The position of the start of this window relative to the start of the first period belonging to it, in microseconds.
|
| long | presentationStartTimeMs |
The start time of the presentation to which this window belongs in milliseconds since the Unix epoch, or C.TIME_UNSET if unknown or not applicable.
|
| static Object | SINGLE_WINDOW_UID |
A uid for a window that must be used for single-window Timelines.
|
| Object | tag |
Deprecated.
Use mediaItem instead.
|
| Object | uid |
A unique identifier for the window.
|
| long | windowStartTimeMs |
The window's start time in milliseconds since the Unix epoch, or C.TIME_UNSET if unknown or not applicable.
|
Constructors | Constructor | Description |
| --- | --- |
| Window() |
Creates window.
|
All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| boolean | equals(Object obj) | |
| long | getCurrentUnixTimeMs() |
Returns the current time in milliseconds since the Unix epoch.
|
| long | getDefaultPositionMs() |
Returns the default position relative to the start of the window at which to begin playback, in milliseconds.
|
| long | getDefaultPositionUs() |
Returns the default position relative to the start of the window at which to begin playback, in microseconds.
|
| long | getDurationMs() |
Returns the duration of the window in milliseconds, or C.TIME_UNSET if unknown.
|
| long | getDurationUs() |
Returns the duration of this window in microseconds, or C.TIME_UNSET if unknown.
|
| long | getPositionInFirstPeriodMs() |
Returns the position of the start of this window relative to the start of the first period belonging to it, in milliseconds.
|
| long | getPositionInFirstPeriodUs() |
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 | set(Object uid, MediaItem mediaItem, Object manifest, long presentationStartTimeMs, long windowStartTimeMs, long elapsedRealtimeEpochOffsetMs, boolean isSeekable, boolean isDynamic, MediaItem.LiveConfiguration liveConfiguration, long defaultPositionUs, long durationUs, int firstPeriodIndex, int lastPeriodIndex, long positionInFirstPeriodUs) |
Sets the data held by this window.
|
| Bundle | toBundle() |
Returns a Bundle representing the information stored in this object.
|
-
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
public static final[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")SINGLE_WINDOW_UID
A uid for a window that must be used for single-window Timelines.
-
public[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")uid
A unique identifier for the window. Single-window Timelines must use SINGLE_WINDOW_UID.
-
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")@Nullable
public[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")tag
Deprecated.
Use mediaItem instead.
-
public[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")mediaItem
The MediaItem associated to the window. Not necessarily unique.
-
@Nullable
public[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")manifest
The manifest of the window. May be null.
-
public long presentationStartTimeMs
The start time of the presentation to which this window belongs in milliseconds since the Unix epoch, or C.TIME_UNSET if unknown or not applicable. For informational purposes only.
-
public long windowStartTimeMs
The window's start time in milliseconds since the Unix epoch, or C.TIME_UNSET if unknown or not applicable.
-
public long elapsedRealtimeEpochOffsetMs
The offset between SystemClock.elapsedRealtime() and the time since the Unix epoch according to the clock of the media origin server, or C.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.
-
public boolean isSeekable
Whether it's possible to seek within this window.
-
public boolean isDynamic
Whether this window may change when the timeline is updated.
-
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public boolean isLive
Deprecated.
Use isLive() instead.
-
@Nullable
public[MediaItem.LiveConfiguration](MediaItem.LiveConfiguration.html "class in com.google.android.exoplayer2")liveConfiguration
The MediaItem.LiveConfiguration that is used or null if isLive() returns false.
-
public boolean isPlaceholder
Whether this window contains placeholder information because the real information has yet to be loaded.
-
public long defaultPositionUs
The default position relative to the start of the window at which to begin playback, in microseconds. May be C.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.
-
public long durationUs
The duration of this window in microseconds, or C.TIME_UNSET if unknown.
-
public int firstPeriodIndex
The index of the first period that belongs to this window.
-
public int lastPeriodIndex
The index of the last period that belongs to this window.
-
public long positionInFirstPeriodUs
The position of the start of this window relative to the start of the first period belonging to it, in microseconds.
-
public static final[Bundleable.Creator](Bundleable.Creator.html "interface in com.google.android.exoplayer2")<[Timeline.Window](Timeline.Window.html "class in com.google.android.exoplayer2")> CREATOR
Object that can restore Timeline.Period from a Bundle.
The uid of a restored instance will be a fake Object and the manifest of the instance will be null.
-
public Window()
Creates window.
-
@CanIgnoreReturnValue
public[Timeline.Window](Timeline.Window.html "class in com.google.android.exoplayer2")set([Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")uid,
@Nullable[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")mediaItem,
@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")manifest,
long presentationStartTimeMs,
long windowStartTimeMs,
long elapsedRealtimeEpochOffsetMs,
boolean isSeekable,
boolean isDynamic,
@Nullable[MediaItem.LiveConfiguration](MediaItem.LiveConfiguration.html "class in com.google.android.exoplayer2")liveConfiguration,
long defaultPositionUs,
long durationUs,
int firstPeriodIndex,
int lastPeriodIndex,
long positionInFirstPeriodUs)
Sets the data held by this window.
-
public long getDefaultPositionMs()
Returns the default position relative to the start of the window at which to begin playback, in milliseconds. May be C.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.
-
public long getDefaultPositionUs()
Returns the default position relative to the start of the window at which to begin playback, in microseconds. May be C.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.
-
public long getDurationMs()
Returns the duration of the window in milliseconds, or C.TIME_UNSET if unknown.
-
public long getDurationUs()
Returns the duration of this window in microseconds, or C.TIME_UNSET if unknown.
-
public long getPositionInFirstPeriodMs()
Returns the position of the start of this window relative to the start of the first period belonging to it, in milliseconds.
-
public long getPositionInFirstPeriodUs()
Returns the position of the start of this window relative to the start of the first period belonging to it, in microseconds.
-
public long getCurrentUnixTimeMs()
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.
-
public boolean isLive()
Returns whether this is a live stream.
-
public boolean equals(@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")obj)
Overrides:equals in class Object
-
public int hashCode()
Overrides:hashCode in class Object
-
public[Bundle](https://developer.android.com/reference/android/os/Bundle.html "class or interface in android.os")toBundle()
Returns a Bundle 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.
Specified by:toBundle in interface Bundleable