# MediaSource.MediaPeriodId

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/MediaSource.java+class:androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)

*** ** * ** ***


```
@UnstableApi
class MediaSource.MediaPeriodId
```

<br />

*** ** * ** ***

Identifier for a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#MediaPeriodId(java.lang.Object)(periodUid: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` Creates a media period identifier for a period which is not part of a buffered sequence of windows. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#MediaPeriodId(java.lang.Object,long)(periodUid: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!, windowSequenceNumber: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Creates a media period identifier for the specified period in the timeline. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#MediaPeriodId(java.lang.Object,long,int)( periodUid: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!, windowSequenceNumber: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, nextAdGroupIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Creates a media period identifier for the specified clipped period in the timeline. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#MediaPeriodId(java.lang.Object,int,int,long)( periodUid: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!, adGroupIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, adIndexInAdGroup: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, windowSequenceNumber: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` Creates a media period identifier that identifies an ad within an ad group at the specified timeline period. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#copyWithPeriodUid(java.lang.Object)(newPeriodUid: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` Returns a copy of this period identifier but with `newPeriodUid` as its period uid. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#copyWithWindowSequenceNumber(long)(windowSequenceNumber: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Returns a copy of this period identifier with a new `windowSequenceNumber`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#equals(java.lang.Object)(obj: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#equalsExceptNextAdGroupIndex(androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)(mediaPeriodId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId!)` Returns whether this `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` is equal to the given period ID, excluding the next ad group index. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#isAd()()` Returns whether this period identifier identifies an ad in an ad group in a period. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#adGroupIndex()` If the media period is in an ad group, the index of the ad group in the period. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#adIndexInAdGroup()` If the media period is in an ad group, the index of the ad in its ad group in the period. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#nextAdGroupIndex()` The index of the next ad group to which the media period's content is clipped, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#INDEX_UNSET()` if there is no following ad group or if this media period is an ad. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#periodUid()` The unique id of the timeline period. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId#windowSequenceNumber()` The sequence number of the window in the buffered sequence of windows this media period is part of. |

## Public constructors

### MediaPeriodId

```
MediaPeriodId(periodUid: Any!)
```

Creates a media period identifier for a period which is not part of a buffered sequence of windows.

| Parameters |
|---|---|
| `periodUid: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!` | The unique id of the timeline period. |

### MediaPeriodId

```
MediaPeriodId(periodUid: Any!, windowSequenceNumber: Long)
```

Creates a media period identifier for the specified period in the timeline.

| Parameters |
|---|---|
| `periodUid: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!` | The unique id of the timeline period. |
| `windowSequenceNumber: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The sequence number of the window in the buffered sequence of windows this media period is part of. |

### MediaPeriodId

```
MediaPeriodId(
    periodUid: Any!,
    windowSequenceNumber: Long,
    nextAdGroupIndex: Int
)
```

Creates a media period identifier for the specified clipped period in the timeline.

| Parameters |
|---|---|
| `periodUid: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!` | The unique id of the timeline period. |
| `windowSequenceNumber: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The sequence number of the window in the buffered sequence of windows this media period is part of. |
| `nextAdGroupIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the next ad group to which the media period's content is clipped. |

### MediaPeriodId

```
MediaPeriodId(
    periodUid: Any!,
    adGroupIndex: Int,
    adIndexInAdGroup: Int,
    windowSequenceNumber: Long
)
```

Creates a media period identifier that identifies an ad within an ad group at the specified timeline period.

| Parameters |
|---|---|
| `periodUid: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!` | The unique id of the timeline period that contains the ad group. |
| `adGroupIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the ad group. |
| `adIndexInAdGroup: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the ad in the ad group. |
| `windowSequenceNumber: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The sequence number of the window in the buffered sequence of windows this media period is part of. |

## Public functions

### copyWithPeriodUid

```
fun copyWithPeriodUid(newPeriodUid: Any!): MediaSource.MediaPeriodId!
```

Returns a copy of this period identifier but with `newPeriodUid` as its period uid.

### copyWithWindowSequenceNumber

```
fun copyWithWindowSequenceNumber(windowSequenceNumber: Long): MediaSource.MediaPeriodId!
```

Returns a copy of this period identifier with a new `windowSequenceNumber`.

### equals

```
fun equals(obj: Any?): Boolean
```

### equalsExceptNextAdGroupIndex

```
fun equalsExceptNextAdGroupIndex(mediaPeriodId: MediaSource.MediaPeriodId!): Boolean
```

Returns whether this `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` is equal to the given period ID, excluding the next ad group index.

| Parameters |
|---|---|
| `mediaPeriodId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId!` | The media period ID to compare. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if equal except the next ad group index, `false` otherwise. |

### hashCode

```
fun hashCode(): Int
```

### isAd

```
fun isAd(): Boolean
```

Returns whether this period identifier identifies an ad in an ad group in a period.

## Public properties

### adGroupIndex

```
val adGroupIndex: Int
```

If the media period is in an ad group, the index of the ad group in the period. `https://developer.android.com/reference/kotlin/androidx/media3/common/C#INDEX_UNSET()` otherwise.

### adIndexInAdGroup

```
val adIndexInAdGroup: Int
```

If the media period is in an ad group, the index of the ad in its ad group in the period. `https://developer.android.com/reference/kotlin/androidx/media3/common/C#INDEX_UNSET()` otherwise.

### nextAdGroupIndex

```
val nextAdGroupIndex: Int
```

The index of the next ad group to which the media period's content is clipped, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#INDEX_UNSET()` if there is no following ad group or if this media period is an ad.

### periodUid

```
val periodUid: Any!
```

The unique id of the timeline period.

### windowSequenceNumber

```
val windowSequenceNumber: Long
```

The sequence number of the window in the buffered sequence of windows this media period is part of. `https://developer.android.com/reference/kotlin/androidx/media3/common/C#INDEX_UNSET()` if the media period id is not part of a buffered sequence of windows.