> Documentation index: https://developer.android.com/reference/llms.txt

# AbstractConcatenatedTimeline

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/AbstractConcatenatedTimeline.java+class:androidx.media3.exoplayer.AbstractConcatenatedTimeline)

*** ** * ** ***


```
@UnstableApi
abstract class AbstractConcatenatedTimeline : Timeline
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.media3.common.Timeline](https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline.md.txt) ||
|   | ↳ | [androidx.media3.exoplayer.AbstractConcatenatedTimeline](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/AbstractConcatenatedTimeline.md.txt) |

*** ** * ** ***

Abstract base class for the concatenation of one or more `Timeline`s.

## Summary

| ### Public constructors |
|---|
| `AbstractConcatenatedTimeline( isAtomic: Boolean, shuffleOrder: ShuffleOrder! )` Sets up a concatenated timeline with a shuffle order of child timelines. |

| ### Public functions |
|---|---|
| `java-static Any!` | `getChildPeriodUidFromConcatenatedUid(concatenatedUid: Any!)` Returns UID of the period in the child timeline from a concatenated period UID. |
| `java-static Any!` | `getChildTimelineUidFromConcatenatedUid(concatenatedUid: Any!)` Returns UID of child timeline from a concatenated period UID. |
| `java-static Any!` | `getConcatenatedUid(childTimelineUid: Any!, childPeriodOrWindowUid: Any!)` Returns a concatenated UID for a period or window in a child timeline. |
| `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 `uid`, or `INDEX_UNSET` if the period is not in the timeline. |
| `Int` | `getLastWindowIndex(shuffleModeEnabled: Boolean)` Returns the index of the last window in the playback order depending on whether shuffling is enabled. |
| `Int` | `getNextWindowIndex( windowIndex: Int, @Player.RepeatMode repeatMode: Int, shuffleModeEnabled: Boolean )` Returns the index of the window after the window at index `windowIndex` depending on the `repeatMode` and whether shuffling is enabled. |
| `Timeline.Period!` | `getPeriod(periodIndex: Int, period: Timeline.Period!, setIds: Boolean)` Populates a `Period` with data for the period at the specified index. |
| `Timeline.Period!` | `getPeriodByUid(periodUid: Any!, period: Timeline.Period!)` Populates a `Period` with data for the period with the specified unique identifier. |
| `Int` | `getPreviousWindowIndex( windowIndex: Int, @Player.RepeatMode repeatMode: Int, shuffleModeEnabled: Boolean )` Returns the index of the window before the window at index `windowIndex` depending on the `repeatMode` and whether shuffling is enabled. |
| `Any!` | `getUidOfPeriod(periodIndex: Int)` Returns the unique id of the period identified by its index in the timeline. |
| `Timeline.Window!` | `getWindow( windowIndex: Int, window: Timeline.Window!, defaultPositionProjectionUs: Long )` Populates a `Window` with data for the window at the specified index. |

| ### Protected functions |
|---|---|
| `abstract Int` | `getChildIndexByChildUid(childUid: Any!)` Returns the index of the child timeline with the given UID or `INDEX_UNSET` if not found. |
| `abstract Int` | `getChildIndexByPeriodIndex(periodIndex: Int)` Returns the index of the child timeline containing the given period index. |
| `abstract Int` | `getChildIndexByWindowIndex(windowIndex: Int)` Returns the index of the child timeline containing the given window index. |
| `abstract Any!` | `getChildUidByChildIndex(childIndex: Int)` Returns the UID of the child timeline with the given index. |
| `abstract Int` | `getFirstPeriodIndexByChildIndex(childIndex: Int)` Returns the first period index belonging to the child timeline with the given index. |
| `abstract Int` | `getFirstWindowIndexByChildIndex(childIndex: Int)` Returns the first window index belonging to the child timeline with the given index. |
| `abstract Timeline!` | `getTimelineByChildIndex(childIndex: Int)` Returns the child timeline for the child with the given index. |

### Inherited Constants

From [androidx.media3.common.Timeline](https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline.md.txt) `const Timeline!` `EMPTY`

An empty timeline.

### Inherited functions

From [androidx.media3.common.Timeline](https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline.md.txt) `Timeline!` `@UnstableApi
copyWithSingleWindow(windowIndex: Int)`

Returns a copy of this timeline containing just the single specified `Window`.
`Boolean` `equals(obj: Any?)` `java-static Timeline!` `@UnstableApi
[fromBundle](https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline.md.txt#fromBundle(android.os.Bundle))(bundle: Bundle!)`

**This function is deprecated.**

Use `fromBundle` instead.

<br />

`java-static Timeline!` `@UnstableApi
fromBundle(bundle: Bundle!, interfaceVersion: Int)`

Restores a `Timeline` from a `Bundle`.
`Int` `getNextPeriodIndex(
periodIndex: Int,
period: Timeline.Period!,
window: Timeline.Window!,
@Player.RepeatMode repeatMode: Int,
shuffleModeEnabled: Boolean
)`

Returns the index of the period after the period at index `periodIndex` depending on the `repeatMode` and whether shuffling is enabled.
`Timeline.Period!` `getPeriod(periodIndex: Int, period: Timeline.Period!)`

Populates a `Period` with data for the period at the specified index.
`abstract Int` `getPeriodCount()`

Returns the number of periods in the timeline.
`Pair<Any!, Long!>!` `@UnstableApi
@InlineMe(replacement = "this.getPeriodPositionUs(window, period, windowIndex, windowPositionUs)")
[getPeriodPosition](https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline.md.txt#getPeriodPosition(androidx.media3.common.Timeline.Window,androidx.media3.common.Timeline.Period,int,long))(
window: Timeline.Window!,
period: Timeline.Period!,
windowIndex: Int,
windowPositionUs: Long
)`

**This function is deprecated.**

Use `getPeriodPositionUs` instead.

<br />

`Pair<Any!, Long!>!` `getPeriodPositionUs(
window: Timeline.Window!,
period: Timeline.Period!,
windowIndex: Int,
windowPositionUs: Long
)`

Calls `getPeriodPositionUs` with a zero default position projection.
`Pair<Any!, Long!>?` `getPeriodPositionUs(
window: Timeline.Window!,
period: Timeline.Period!,
windowIndex: Int,
windowPositionUs: Long,
defaultPositionProjectionUs: Long
)`

Converts `(windowIndex, windowPositionUs)` to the corresponding `(periodUid,
periodPositionUs)`.
`Timeline.Window!` `getWindow(windowIndex: Int, window: Timeline.Window!)`

Populates a `Window` with data for the window at the specified index.
`abstract Int` `getWindowCount()`

Returns the number of windows in the timeline.
`Int` `hashCode()` `Boolean` `isEmpty()`

Returns whether the timeline is empty.
`Boolean` `isLastPeriod(
periodIndex: Int,
period: Timeline.Period!,
window: Timeline.Window!,
@Player.RepeatMode repeatMode: Int,
shuffleModeEnabled: Boolean
)`

Returns whether the given period is the last period of the timeline depending on the `
repeatMode` and whether shuffling is enabled.
`Bundle!` `@UnstableApi
[toBundle](https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline.md.txt#toBundle())()`

**This function is deprecated.**

Use `toBundle` instead.

<br />

`Bundle!` `@UnstableApi
toBundle(interfaceVersion: Int)`

Returns a `Bundle` representing the information stored in this object.

## Public constructors

### AbstractConcatenatedTimeline

```
AbstractConcatenatedTimeline(
    isAtomic: Boolean,
    shuffleOrder: ShuffleOrder!
)
```

Sets up a concatenated timeline with a shuffle order of child timelines.

| Parameters |
|---|---|
| `isAtomic: Boolean` | 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 functions

### getChildPeriodUidFromConcatenatedUid

```
java-static fun getChildPeriodUidFromConcatenatedUid(concatenatedUid: Any!): Any!
```

Returns UID of the period in the child timeline from a concatenated period UID.

| Parameters |
|---|---|
| `concatenatedUid: Any!` | UID of a period in a concatenated timeline. |

| Returns |
|---|---|
| `Any!` | UID of the period in the child timeline. |

### getChildTimelineUidFromConcatenatedUid

```
java-static fun getChildTimelineUidFromConcatenatedUid(concatenatedUid: Any!): Any!
```

Returns UID of child timeline from a concatenated period UID.

| Parameters |
|---|---|
| `concatenatedUid: Any!` | UID of a period in a concatenated timeline. |

| Returns |
|---|---|
| `Any!` | UID of the child timeline this period belongs to. |

### getConcatenatedUid

```
java-static fun getConcatenatedUid(childTimelineUid: Any!, childPeriodOrWindowUid: Any!): Any!
```

Returns a concatenated UID for a period or window in a child timeline.

| Parameters |
|---|---|
| `childTimelineUid: Any!` | UID of the child timeline this period or window belongs to. |
| `childPeriodOrWindowUid: Any!` | UID of the period or window in the child timeline. |

| Returns |
|---|---|
| `Any!` | UID of the period or window in the concatenated timeline. |

### 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 `INDEX_UNSET` if the timeline is empty. |

### 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 `INDEX_UNSET` if the period was not found. |

### 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 `INDEX_UNSET` if the timeline is empty. |

### 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 `INDEX_UNSET` if this is the last window. |

### 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 `Period` to populate. Must not be null. |
| `setIds: Boolean` | Whether `id` and `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. |

| Returns |
|---|---|
| `Timeline.Period!` | The populated `Period`, for convenience. |

### getPeriodByUid

```
fun getPeriodByUid(periodUid: Any!, period: Timeline.Period!): Timeline.Period!
```

Populates a `Period` with data for the period with the specified unique identifier.

| Parameters |
|---|---|
| `periodUid: Any!` | The unique identifier of the period. |
| `period: Timeline.Period!` | The `Period` to populate. Must not be null. |

| Returns |
|---|---|
| `Timeline.Period!` | The populated `Period`, for convenience. |

### 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 `INDEX_UNSET` if this is the first window. |

### 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 `Window` to populate. Must not be null. |
| `defaultPositionProjectionUs: Long` | A duration into the future that the populated window's default start position should be projected. |

| Returns |
|---|---|
| `Timeline.Window!` | The populated `Window`, for convenience. |

## Protected functions

### getChildIndexByChildUid

```
protected abstract fun getChildIndexByChildUid(childUid: Any!): Int
```

Returns the index of the child timeline with the given UID or `INDEX_UNSET` if not found.

| Parameters |
|---|---|
| `childUid: Any!` | A child UID. |

| Returns |
|---|---|
| `Int` | Index of child timeline or `INDEX_UNSET` if UID was not found. |

### getChildIndexByPeriodIndex

```
protected abstract fun getChildIndexByPeriodIndex(periodIndex: Int): Int
```

Returns the index of the child timeline containing the given period index.

| Parameters |
|---|---|
| `periodIndex: Int` | A valid period index within the bounds of the timeline. |

### getChildIndexByWindowIndex

```
protected abstract fun getChildIndexByWindowIndex(windowIndex: Int): Int
```

Returns the index of the child timeline containing the given window index.

| Parameters |
|---|---|
| `windowIndex: Int` | A valid window index within the bounds of the timeline. |

### getChildUidByChildIndex

```
protected abstract fun getChildUidByChildIndex(childIndex: Int): Any!
```

Returns the UID of the child timeline with the given index.

| Parameters |
|---|---|
| `childIndex: Int` | A valid child index within the bounds of the timeline. |

### getFirstPeriodIndexByChildIndex

```
protected abstract fun getFirstPeriodIndexByChildIndex(childIndex: Int): Int
```

Returns the first period index belonging to the child timeline with the given index.

| Parameters |
|---|---|
| `childIndex: Int` | A valid child index within the bounds of the timeline. |

### getFirstWindowIndexByChildIndex

```
protected abstract fun getFirstWindowIndexByChildIndex(childIndex: Int): Int
```

Returns the first window index belonging to the child timeline with the given index.

| Parameters |
|---|---|
| `childIndex: Int` | A valid child index within the bounds of the timeline. |

### getTimelineByChildIndex

```
protected abstract fun getTimelineByChildIndex(childIndex: Int): Timeline!
```

Returns the child timeline for the child with the given index.

| Parameters |
|---|---|
| `childIndex: Int` | A valid child index within the bounds of the timeline. |