# SinglePeriodTimeline

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

*** ** * ** ***


```
@UnstableApi
public final class SinglePeriodTimeline extends Timeline
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.media3.common.Timeline](https://developer.android.com/reference/androidx/media3/common/Timeline) ||
|   | ↳ | [androidx.media3.exoplayer.source.SinglePeriodTimeline](https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline) |

*** ** * ** ***

A `https://developer.android.com/reference/androidx/media3/common/Timeline` consisting of a single period and static window.

## Summary

| ### Public constructors |
|---|
| `[SinglePeriodTimeline](https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,boolean,boolean,boolean,java.lang.Object,java.lang.Object))( long durationUs, boolean isSeekable, boolean isDynamic, boolean isLive, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html manifest, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html tag )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,boolean,boolean,boolean,java.lang.Object,androidx.media3.common.MediaItem)` instead. <br /> |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,boolean,boolean,boolean,java.lang.Object,androidx.media3.common.MediaItem)( long durationUs, boolean isSeekable, boolean isDynamic, boolean useLiveConfiguration, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html manifest, https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem )` Creates a timeline containing a single period and a window that spans it. |
| `[SinglePeriodTimeline](https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,boolean,boolean,boolean,java.lang.Object,java.lang.Object))( long periodDurationUs, long windowDurationUs, long windowPositionInPeriodUs, long windowDefaultStartPositionUs, boolean isSeekable, boolean isDynamic, boolean isLive, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html manifest, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html tag )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,boolean,boolean,boolean,java.lang.Object,androidx.media3.common.MediaItem)` instead. <br /> |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,boolean,boolean,boolean,java.lang.Object,androidx.media3.common.MediaItem)( long periodDurationUs, long windowDurationUs, long windowPositionInPeriodUs, long windowDefaultStartPositionUs, boolean isSeekable, boolean isDynamic, boolean useLiveConfiguration, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html manifest, https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem )` Creates a timeline with one period, and a window of known duration starting at a specified position in the period. |
| `[SinglePeriodTimeline](https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,long,long,long,boolean,boolean,boolean,java.lang.Object,java.lang.Object))( long presentationStartTimeMs, long windowStartTimeMs, long elapsedRealtimeEpochOffsetMs, long periodDurationUs, long windowDurationUs, long windowPositionInPeriodUs, long windowDefaultStartPositionUs, boolean isSeekable, boolean isDynamic, boolean isLive, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html manifest, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html tag )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,long,long,long,boolean,boolean,boolean,java.lang.Object,androidx.media3.common.MediaItem,androidx.media3.common.MediaItem.LiveConfiguration)` instead. <br /> |
| `[SinglePeriodTimeline](https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,long,long,long,boolean,boolean,java.lang.Object,androidx.media3.common.MediaItem,androidx.media3.common.MediaItem.LiveConfiguration))( long presentationStartTimeMs, long windowStartTimeMs, long elapsedRealtimeEpochOffsetMs, long periodDurationUs, long windowDurationUs, long windowPositionInPeriodUs, long windowDefaultStartPositionUs, boolean isSeekable, boolean isDynamic, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html manifest, https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/MediaItem.LiveConfiguration liveConfiguration )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,long,long,long,boolean,boolean,boolean,java.lang.Object,androidx.media3.common.MediaItem,androidx.media3.common.MediaItem.LiveConfiguration)` instead. <br /> |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,long,long,long,boolean,boolean,boolean,java.lang.Object,androidx.media3.common.MediaItem,androidx.media3.common.MediaItem.LiveConfiguration)( long presentationStartTimeMs, long windowStartTimeMs, long elapsedRealtimeEpochOffsetMs, long periodDurationUs, long windowDurationUs, long windowPositionInPeriodUs, long windowDefaultStartPositionUs, boolean isSeekable, boolean isDynamic, boolean suppressPositionProjection, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html manifest, https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/MediaItem.LiveConfiguration liveConfiguration )` Creates a timeline with one period, and a window of known duration starting at a specified position in the period. |

| ### Public methods |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#getIndexOfPeriod(java.lang.Object)(https://developer.android.com/reference/java/lang/Object.html uid)` Returns the index of the period identified by its unique `https://developer.android.com/reference/androidx/media3/common/Timeline.Period#uid()`, or `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` if the period is not in the timeline. |
| `https://developer.android.com/reference/androidx/media3/common/Timeline.Period` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#getPeriod(int,androidx.media3.common.Timeline.Period,boolean)(int periodIndex, https://developer.android.com/reference/androidx/media3/common/Timeline.Period period, boolean setIds)` Populates a `https://developer.android.com/reference/androidx/media3/common/Timeline.Period` with data for the period at the specified index. |
| `int` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#getPeriodCount()()` Returns the number of periods in the timeline. |
| `https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#getUidOfPeriod(int)(int periodIndex)` Returns the unique id of the period identified by its index in the timeline. |
| `https://developer.android.com/reference/androidx/media3/common/Timeline.Window` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#getWindow(int,androidx.media3.common.Timeline.Window,long)( int windowIndex, https://developer.android.com/reference/androidx/media3/common/Timeline.Window window, long defaultPositionProjectionUs )` Populates a `https://developer.android.com/reference/androidx/media3/common/Timeline.Window` with data for the window at the specified index. |
| `int` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#getWindowCount()()` Returns the number of windows in the timeline. |

### Inherited Constants

From [androidx.media3.common.Timeline](https://developer.android.com/reference/androidx/media3/common/Timeline) `static final https://developer.android.com/reference/androidx/media3/common/Timeline` `https://developer.android.com/reference/androidx/media3/common/Timeline#EMPTY()`

An empty timeline.

### Inherited methods

From [androidx.media3.common.Timeline](https://developer.android.com/reference/androidx/media3/common/Timeline) `final https://developer.android.com/reference/androidx/media3/common/Timeline` `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/androidx/media3/common/Timeline#copyWithSingleWindow(int)(int windowIndex)`

Returns a copy of this timeline containing just the single specified `https://developer.android.com/reference/androidx/media3/common/Timeline.Window`.
`boolean` `https://developer.android.com/reference/androidx/media3/common/Timeline#equals(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html obj)` `static https://developer.android.com/reference/androidx/media3/common/Timeline` `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi
[fromBundle](https://developer.android.com/reference/androidx/media3/common/Timeline#fromBundle(android.os.Bundle))(https://developer.android.com/reference/android/os/Bundle.html bundle)`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Timeline#fromBundle(android.os.Bundle,int)` instead.

<br />

`static https://developer.android.com/reference/androidx/media3/common/Timeline` `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/androidx/media3/common/Timeline#fromBundle(android.os.Bundle,int)(https://developer.android.com/reference/android/os/Bundle.html bundle, int interfaceVersion)`

Restores a `Timeline` from a `https://developer.android.com/reference/android/os/Bundle.html`.
`int` `https://developer.android.com/reference/androidx/media3/common/Timeline#getFirstWindowIndex(boolean)(boolean shuffleModeEnabled)`

Returns the index of the first window in the playback order depending on whether shuffling is enabled.
`int` `https://developer.android.com/reference/androidx/media3/common/Timeline#getLastWindowIndex(boolean)(boolean shuffleModeEnabled)`

Returns the index of the last window in the playback order depending on whether shuffling is enabled.
`final int` `https://developer.android.com/reference/androidx/media3/common/Timeline#getNextPeriodIndex(int,androidx.media3.common.Timeline.Period,androidx.media3.common.Timeline.Window,int,boolean)(
int periodIndex,
https://developer.android.com/reference/androidx/media3/common/Timeline.Period period,
https://developer.android.com/reference/androidx/media3/common/Timeline.Window window,
@https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode int repeatMode,
boolean shuffleModeEnabled
)`

Returns the index of the period after the period at index `periodIndex` depending on the `repeatMode` and whether shuffling is enabled.
`int` `https://developer.android.com/reference/androidx/media3/common/Timeline#getNextWindowIndex(int,int,boolean)(
int windowIndex,
@https://developer.android.com/reference/androidx/media3/common/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.
`final https://developer.android.com/reference/androidx/media3/common/Timeline.Period` `https://developer.android.com/reference/androidx/media3/common/Timeline#getPeriod(int,androidx.media3.common.Timeline.Period)(int periodIndex, https://developer.android.com/reference/androidx/media3/common/Timeline.Period period)`

Populates a `https://developer.android.com/reference/androidx/media3/common/Timeline.Period` with data for the period at the specified index.
`https://developer.android.com/reference/androidx/media3/common/Timeline.Period` `https://developer.android.com/reference/androidx/media3/common/Timeline#getPeriodByUid(java.lang.Object,androidx.media3.common.Timeline.Period)(https://developer.android.com/reference/java/lang/Object.html periodUid, https://developer.android.com/reference/androidx/media3/common/Timeline.Period period)`

Populates a `https://developer.android.com/reference/androidx/media3/common/Timeline.Period` with data for the period with the specified unique identifier.
`final https://developer.android.com/reference/android/util/Pair.html<https://developer.android.com/reference/java/lang/Object.html, https://developer.android.com/reference/java/lang/Long.html>` `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi
@https://checkerframework.org/api/com/google/errorprone/annotations/InlineMe.html(replacement = "this.getPeriodPositionUs(window, period, windowIndex, windowPositionUs)")
[getPeriodPosition](https://developer.android.com/reference/androidx/media3/common/Timeline#getPeriodPosition(androidx.media3.common.Timeline.Window,androidx.media3.common.Timeline.Period,int,long))(
https://developer.android.com/reference/androidx/media3/common/Timeline.Window window,
https://developer.android.com/reference/androidx/media3/common/Timeline.Period period,
int windowIndex,
long windowPositionUs
)`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Timeline#getPeriodPositionUs(androidx.media3.common.Timeline.Window,androidx.media3.common.Timeline.Period,int,long)` instead.

<br />

`final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/util/Pair.html<https://developer.android.com/reference/java/lang/Object.html, https://developer.android.com/reference/java/lang/Long.html>` `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi
@https://checkerframework.org/api/com/google/errorprone/annotations/InlineMe.html(replacement = "this.getPeriodPositionUs("
+ "window, period, windowIndex, windowPositionUs, defaultPositionProjectionUs)")
[getPeriodPosition](https://developer.android.com/reference/androidx/media3/common/Timeline#getPeriodPosition(androidx.media3.common.Timeline.Window,androidx.media3.common.Timeline.Period,int,long,long))(
https://developer.android.com/reference/androidx/media3/common/Timeline.Window window,
https://developer.android.com/reference/androidx/media3/common/Timeline.Period period,
int windowIndex,
long windowPositionUs,
long defaultPositionProjectionUs
)`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Timeline#getPeriodPositionUs(androidx.media3.common.Timeline.Window,androidx.media3.common.Timeline.Period,int,long,long)` instead.

<br />

`final https://developer.android.com/reference/android/util/Pair.html<https://developer.android.com/reference/java/lang/Object.html, https://developer.android.com/reference/java/lang/Long.html>` `https://developer.android.com/reference/androidx/media3/common/Timeline#getPeriodPositionUs(androidx.media3.common.Timeline.Window,androidx.media3.common.Timeline.Period,int,long)(
https://developer.android.com/reference/androidx/media3/common/Timeline.Window window,
https://developer.android.com/reference/androidx/media3/common/Timeline.Period period,
int windowIndex,
long windowPositionUs
)`

Calls `https://developer.android.com/reference/androidx/media3/common/Timeline#getPeriodPositionUs(androidx.media3.common.Timeline.Window,androidx.media3.common.Timeline.Period,int,long)` with a zero default position projection.
`final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/util/Pair.html<https://developer.android.com/reference/java/lang/Object.html, https://developer.android.com/reference/java/lang/Long.html>` `https://developer.android.com/reference/androidx/media3/common/Timeline#getPeriodPositionUs(androidx.media3.common.Timeline.Window,androidx.media3.common.Timeline.Period,int,long,long)(
https://developer.android.com/reference/androidx/media3/common/Timeline.Window window,
https://developer.android.com/reference/androidx/media3/common/Timeline.Period period,
int windowIndex,
long windowPositionUs,
long defaultPositionProjectionUs
)`

Converts `(windowIndex, windowPositionUs)` to the corresponding `(periodUid,
periodPositionUs)`.
`int` `https://developer.android.com/reference/androidx/media3/common/Timeline#getPreviousWindowIndex(int,int,boolean)(
int windowIndex,
@https://developer.android.com/reference/androidx/media3/common/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.
`final https://developer.android.com/reference/androidx/media3/common/Timeline.Window` `https://developer.android.com/reference/androidx/media3/common/Timeline#getWindow(int,androidx.media3.common.Timeline.Window)(int windowIndex, https://developer.android.com/reference/androidx/media3/common/Timeline.Window window)`

Populates a `https://developer.android.com/reference/androidx/media3/common/Timeline.Window` with data for the window at the specified index.
`int` `https://developer.android.com/reference/androidx/media3/common/Timeline#hashCode()()` `final boolean` `https://developer.android.com/reference/androidx/media3/common/Timeline#isEmpty()()`

Returns whether the timeline is empty.
`final boolean` `https://developer.android.com/reference/androidx/media3/common/Timeline#isLastPeriod(int,androidx.media3.common.Timeline.Period,androidx.media3.common.Timeline.Window,int,boolean)(
int periodIndex,
https://developer.android.com/reference/androidx/media3/common/Timeline.Period period,
https://developer.android.com/reference/androidx/media3/common/Timeline.Window window,
@https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode int repeatMode,
boolean shuffleModeEnabled
)`

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

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Timeline#toBundle(int)` instead.

<br />

`final https://developer.android.com/reference/android/os/Bundle.html` `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/androidx/media3/common/Timeline#toBundle(int)(int interfaceVersion)`

Returns a `https://developer.android.com/reference/android/os/Bundle.html` representing the information stored in this object.

## Public constructors

### SinglePeriodTimeline

```
public [SinglePeriodTimeline](https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,boolean,boolean,boolean,java.lang.Object,java.lang.Object))(
    long durationUs,
    boolean isSeekable,
    boolean isDynamic,
    boolean isLive,
    @Nullable Object manifest,
    @Nullable Object tag
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,boolean,boolean,boolean,java.lang.Object,androidx.media3.common.MediaItem)` instead.

### 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 |
|---|---|
| `long durationUs` | The duration of the period, in microseconds. |
| `boolean isSeekable` | Whether seeking is supported within the period. |
| `boolean isDynamic` | Whether the window may change when the timeline is updated. |
| `boolean useLiveConfiguration` | Whether the window is live and `https://developer.android.com/reference/androidx/media3/common/MediaItem#liveConfiguration()` is used to configure live playback behaviour. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html manifest` | The manifest. May be `null`. |
| `https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem` | A media item used for `https://developer.android.com/reference/androidx/media3/common/Timeline.Window#mediaItem()`. |

### SinglePeriodTimeline

```
public [SinglePeriodTimeline](https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,boolean,boolean,boolean,java.lang.Object,java.lang.Object))(
    long periodDurationUs,
    long windowDurationUs,
    long windowPositionInPeriodUs,
    long windowDefaultStartPositionUs,
    boolean isSeekable,
    boolean isDynamic,
    boolean isLive,
    @Nullable Object manifest,
    @Nullable Object tag
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,boolean,boolean,boolean,java.lang.Object,androidx.media3.common.MediaItem)` instead.

### 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 |
|---|---|
| `long periodDurationUs` | The duration of the period in microseconds. |
| `long windowDurationUs` | The duration of the window in microseconds. |
| `long windowPositionInPeriodUs` | The position of the start of the window in the period, in microseconds. |
| `long windowDefaultStartPositionUs` | The default position relative to the start of the window at which to begin playback, in microseconds. |
| `boolean isSeekable` | Whether seeking is supported within the window. |
| `boolean isDynamic` | Whether the window may change when the timeline is updated. |
| `boolean useLiveConfiguration` | Whether the window is live and `https://developer.android.com/reference/androidx/media3/common/MediaItem#liveConfiguration()` is used to configure live playback behaviour. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html manifest` | The manifest. May be `null`. |
| `https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem` | A media item used for `https://developer.android.com/reference/androidx/media3/common/Timeline.Window#mediaItem()`. |

### SinglePeriodTimeline

```
public [SinglePeriodTimeline](https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,long,long,long,boolean,boolean,boolean,java.lang.Object,java.lang.Object))(
    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
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,long,long,long,boolean,boolean,boolean,java.lang.Object,androidx.media3.common.MediaItem,androidx.media3.common.MediaItem.LiveConfiguration)` instead.

### SinglePeriodTimeline

```
public [SinglePeriodTimeline](https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,long,long,long,boolean,boolean,java.lang.Object,androidx.media3.common.MediaItem,androidx.media3.common.MediaItem.LiveConfiguration))(
    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
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#SinglePeriodTimeline(long,long,long,long,long,long,long,boolean,boolean,boolean,java.lang.Object,androidx.media3.common.MediaItem,androidx.media3.common.MediaItem.LiveConfiguration)` instead.

### 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 |
|---|---|
| `long presentationStartTimeMs` | The start time of the presentation in milliseconds since the epoch, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if unknown or not applicable. |
| `long windowStartTimeMs` | The window's start time in milliseconds since the epoch, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if unknown or not applicable. |
| `long elapsedRealtimeEpochOffsetMs` | The offset between `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` and the time since the Unix epoch according to the clock of the media origin server, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if unknown or not applicable. |
| `long periodDurationUs` | The duration of the period in microseconds. |
| `long windowDurationUs` | The duration of the window in microseconds. |
| `long windowPositionInPeriodUs` | The position of the start of the window in the period, in microseconds. |
| `long windowDefaultStartPositionUs` | The default position relative to the start of the window at which to begin playback, in microseconds. |
| `boolean isSeekable` | Whether seeking is supported within the window. |
| `boolean isDynamic` | Whether the window may change when the timeline is updated. |
| `boolean suppressPositionProjection` | Whether `https://developer.android.com/reference/androidx/media3/exoplayer/source/SinglePeriodTimeline#getWindow(int,androidx.media3.common.Timeline.Window,long)` in a playlist should be suppressed. This only applies for dynamic timelines and is ignored otherwise. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html manifest` | The manifest. May be `null`. |
| `https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem` | A media item used for `https://developer.android.com/reference/androidx/media3/common/Timeline.Window#mediaItem()`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/MediaItem.LiveConfiguration liveConfiguration` | The configuration for live playback behaviour, or `null` if the window is not live. |

## Public methods

### getIndexOfPeriod

```
public int getIndexOfPeriod(Object uid)
```

Returns the index of the period identified by its unique `https://developer.android.com/reference/androidx/media3/common/Timeline.Period#uid()`, or `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` if the period is not in the timeline.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/Object.html uid` | A unique identifier for a period. |

| Returns |
|---|---|
| `int` | The index of the period, or `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` if the period was not found. |

### getPeriod

```
public Timeline.Period getPeriod(int periodIndex, Timeline.Period period, boolean setIds)
```

Populates a `https://developer.android.com/reference/androidx/media3/common/Timeline.Period` with data for the period at the specified index.

| Parameters |
|---|---|
| `int periodIndex` | The index of the period. |
| `https://developer.android.com/reference/androidx/media3/common/Timeline.Period period` | The `https://developer.android.com/reference/androidx/media3/common/Timeline.Period` to populate. Must not be null. |
| `boolean setIds` | Whether `https://developer.android.com/reference/androidx/media3/common/Timeline.Period#id()` and `https://developer.android.com/reference/androidx/media3/common/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. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Timeline.Period` | The populated `https://developer.android.com/reference/androidx/media3/common/Timeline.Period`, for convenience. |

### getPeriodCount

```
public int getPeriodCount()
```

Returns the number of periods in the timeline.

### getUidOfPeriod

```
public 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 |
|---|---|
| `https://developer.android.com/reference/java/lang/Object.html` | The unique id of the period. |

### getWindow

```
public Timeline.Window getWindow(
    int windowIndex,
    Timeline.Window window,
    long defaultPositionProjectionUs
)
```

Populates a `https://developer.android.com/reference/androidx/media3/common/Timeline.Window` with data for the window at the specified index.

| Parameters |
|---|---|
| `int windowIndex` | The index of the window. |
| `https://developer.android.com/reference/androidx/media3/common/Timeline.Window window` | The `https://developer.android.com/reference/androidx/media3/common/Timeline.Window` to populate. Must not be null. |
| `long defaultPositionProjectionUs` | A duration into the future that the populated window's default start position should be projected. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Timeline.Window` | The populated `https://developer.android.com/reference/androidx/media3/common/Timeline.Window`, for convenience. |

### getWindowCount

```
public int getWindowCount()
```

Returns the number of windows in the timeline.