# Period

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

*** ** * ** ***


```
@UnstableApi
public class Period
```

<br />

*** ** * ** ***

Encapsulates media content components over a contiguous period of time.

## Summary

| ### Public fields |
|---|---|
| `final https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AdaptationSet>` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#adaptationSets()` The adaptation sets belonging to the period. |
| `final https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AlternativeMpdEvent>` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#alternativeMpdEvents()` The `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AlternativeMpdEvent`s belonging to the period, sorted by presentation time. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Descriptor` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#assetIdentifier()` The asset identifier for this period, if one exists |
| `final https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/EventStream>` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#eventStreams()` The event stream belonging to the period. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#id()` The period identifier, if one exists. |
| `final long` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#startMs()` The start time of the period in milliseconds, relative to the start of the manifest. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#Period(java.lang.String,long,java.util.List<androidx.media3.exoplayer.dash.manifest.AdaptationSet>)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html id, long startMs, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AdaptationSet> adaptationSets )` |
| `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#Period(java.lang.String,long,java.util.List<androidx.media3.exoplayer.dash.manifest.AdaptationSet>,java.util.List<androidx.media3.exoplayer.dash.manifest.EventStream>)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html id, long startMs, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AdaptationSet> adaptationSets, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/EventStream> eventStreams )` |
| `[Period](https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#Period(java.lang.String,long,java.util.List<androidx.media3.exoplayer.dash.manifest.AdaptationSet>,java.util.List<androidx.media3.exoplayer.dash.manifest.EventStream>,androidx.media3.exoplayer.dash.manifest.Descriptor))( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html id, long startMs, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AdaptationSet> adaptationSets, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/EventStream> eventStreams, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Descriptor assetIdentifier )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#Period(java.lang.String,long,java.util.List<androidx.media3.exoplayer.dash.manifest.AdaptationSet>,java.util.List<androidx.media3.exoplayer.dash.manifest.EventStream>,androidx.media3.exoplayer.dash.manifest.Descriptor,java.util.List<androidx.media3.exoplayer.dash.manifest.AlternativeMpdEvent>)` instead. <br /> |
| `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#Period(java.lang.String,long,java.util.List<androidx.media3.exoplayer.dash.manifest.AdaptationSet>,java.util.List<androidx.media3.exoplayer.dash.manifest.EventStream>,androidx.media3.exoplayer.dash.manifest.Descriptor,java.util.List<androidx.media3.exoplayer.dash.manifest.AlternativeMpdEvent>)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html id, long startMs, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AdaptationSet> adaptationSets, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/EventStream> eventStreams, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Descriptor assetIdentifier, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AlternativeMpdEvent> alternativeMpdEvents )` |

| ### Public methods |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#getAdaptationSetIndex(int)(int type)` Returns the index of the first adaptation set of a given type, or `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` if no adaptation set of the specified type exists. |

## Public fields

### adaptationSets

```
public final List<AdaptationSet> adaptationSets
```

The adaptation sets belonging to the period.

### alternativeMpdEvents

```
public final ImmutableList<AlternativeMpdEvent> alternativeMpdEvents
```

The `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AlternativeMpdEvent`s belonging to the period, sorted by presentation time.

### assetIdentifier

```
public final @Nullable Descriptor assetIdentifier
```

The asset identifier for this period, if one exists

### eventStreams

```
public final List<EventStream> eventStreams
```

The event stream belonging to the period.

### id

```
public final @Nullable String id
```

The period identifier, if one exists.

### startMs

```
public final long startMs
```

The start time of the period in milliseconds, relative to the start of the manifest.

## Public constructors

### Period

```
public Period(
    @Nullable String id,
    long startMs,
    List<AdaptationSet> adaptationSets
)
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html id` | The period identifier. May be null. |
| `long startMs` | The start time of the period in milliseconds. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AdaptationSet> adaptationSets` | The adaptation sets belonging to the period. |

### Period

```
public Period(
    @Nullable String id,
    long startMs,
    List<AdaptationSet> adaptationSets,
    List<EventStream> eventStreams
)
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html id` | The period identifier. May be null. |
| `long startMs` | The start time of the period in milliseconds. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AdaptationSet> adaptationSets` | The adaptation sets belonging to the period. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/EventStream> eventStreams` | The `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/EventStream`s belonging to the period. |

### Period

```
public [Period](https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#Period(java.lang.String,long,java.util.List<androidx.media3.exoplayer.dash.manifest.AdaptationSet>,java.util.List<androidx.media3.exoplayer.dash.manifest.EventStream>,androidx.media3.exoplayer.dash.manifest.Descriptor))(
    @Nullable String id,
    long startMs,
    List<AdaptationSet> adaptationSets,
    List<EventStream> eventStreams,
    @Nullable Descriptor assetIdentifier
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Period#Period(java.lang.String,long,java.util.List<androidx.media3.exoplayer.dash.manifest.AdaptationSet>,java.util.List<androidx.media3.exoplayer.dash.manifest.EventStream>,androidx.media3.exoplayer.dash.manifest.Descriptor,java.util.List<androidx.media3.exoplayer.dash.manifest.AlternativeMpdEvent>)` instead.

### Period

```
public Period(
    @Nullable String id,
    long startMs,
    List<AdaptationSet> adaptationSets,
    List<EventStream> eventStreams,
    @Nullable Descriptor assetIdentifier,
    List<AlternativeMpdEvent> alternativeMpdEvents
)
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html id` | The period identifier. May be null. |
| `long startMs` | The start time of the period in milliseconds. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AdaptationSet> adaptationSets` | The adaptation sets belonging to the period. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/EventStream> eventStreams` | The `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/EventStream`s belonging to the period. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/Descriptor assetIdentifier` | The asset identifier for this period, or `null`. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AlternativeMpdEvent> alternativeMpdEvents` | The `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/AlternativeMpdEvent`s belonging to the period. |

## Public methods

### getAdaptationSetIndex

```
public int getAdaptationSetIndex(int type)
```

Returns the index of the first adaptation set of a given type, or `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` if no adaptation set of the specified type exists.

| Parameters |
|---|---|
| `int type` | An adaptation set type. |

| Returns |
|---|---|
| `int` | The index of the first adaptation set of the specified type, or `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()`. |