Class SinglePeriodTimeline
- java.lang.Object
-
- com.google.android.exoplayer2.Timeline
-
- com.google.android.exoplayer2.source.SinglePeriodTimeline
-
- All Implemented Interfaces:
Bundleable
public final class SinglePeriodTimeline extends Timeline
ATimelineconsisting of a single period and static window.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.android.exoplayer2.Timeline
Timeline.Period, Timeline.RemotableTimeline, Timeline.Window
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Bundleable
Bundleable.Creator<T extends Bundleable>
-
-
Constructor Summary
Constructors Constructor Description SinglePeriodTimeline(long durationUs, boolean isSeekable, boolean isDynamic, boolean useLiveConfiguration, Object manifest, MediaItem mediaItem)Creates a timeline containing a single period and a window that spans it.SinglePeriodTimeline(long durationUs, boolean isSeekable, boolean isDynamic, boolean isLive, Object manifest, Object tag)Deprecated.SinglePeriodTimeline(long periodDurationUs, long windowDurationUs, long windowPositionInPeriodUs, long windowDefaultStartPositionUs, boolean isSeekable, boolean isDynamic, boolean useLiveConfiguration, Object manifest, MediaItem mediaItem)Creates a timeline with one period, and a window of known duration starting at a specified position in the period.SinglePeriodTimeline(long periodDurationUs, long windowDurationUs, long windowPositionInPeriodUs, long windowDefaultStartPositionUs, boolean isSeekable, boolean isDynamic, boolean isLive, Object manifest, Object tag)Deprecated.SinglePeriodTimeline(long presentationStartTimeMs, long windowStartTimeMs, long elapsedRealtimeEpochOffsetMs, long periodDurationUs, long windowDurationUs, long windowPositionInPeriodUs, long windowDefaultStartPositionUs, boolean isSeekable, boolean isDynamic, boolean suppressPositionProjection, Object manifest, MediaItem mediaItem, MediaItem.LiveConfiguration liveConfiguration)Creates a timeline with one period, and a window of known duration starting at a specified position in the period.SinglePeriodTimeline(long presentationStartTimeMs, long windowStartTimeMs, long elapsedRealtimeEpochOffsetMs, long periodDurationUs, long windowDurationUs, long windowPositionInPeriodUs, long windowDefaultStartPositionUs, boolean isSeekable, boolean isDynamic, boolean isLive, Object manifest, Object tag)SinglePeriodTimeline(long presentationStartTimeMs, long windowStartTimeMs, long elapsedRealtimeEpochOffsetMs, long periodDurationUs, long windowDurationUs, long windowPositionInPeriodUs, long windowDefaultStartPositionUs, boolean isSeekable, boolean isDynamic, Object manifest, MediaItem mediaItem, MediaItem.LiveConfiguration liveConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetIndexOfPeriod(Object uid)Returns the index of the period identified by its uniqueTimeline.Period.uid, orC.INDEX_UNSETif the period is not in the timeline.Timeline.PeriodgetPeriod(int periodIndex, Timeline.Period period, boolean setIds)Populates aTimeline.Periodwith data for the period at the specified index.intgetPeriodCount()Returns the number of periods in the timeline.ObjectgetUidOfPeriod(int periodIndex)Returns the unique id of the period identified by its index in the timeline.Timeline.WindowgetWindow(int windowIndex, Timeline.Window window, long defaultPositionProjectionUs)Populates aTimeline.Windowwith data for the window at the specified index.intgetWindowCount()Returns the number of windows in the timeline.-
Methods inherited from class com.google.android.exoplayer2.Timeline
equals, getFirstWindowIndex, getLastWindowIndex, getNextPeriodIndex, getNextWindowIndex, getPeriod, getPeriodByUid, getPeriodPosition, getPeriodPosition, getPeriodPositionUs, getPeriodPositionUs, getPreviousWindowIndex, getWindow, hashCode, isEmpty, isLastPeriod, toBundle, toBundle
-
-
-
-
Constructor Detail
-
SinglePeriodTimeline
@Deprecated public SinglePeriodTimeline(long durationUs, boolean isSeekable, boolean isDynamic, boolean isLive, @Nullable Object manifest, @Nullable Object tag)
Deprecated.
-
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:
durationUs- The duration of the period, in microseconds.isSeekable- Whether seeking is supported within the period.isDynamic- Whether the window may change when the timeline is updated.useLiveConfiguration- Whether the window is live andMediaItem.liveConfigurationis used to configure live playback behaviour.manifest- The manifest. May benull.mediaItem- A media item used forTimeline.Window.mediaItem.
-
SinglePeriodTimeline
@Deprecated public SinglePeriodTimeline(long periodDurationUs, long windowDurationUs, long windowPositionInPeriodUs, long windowDefaultStartPositionUs, boolean isSeekable, boolean isDynamic, boolean isLive, @Nullable Object manifest, @Nullable Object tag)
Deprecated.
-
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:
periodDurationUs- The duration of the period in microseconds.windowDurationUs- The duration of the window in microseconds.windowPositionInPeriodUs- The position of the start of the window in the period, in microseconds.windowDefaultStartPositionUs- The default position relative to the start of the window at which to begin playback, in microseconds.isSeekable- Whether seeking is supported within the window.isDynamic- Whether the window may change when the timeline is updated.useLiveConfiguration- Whether the window is live andMediaItem.liveConfigurationis used to configure live playback behaviour.manifest- The manifest. May benull.mediaItem- A media item used forTimeline.Window.mediaItem.
-
SinglePeriodTimeline
@Deprecated public SinglePeriodTimeline(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
@Deprecated public SinglePeriodTimeline(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:
presentationStartTimeMs- The start time of the presentation in milliseconds since the epoch, orC.TIME_UNSETif unknown or not applicable.windowStartTimeMs- The window's start time in milliseconds since the epoch, orC.TIME_UNSETif unknown or not applicable.elapsedRealtimeEpochOffsetMs- The offset betweenSystemClock.elapsedRealtime()and the time since the Unix epoch according to the clock of the media origin server, orC.TIME_UNSETif unknown or not applicable.periodDurationUs- The duration of the period in microseconds.windowDurationUs- The duration of the window in microseconds.windowPositionInPeriodUs- The position of the start of the window in the period, in microseconds.windowDefaultStartPositionUs- The default position relative to the start of the window at which to begin playback, in microseconds.isSeekable- Whether seeking is supported within the window.isDynamic- Whether the window may change when the timeline is updated.suppressPositionProjection- Whetherposition projectionin a playlist should be suppressed. This only applies for dynamic timelines and is ignored otherwise.manifest- The manifest. May benull.mediaItem- A media item used forTimeline.Window.mediaItem.liveConfiguration- The configuration for live playback behaviour, ornullif the window is not live.
-
-
Method Detail
-
getWindowCount
public int getWindowCount()
Description copied from class:TimelineReturns the number of windows in the timeline.- Specified by:
getWindowCountin classTimeline
-
getWindow
public Timeline.Window getWindow(int windowIndex, Timeline.Window window, long defaultPositionProjectionUs)
Description copied from class:TimelinePopulates aTimeline.Windowwith data for the window at the specified index.- Specified by:
getWindowin classTimeline- Parameters:
windowIndex- The index of the window.window- TheTimeline.Windowto populate. Must not be null.defaultPositionProjectionUs- A duration into the future that the populated window's default start position should be projected.- Returns:
- The populated
Timeline.Window, for convenience.
-
getPeriodCount
public int getPeriodCount()
Description copied from class:TimelineReturns the number of periods in the timeline.- Specified by:
getPeriodCountin classTimeline
-
getPeriod
public Timeline.Period getPeriod(int periodIndex, Timeline.Period period, boolean setIds)
Description copied from class:TimelinePopulates aTimeline.Periodwith data for the period at the specified index.- Specified by:
getPeriodin classTimeline- Parameters:
periodIndex- The index of the period.period- TheTimeline.Periodto populate. Must not be null.setIds- WhetherTimeline.Period.idandTimeline.Period.uidshould be populated. If false, the fields will be set to null. The caller should pass false for efficiency reasons unless the fields are required.- Returns:
- The populated
Timeline.Period, for convenience.
-
getIndexOfPeriod
public int getIndexOfPeriod(Object uid)
Description copied from class:TimelineReturns the index of the period identified by its uniqueTimeline.Period.uid, orC.INDEX_UNSETif the period is not in the timeline.- Specified by:
getIndexOfPeriodin classTimeline- Parameters:
uid- A unique identifier for a period.- Returns:
- The index of the period, or
C.INDEX_UNSETif the period was not found.
-
getUidOfPeriod
public Object getUidOfPeriod(int periodIndex)
Description copied from class:TimelineReturns the unique id of the period identified by its index in the timeline.- Specified by:
getUidOfPeriodin classTimeline- Parameters:
periodIndex- The index of the period.- Returns:
- The unique id of the period.
-
-