SinglePeriodTimeline
@UnstableApi
public final class SinglePeriodTimeline extends Timeline
| java.lang.Object | ||
| ↳ | androidx.media3.common.Timeline | |
| ↳ | androidx.media3.exoplayer.source.SinglePeriodTimeline |
A Timeline consisting of a single period and static window.
Summary
Public constructors |
|---|
This method is deprecated. Use |
SinglePeriodTimeline(Creates a timeline containing a single period and a window that spans it. |
This method is deprecated. Use |
SinglePeriodTimeline(Creates a timeline with one period, and a window of known duration starting at a specified position in the period. |
This method is deprecated. Use |
This method is deprecated. Use |
SinglePeriodTimeline(Creates a timeline with one period, and a window of known duration starting at a specified position in the period. |
Public methods |
|
|---|---|
int |
getIndexOfPeriod(Object uid)Returns the index of the period identified by its unique |
Timeline.Period |
getPeriod(int periodIndex, Timeline.Period period, boolean setIds)Populates a |
int |
Returns the number of periods in the timeline. |
Object |
getUidOfPeriod(int periodIndex)Returns the unique id of the period identified by its index in the timeline. |
Timeline.Window |
getWindow(Populates a |
int |
Returns the number of windows in the timeline. |
Inherited methods |
||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
SinglePeriodTimeline
publicSinglePeriodTimeline(
long durationUs,
boolean isSeekable,
boolean isDynamic,
boolean isLive,
@Nullable Object manifest,
@Nullable Object tag
)
SinglePeriodTimeline
public SinglePeriodTimeline(
long durationUs,
boolean isSeekable,
boolean isDynamic,
boolean useLiveConfiguration,
@Nullable Object manifest,
MediaItem mediaItem
)
Creates a timeline containing a single period and a window that spans it.
| Parameters | |
|---|---|
long durationUs |
The duration of the period, in microseconds. |
boolean isSeekable |
Whether seeking is supported within the period. |
boolean isDynamic |
Whether the window may change when the timeline is updated. |
boolean useLiveConfiguration |
Whether the window is live and |
@Nullable Object manifest |
The manifest. May be |
MediaItem mediaItem |
A media item used for |
SinglePeriodTimeline
publicSinglePeriodTimeline(
long periodDurationUs,
long windowDurationUs,
long windowPositionInPeriodUs,
long windowDefaultStartPositionUs,
boolean isSeekable,
boolean isDynamic,
boolean isLive,
@Nullable Object manifest,
@Nullable Object tag
)
SinglePeriodTimeline
public SinglePeriodTimeline(
long periodDurationUs,
long windowDurationUs,
long windowPositionInPeriodUs,
long windowDefaultStartPositionUs,
boolean isSeekable,
boolean isDynamic,
boolean useLiveConfiguration,
@Nullable Object manifest,
MediaItem mediaItem
)
Creates a timeline with one period, and a window of known duration starting at a specified position in the period.
| Parameters | |
|---|---|
long periodDurationUs |
The duration of the period in microseconds. |
long windowDurationUs |
The duration of the window in microseconds. |
long windowPositionInPeriodUs |
The position of the start of the window in the period, in microseconds. |
long windowDefaultStartPositionUs |
The default position relative to the start of the window at which to begin playback, in microseconds. |
boolean isSeekable |
Whether seeking is supported within the window. |
boolean isDynamic |
Whether the window may change when the timeline is updated. |
boolean useLiveConfiguration |
Whether the window is live and |
@Nullable Object manifest |
The manifest. May be |
MediaItem mediaItem |
A media item used for |
SinglePeriodTimeline
publicSinglePeriodTimeline(
long presentationStartTimeMs,
long windowStartTimeMs,
long elapsedRealtimeEpochOffsetMs,
long periodDurationUs,
long windowDurationUs,
long windowPositionInPeriodUs,
long windowDefaultStartPositionUs,
boolean isSeekable,
boolean isDynamic,
boolean isLive,
@Nullable Object manifest,
@Nullable Object tag
)
SinglePeriodTimeline
publicSinglePeriodTimeline(
long presentationStartTimeMs,
long windowStartTimeMs,
long elapsedRealtimeEpochOffsetMs,
long periodDurationUs,
long windowDurationUs,
long windowPositionInPeriodUs,
long windowDefaultStartPositionUs,
boolean isSeekable,
boolean isDynamic,
@Nullable Object manifest,
MediaItem mediaItem,
@Nullable MediaItem.LiveConfiguration liveConfiguration
)
SinglePeriodTimeline
public SinglePeriodTimeline(
long presentationStartTimeMs,
long windowStartTimeMs,
long elapsedRealtimeEpochOffsetMs,
long periodDurationUs,
long windowDurationUs,
long windowPositionInPeriodUs,
long windowDefaultStartPositionUs,
boolean isSeekable,
boolean isDynamic,
boolean suppressPositionProjection,
@Nullable Object manifest,
MediaItem mediaItem,
@Nullable MediaItem.LiveConfiguration liveConfiguration
)
Creates a timeline with one period, and a window of known duration starting at a specified position in the period.
| Parameters | |
|---|---|
long presentationStartTimeMs |
The start time of the presentation in milliseconds since the epoch, or |
long windowStartTimeMs |
The window's start time in milliseconds since the epoch, or |
long elapsedRealtimeEpochOffsetMs |
The offset between |
long periodDurationUs |
The duration of the period in microseconds. |
long windowDurationUs |
The duration of the window in microseconds. |
long windowPositionInPeriodUs |
The position of the start of the window in the period, in microseconds. |
long windowDefaultStartPositionUs |
The default position relative to the start of the window at which to begin playback, in microseconds. |
boolean isSeekable |
Whether seeking is supported within the window. |
boolean isDynamic |
Whether the window may change when the timeline is updated. |
boolean suppressPositionProjection |
Whether |
@Nullable Object manifest |
The manifest. May be |
MediaItem mediaItem |
A media item used for |
@Nullable MediaItem.LiveConfiguration liveConfiguration |
The configuration for live playback behaviour, or |
Public methods
getIndexOfPeriod
public int getIndexOfPeriod(Object uid)
Returns the index of the period identified by its unique uid, or INDEX_UNSET if the period is not in the timeline.
| Parameters | |
|---|---|
Object uid |
A unique identifier for a period. |
| Returns | |
|---|---|
int |
The index of the period, or |
getPeriod
public Timeline.Period getPeriod(int periodIndex, Timeline.Period period, boolean setIds)
Populates a Period with data for the period at the specified index.
| Parameters | |
|---|---|
int periodIndex |
The index of the period. |
Timeline.Period period |
The |
boolean setIds |
Whether |
| Returns | |
|---|---|
Timeline.Period |
The populated |
getUidOfPeriod
public Object getUidOfPeriod(int periodIndex)
Returns the unique id of the period identified by its index in the timeline.
| Parameters | |
|---|---|
int periodIndex |
The index of the period. |
| Returns | |
|---|---|
Object |
The unique id of the period. |
getWindow
public Timeline.Window getWindow(
int windowIndex,
Timeline.Window window,
long defaultPositionProjectionUs
)
Populates a Window with data for the window at the specified index.
| Parameters | |
|---|---|
int windowIndex |
The index of the window. |
Timeline.Window window |
The |
long defaultPositionProjectionUs |
A duration into the future that the populated window's default start position should be projected. |
| Returns | |
|---|---|
Timeline.Window |
The populated |