FakeTimeline
@UnstableApi
class FakeTimeline : Timeline
Fake Timeline which can be setup to return custom TimelineWindowDefinitions.
Summary
Nested types |
|---|
|
Definition used to define a |
|
A builder to build instances of |
Constants |
|
|---|---|
const MediaItem! |
The fake media item used by the fake timeline. |
Public constructors |
|---|
|
Create a fake timeline with one seekable, non-dynamic window with one period and a duration of |
FakeTimeline(Creates a fake timeline with the given window definitions. |
FakeTimeline(Creates a fake timeline with the given window definitions. |
FakeTimeline(windowCount: Int, manifests: Array<Any!>!)Creates a fake timeline with the given number of seekable, non-dynamic windows with one period with a duration of |
FakeTimeline(Creates a fake timeline with the given window definitions and |
Public functions |
|
|---|---|
java-static AdPlaybackState! |
createAdPlaybackState(adsPerAdGroup: Int, adGroupTimesUs: LongArray!)Returns an ad playback state with the specified number of ads in each of the specified ad groups, each ten seconds long. |
java-static FakeTimeline! |
createMultiPeriodAdTimeline(Creates a multi-period timeline with ad and content periods specified by the flags passed as var-arg arguments. |
ImmutableMap<Any!, AdPlaybackState!>! |
getAdPlaybackStates(windowIndex: Int)Returns a map of ad playback states keyed by the period UID. |
Int |
getFirstWindowIndex(shuffleModeEnabled: Boolean)Returns the index of the first window in the playback order depending on whether shuffling is enabled. |
Int |
getIndexOfPeriod(uid: Any!)Returns the index of the period identified by its unique |
Int |
getLastWindowIndex(shuffleModeEnabled: Boolean)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 |
Timeline.Period! |
getPeriod(periodIndex: Int, period: Timeline.Period!, setIds: Boolean)Populates a |
Int |
Returns the number of periods in the timeline. |
Int |
getPreviousWindowIndex(Returns the index of the window before the window at index |
Any! |
getUidOfPeriod(periodIndex: Int)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 functions |
||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Constants
FAKE_MEDIA_ITEM
const val FAKE_MEDIA_ITEM: MediaItem!
The fake media item used by the fake timeline.
Public constructors
FakeTimeline
FakeTimeline()
Create a fake timeline with one seekable, non-dynamic window with one period and a duration of DEFAULT_WINDOW_DURATION_US.
FakeTimeline
FakeTimeline(
windowDefinitions: Array<FakeTimeline.TimelineWindowDefinition!>!
)
Creates a fake timeline with the given window definitions.
| Parameters | |
|---|---|
windowDefinitions: Array<FakeTimeline.TimelineWindowDefinition!>! |
A list of |
FakeTimeline
FakeTimeline(
manifests: Array<Any!>!,
windowDefinitions: Array<FakeTimeline.TimelineWindowDefinition!>!
)
Creates a fake timeline with the given window definitions.
| Parameters | |
|---|---|
manifests: Array<Any!>! |
The manifests of the windows. |
windowDefinitions: Array<FakeTimeline.TimelineWindowDefinition!>! |
A list of |
FakeTimeline
FakeTimeline(windowCount: Int, manifests: Array<Any!>!)
Creates a fake timeline with the given number of seekable, non-dynamic windows with one period with a duration of DEFAULT_WINDOW_DURATION_US each.
FakeTimeline
FakeTimeline(
manifests: Array<Any!>!,
shuffleOrder: ShuffleOrder!,
windowDefinitions: Array<FakeTimeline.TimelineWindowDefinition!>!
)
Creates a fake timeline with the given window definitions and androidx.media3.exoplayer.source.ShuffleOrder.
| Parameters | |
|---|---|
manifests: Array<Any!>! |
The manifests of the windows. |
shuffleOrder: ShuffleOrder! |
A shuffle ordering for the windows. |
windowDefinitions: Array<FakeTimeline.TimelineWindowDefinition!>! |
A list of |
Public functions
createAdPlaybackState
java-static fun createAdPlaybackState(adsPerAdGroup: Int, adGroupTimesUs: LongArray!): AdPlaybackState!
Returns an ad playback state with the specified number of ads in each of the specified ad groups, each ten seconds long.
| Parameters | |
|---|---|
adsPerAdGroup: Int |
The number of ads per ad group. |
adGroupTimesUs: LongArray! |
The times of ad groups, in microseconds. |
| Returns | |
|---|---|
AdPlaybackState! |
The ad playback state. |
createMultiPeriodAdTimeline
java-static fun createMultiPeriodAdTimeline(
windowId: Any!,
numberOfPlayedAds: Int,
isAdPeriodFlags: BooleanArray!
): FakeTimeline!
Creates a multi-period timeline with ad and content periods specified by the flags passed as var-arg arguments.
Period uid end up being a new Pair<>(windowId, periodIndex).
| Parameters | |
|---|---|
windowId: Any! |
The window ID. |
numberOfPlayedAds: Int |
The number of ads that should be marked as played. |
isAdPeriodFlags: BooleanArray! |
A value of true indicates an ad period. A value of false indicated a content period. |
| Returns | |
|---|---|
FakeTimeline! |
A timeline with a single window with as many periods as var-arg arguments. |
getAdPlaybackStates
fun getAdPlaybackStates(windowIndex: Int): ImmutableMap<Any!, AdPlaybackState!>!
Returns a map of ad playback states keyed by the period UID.
| Parameters | |
|---|---|
windowIndex: Int |
The window index of the window to get the map of ad playback states from. |
| Returns | |
|---|---|
ImmutableMap<Any!, AdPlaybackState!>! |
The map of |
getFirstWindowIndex
fun getFirstWindowIndex(shuffleModeEnabled: Boolean): Int
Returns the index of the first window in the playback order depending on whether shuffling is enabled.
| Parameters | |
|---|---|
shuffleModeEnabled: Boolean |
Whether shuffling is enabled. |
| Returns | |
|---|---|
Int |
The index of the first window in the playback order, or |
getIndexOfPeriod
fun getIndexOfPeriod(uid: Any!): Int
Returns the index of the period identified by its unique uid, or INDEX_UNSET if the period is not in the timeline.
| Parameters | |
|---|---|
uid: Any! |
A unique identifier for a period. |
| Returns | |
|---|---|
Int |
The index of the period, or |
getLastWindowIndex
fun getLastWindowIndex(shuffleModeEnabled: Boolean): Int
Returns the index of the last window in the playback order depending on whether shuffling is enabled.
| Parameters | |
|---|---|
shuffleModeEnabled: Boolean |
Whether shuffling is enabled. |
| Returns | |
|---|---|
Int |
The index of the last window in the playback order, or |
getNextWindowIndex
fun getNextWindowIndex(
windowIndex: Int,
@Player.RepeatMode repeatMode: Int,
shuffleModeEnabled: Boolean
): Int
Returns the index of the window after the window at index windowIndex depending on the repeatMode and whether shuffling is enabled.
| Parameters | |
|---|---|
windowIndex: Int |
Index of a window in the timeline. |
@Player.RepeatMode repeatMode: Int |
A repeat mode. |
shuffleModeEnabled: Boolean |
Whether shuffling is enabled. |
| Returns | |
|---|---|
Int |
The index of the next window, or |
getPeriod
fun getPeriod(periodIndex: Int, period: Timeline.Period!, setIds: Boolean): Timeline.Period!
Populates a Period with data for the period at the specified index.
| Parameters | |
|---|---|
periodIndex: Int |
The index of the period. |
period: Timeline.Period! |
The |
setIds: Boolean |
Whether |
| Returns | |
|---|---|
Timeline.Period! |
The populated |
getPreviousWindowIndex
fun getPreviousWindowIndex(
windowIndex: Int,
@Player.RepeatMode repeatMode: Int,
shuffleModeEnabled: Boolean
): Int
Returns the index of the window before the window at index windowIndex depending on the repeatMode and whether shuffling is enabled.
| Parameters | |
|---|---|
windowIndex: Int |
Index of a window in the timeline. |
@Player.RepeatMode repeatMode: Int |
A repeat mode. |
shuffleModeEnabled: Boolean |
Whether shuffling is enabled. |
| Returns | |
|---|---|
Int |
The index of the previous window, or |
getUidOfPeriod
fun getUidOfPeriod(periodIndex: Int): Any!
Returns the unique id of the period identified by its index in the timeline.
| Parameters | |
|---|---|
periodIndex: Int |
The index of the period. |
| Returns | |
|---|---|
Any! |
The unique id of the period. |
getWindow
fun getWindow(
windowIndex: Int,
window: Timeline.Window!,
defaultPositionProjectionUs: Long
): Timeline.Window!
Populates a Window with data for the window at the specified index.
| Parameters | |
|---|---|
windowIndex: Int |
The index of the window. |
window: Timeline.Window! |
The |
defaultPositionProjectionUs: Long |
A duration into the future that the populated window's default start position should be projected. |
| Returns | |
|---|---|
Timeline.Window! |
The populated |