AbstractConcatenatedTimeline
@UnstableApi
public abstract class AbstractConcatenatedTimeline extends Timeline
| java.lang.Object | ||
| ↳ | androidx.media3.common.Timeline | |
| ↳ | androidx.media3.exoplayer.AbstractConcatenatedTimeline |
Abstract base class for the concatenation of one or more Timelines.
Summary
Public constructors |
|---|
AbstractConcatenatedTimeline(Sets up a concatenated timeline with a shuffle order of child timelines. |
Public methods |
|
|---|---|
static Object |
getChildPeriodUidFromConcatenatedUid(Object concatenatedUid)Returns UID of the period in the child timeline from a concatenated period UID. |
static Object |
getChildTimelineUidFromConcatenatedUid(Object concatenatedUid)Returns UID of child timeline from a concatenated period UID. |
static Object |
getConcatenatedUid(Returns a concatenated UID for a period or window in a child timeline. |
int |
getFirstWindowIndex(boolean shuffleModeEnabled)Returns the index of the first window in the playback order depending on whether shuffling is enabled. |
final int |
getIndexOfPeriod(Object uid)Returns the index of the period identified by its unique |
int |
getLastWindowIndex(boolean shuffleModeEnabled)Returns the index of the last window in the playback order depending on whether shuffling is enabled. |
int |
getNextWindowIndex(Returns the index of the window after the window at index |
final Timeline.Period |
getPeriod(int periodIndex, Timeline.Period period, boolean setIds)Populates a |
final Timeline.Period |
getPeriodByUid(Object periodUid, Timeline.Period period)Populates a |
int |
getPreviousWindowIndex(Returns the index of the window before the window at index |
final Object |
getUidOfPeriod(int periodIndex)Returns the unique id of the period identified by its index in the timeline. |
final Timeline.Window |
getWindow(Populates a |
Protected methods |
|
|---|---|
abstract int |
getChildIndexByChildUid(Object childUid)Returns the index of the child timeline with the given UID or |
abstract int |
getChildIndexByPeriodIndex(int periodIndex)Returns the index of the child timeline containing the given period index. |
abstract int |
getChildIndexByWindowIndex(int windowIndex)Returns the index of the child timeline containing the given window index. |
abstract Object |
getChildUidByChildIndex(int childIndex)Returns the UID of the child timeline with the given index. |
abstract int |
getFirstPeriodIndexByChildIndex(int childIndex)Returns the first period index belonging to the child timeline with the given index. |
abstract int |
getFirstWindowIndexByChildIndex(int childIndex)Returns the first window index belonging to the child timeline with the given index. |
abstract Timeline |
getTimelineByChildIndex(int childIndex)Returns the child timeline for the child with the given index. |
Inherited methods |
||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
AbstractConcatenatedTimeline
public AbstractConcatenatedTimeline(
boolean isAtomic,
ShuffleOrder shuffleOrder
)
Sets up a concatenated timeline with a shuffle order of child timelines.
| Parameters | |
|---|---|
boolean isAtomic |
Whether the child timelines shall be treated as atomic, i.e., treated as a single item for repeating and shuffling. |
ShuffleOrder shuffleOrder |
A shuffle order of child timelines. The number of child timelines must match the number of elements in the shuffle order. |
Public methods
getChildPeriodUidFromConcatenatedUid
public static Object getChildPeriodUidFromConcatenatedUid(Object concatenatedUid)
Returns UID of the period in the child timeline from a concatenated period UID.
| Parameters | |
|---|---|
Object concatenatedUid |
UID of a period in a concatenated timeline. |
| Returns | |
|---|---|
Object |
UID of the period in the child timeline. |
getChildTimelineUidFromConcatenatedUid
public static Object getChildTimelineUidFromConcatenatedUid(Object concatenatedUid)
Returns UID of child timeline from a concatenated period UID.
| Parameters | |
|---|---|
Object concatenatedUid |
UID of a period in a concatenated timeline. |
| Returns | |
|---|---|
Object |
UID of the child timeline this period belongs to. |
getConcatenatedUid
public static Object getConcatenatedUid(
Object childTimelineUid,
Object childPeriodOrWindowUid
)
Returns a concatenated UID for a period or window in a child timeline.
| Parameters | |
|---|---|
Object childTimelineUid |
UID of the child timeline this period or window belongs to. |
Object childPeriodOrWindowUid |
UID of the period or window in the child timeline. |
| Returns | |
|---|---|
Object |
UID of the period or window in the concatenated timeline. |
getFirstWindowIndex
public int getFirstWindowIndex(boolean shuffleModeEnabled)
Returns the index of the first window in the playback order depending on whether shuffling is enabled.
| Parameters | |
|---|---|
boolean shuffleModeEnabled |
Whether shuffling is enabled. |
| Returns | |
|---|---|
int |
The index of the first window in the playback order, or |
getIndexOfPeriod
public final 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 |
getLastWindowIndex
public int getLastWindowIndex(boolean shuffleModeEnabled)
Returns the index of the last window in the playback order depending on whether shuffling is enabled.
| Parameters | |
|---|---|
boolean shuffleModeEnabled |
Whether shuffling is enabled. |
| Returns | |
|---|---|
int |
The index of the last window in the playback order, or |
getNextWindowIndex
public int getNextWindowIndex(
int windowIndex,
@Player.RepeatMode int repeatMode,
boolean shuffleModeEnabled
)
Returns the index of the window after the window at index windowIndex depending on the repeatMode and whether shuffling is enabled.
| Parameters | |
|---|---|
int windowIndex |
Index of a window in the timeline. |
@Player.RepeatMode int repeatMode |
A repeat mode. |
boolean shuffleModeEnabled |
Whether shuffling is enabled. |
| Returns | |
|---|---|
int |
The index of the next window, or |
getPeriod
public final 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 |
getPeriodByUid
public final Timeline.Period getPeriodByUid(Object periodUid, Timeline.Period period)
Populates a Period with data for the period with the specified unique identifier.
| Parameters | |
|---|---|
Object periodUid |
The unique identifier of the period. |
Timeline.Period period |
The |
| Returns | |
|---|---|
Timeline.Period |
The populated |
getPreviousWindowIndex
public int getPreviousWindowIndex(
int windowIndex,
@Player.RepeatMode int repeatMode,
boolean shuffleModeEnabled
)
Returns the index of the window before the window at index windowIndex depending on the repeatMode and whether shuffling is enabled.
| Parameters | |
|---|---|
int windowIndex |
Index of a window in the timeline. |
@Player.RepeatMode int repeatMode |
A repeat mode. |
boolean shuffleModeEnabled |
Whether shuffling is enabled. |
| Returns | |
|---|---|
int |
The index of the previous window, or |
getUidOfPeriod
public final 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 final 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 |
Protected methods
getChildIndexByChildUid
protected abstract int getChildIndexByChildUid(Object childUid)
Returns the index of the child timeline with the given UID or INDEX_UNSET if not found.
| Parameters | |
|---|---|
Object childUid |
A child UID. |
| Returns | |
|---|---|
int |
Index of child timeline or |
getChildIndexByPeriodIndex
protected abstract int getChildIndexByPeriodIndex(int periodIndex)
Returns the index of the child timeline containing the given period index.
| Parameters | |
|---|---|
int periodIndex |
A valid period index within the bounds of the timeline. |
getChildIndexByWindowIndex
protected abstract int getChildIndexByWindowIndex(int windowIndex)
Returns the index of the child timeline containing the given window index.
| Parameters | |
|---|---|
int windowIndex |
A valid window index within the bounds of the timeline. |
getChildUidByChildIndex
protected abstract Object getChildUidByChildIndex(int childIndex)
Returns the UID of the child timeline with the given index.
| Parameters | |
|---|---|
int childIndex |
A valid child index within the bounds of the timeline. |
getFirstPeriodIndexByChildIndex
protected abstract int getFirstPeriodIndexByChildIndex(int childIndex)
Returns the first period index belonging to the child timeline with the given index.
| Parameters | |
|---|---|
int childIndex |
A valid child index within the bounds of the timeline. |
getFirstWindowIndexByChildIndex
protected abstract int getFirstWindowIndexByChildIndex(int childIndex)
Returns the first window index belonging to the child timeline with the given index.
| Parameters | |
|---|---|
int childIndex |
A valid child index within the bounds of the timeline. |
getTimelineByChildIndex
protected abstract Timeline getTimelineByChildIndex(int childIndex)
Returns the child timeline for the child with the given index.
| Parameters | |
|---|---|
int childIndex |
A valid child index within the bounds of the timeline. |