# TrackGroupArray

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

*** ** * ** ***

<br />

```
@UnstableApi
class TrackGroupArray
```

<br />

*** ** * ** ***

An immutable array of `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`s.

This class is typically used to represent all of the tracks available in a piece of media. Tracks that are known to present the same content are grouped together (e.g., the same video feed provided at different resolutions in an adaptive stream). Tracks that are known to present different content are in separate track groups (e.g., an audio track will not be in the same group as a video track, and an audio track in one language will be in a different group to an audio track in another language).

## Summary

| ### Constants |
|---|---|
| `const https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray#EMPTY()` The empty array. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray#TrackGroupArray(androidx.media3.common.TrackGroup...)(trackGroups: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!>!)` Construct a `TrackGroupArray` from an array of `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray#equals(java.lang.Object)(obj: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray#fromBundle(android.os.Bundle)(bundle: https://developer.android.com/reference/android/os/Bundle.html!)` Restores a `TrackGroupArray` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray#get(int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the group at a given index. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray#getTrackTypes()()` Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup#type()` of each track group in this array. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray#indexOf(androidx.media3.common.TrackGroup)(group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!)` Returns the index of a group within the array. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray#isEmpty()()` Returns whether this track group array is empty. |
| `https://developer.android.com/reference/android/os/Bundle.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray#toBundle()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray#toString()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/TrackGroupArray#length()` The number of groups in the array. |

## Constants

### EMPTY

```
const val EMPTY: TrackGroupArray!
```

The empty array.

## Public constructors

### TrackGroupArray

```
TrackGroupArray(trackGroups: Array<TrackGroup!>!)
```

Construct a `TrackGroupArray` from an array of `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`.

The groups must not contain duplicates.

## Public functions

### equals

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

### fromBundle

```
java-static fun fromBundle(bundle: Bundle!): TrackGroupArray!
```

Restores a `TrackGroupArray` from a `https://developer.android.com/reference/android/os/Bundle.html`.

### get

```
fun get(index: Int): TrackGroup!
```

Returns the group at a given index.

| Parameters |
|---|---|
| `index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the group. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!` | The group. |

### getTrackTypes

```
fun getTrackTypes(): ImmutableList<Int!>!
```

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup#type()` of each track group in this array.

### hashCode

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

### indexOf

```
fun indexOf(group: TrackGroup!): Int
```

Returns the index of a group within the array.

| Parameters |
|---|---|
| `group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!` | The group. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the group, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#INDEX_UNSET()` if no such group exists. |

### isEmpty

```
fun isEmpty(): Boolean
```

Returns whether this track group array is empty.

### toBundle

```
fun toBundle(): Bundle!
```

### toString

```
fun toString(): String!
```

## Public properties

### length

```
val length: Int
```

The number of groups in the array. Greater than or equal to zero.