public final class FakeTimeline extends Timeline
Timeline which can be setup to return custom FakeTimeline.TimelineWindowDefinitions.| Modifier and Type | Class | Description |
|---|---|---|
static class |
FakeTimeline.TimelineWindowDefinition |
Definition used to define a
FakeTimeline. |
Timeline.Period, Timeline.Window| Modifier and Type | Field | Description |
|---|---|---|
static MediaItem |
FAKE_MEDIA_ITEM |
The fake media item used by the fake timeline.
|
| Constructor | Description |
|---|---|
FakeTimeline() |
Create a fake timeline with one seekable, non-dynamic window with one period and a duration of
FakeTimeline.TimelineWindowDefinition.DEFAULT_WINDOW_DURATION_US. |
FakeTimeline(int windowCount,
Object... manifests) |
Creates a fake timeline with the given number of seekable, non-dynamic windows with one period
with a duration of
FakeTimeline.TimelineWindowDefinition.DEFAULT_WINDOW_DURATION_US each. |
FakeTimeline(FakeTimeline.TimelineWindowDefinition... windowDefinitions) |
Creates a fake timeline with the given window definitions.
|
FakeTimeline(Object[] manifests,
FakeTimeline.TimelineWindowDefinition... windowDefinitions) |
Creates a fake timeline with the given window definitions.
|
| Modifier and Type | Method | Description |
|---|---|---|
static AdPlaybackState |
createAdPlaybackState(int adsPerAdGroup,
long... adGroupTimesUs) |
Returns an ad playback state with the specified number of ads in each of the specified ad
groups, each ten seconds long.
|
int |
getIndexOfPeriod(Object uid) |
Returns the index of the period identified by its unique
Timeline.Period.uid, or C.INDEX_UNSET if the period is not in the timeline. |
Timeline.Period |
getPeriod(int periodIndex,
Timeline.Period period,
boolean setIds) |
Populates a
Timeline.Period with data for the period at the specified index. |
int |
getPeriodCount() |
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(int windowIndex,
Timeline.Window window,
long defaultPositionProjectionUs) |
Populates a
Timeline.Window with data for the window at the specified index. |
int |
getWindowCount() |
Returns the number of windows in the timeline.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitequals, getFirstWindowIndex, getLastWindowIndex, getNextPeriodIndex, getNextWindowIndex, getPeriod, getPeriodByUid, getPeriodPosition, getPeriodPosition, getPreviousWindowIndex, getWindow, getWindow, hashCode, isEmpty, isLastPeriodpublic static final MediaItem FAKE_MEDIA_ITEM
public FakeTimeline()
FakeTimeline.TimelineWindowDefinition.DEFAULT_WINDOW_DURATION_US.public FakeTimeline(int windowCount,
Object... manifests)
FakeTimeline.TimelineWindowDefinition.DEFAULT_WINDOW_DURATION_US each.windowCount - The number of windows.manifests - The manifests of the windows.public FakeTimeline(FakeTimeline.TimelineWindowDefinition... windowDefinitions)
windowDefinitions - A list of FakeTimeline.TimelineWindowDefinitions.public FakeTimeline(Object[] manifests, FakeTimeline.TimelineWindowDefinition... windowDefinitions)
windowDefinitions - A list of FakeTimeline.TimelineWindowDefinitions.public static AdPlaybackState createAdPlaybackState(int adsPerAdGroup, long... adGroupTimesUs)
adsPerAdGroup - The number of ads per ad group.adGroupTimesUs - The times of ad groups, in microseconds.public int getWindowCount()
TimelinegetWindowCount in class Timelinepublic Timeline.Window getWindow(int windowIndex, Timeline.Window window, long defaultPositionProjectionUs)
TimelineTimeline.Window with data for the window at the specified index.getWindow in class TimelinewindowIndex - The index of the window.window - The Timeline.Window to populate. Must not be null.defaultPositionProjectionUs - A duration into the future that the populated window's
default start position should be projected.Timeline.Window, for convenience.public int getPeriodCount()
TimelinegetPeriodCount in class Timelinepublic Timeline.Period getPeriod(int periodIndex, Timeline.Period period, boolean setIds)
TimelineTimeline.Period with data for the period at the specified index.getPeriod in class TimelineperiodIndex - The index of the period.period - The Timeline.Period to populate. Must not be null.setIds - Whether Timeline.Period.id and Timeline.Period.uid should be populated. If false,
the fields will be set to null. The caller should pass false for efficiency reasons unless
the fields are required.Timeline.Period, for convenience.public int getIndexOfPeriod(Object uid)
TimelineTimeline.Period.uid, or C.INDEX_UNSET if the period is not in the timeline.getIndexOfPeriod in class Timelineuid - A unique identifier for a period.C.INDEX_UNSET if the period was not found.public Object getUidOfPeriod(int periodIndex)
TimelinegetUidOfPeriod in class TimelineperiodIndex - The index of the period.