# Tracks.Group

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

*** ** * ** ***

<br />

```
class Tracks.Group
```

<br />

*** ** * ** ***

Information about a single group of tracks, including the underlying `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`, the level to which each track is supported by the player, and whether any of the tracks are selected.

## Summary

| ### Public constructors |
|---|
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#Group(androidx.media3.common.TrackGroup,boolean,int[],boolean[])( mediaTrackGroup: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!, adaptiveSupported: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, @https://developer.android.com/reference/kotlin/androidx/media3/common/C.FormatSupport trackSupport: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!, trackSelected: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html>! )` Constructs an instance. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#copyWithId(java.lang.String)(groupId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Copies the `Group` with a new `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup#id()`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#copyWithMediaTrackGroup(androidx.media3.common.TrackGroup)(trackGroup: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!)` Copies the `Group` with a new media `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#equals(java.lang.Object)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#fromBundle(android.os.Bundle)(bundle: https://developer.android.com/reference/android/os/Bundle.html!)` Restores a group of tracks from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#getTrackFormat(int)(trackIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` for a specified track. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/kotlin/androidx/media3/common/C.FormatSupport https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#getTrackSupport(int)(trackIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the level of support for a specified track. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.TrackType https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#getType()()` Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/C.TrackType` of the group. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#isAdaptiveSupported()()` Returns whether adaptive selections containing more than one track are supported. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#isSelected()()` Returns whether at least one track in the group is selected for playback. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#isSupported()()` Returns whether at least one track in the group is supported for playback, without exceeding the advertised capabilities of the device. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#isSupported(boolean)(allowExceedsCapabilities: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns whether at least one track in the group is supported for playback. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#isTrackSelected(int)(trackIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns whether a specified track is selected for playback. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#isTrackSupported(int)(trackIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns whether a specified track is supported for playback, without exceeding the advertised capabilities of the device. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#isTrackSupported(int,boolean)(trackIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, allowExceedsCapabilities: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns whether a specified track is supported for playback. |
| `https://developer.android.com/reference/android/os/Bundle.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#toBundle()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#length()` The number of tracks in the group. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group#mediaTrackGroup()` |

## Public constructors

### Group

```
@UnstableApi
Group(
    mediaTrackGroup: TrackGroup!,
    adaptiveSupported: Boolean,
    @C.FormatSupport trackSupport: IntArray<Int>!,
    trackSelected: BooleanArray<Boolean>!
)
```

Constructs an instance.

| Parameters |
|---|---|
| `mediaTrackGroup: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!` | The underlying `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup` defined by the media. |
| `adaptiveSupported: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the player supports adaptive selections containing more than one track in the group. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.FormatSupport trackSupport: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/C.FormatSupport` of each track in the group. |
| `trackSelected: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html>!` | Whether each track in the `trackGroup` is selected. |

## Public functions

### copyWithId

```
@UnstableApi
fun copyWithId(groupId: String!): Tracks.Group!
```

Copies the `Group` with a new `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup#id()`.

| Parameters |
|---|---|
| `groupId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The new `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup#id()` |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group!` | The copied `Group`. |

### copyWithMediaTrackGroup

```
@UnstableApi
fun copyWithMediaTrackGroup(trackGroup: TrackGroup!): Tracks.Group!
```

Copies the `Group` with a new media `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`.

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

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks.Group!` | The copied `Group`. |

### equals

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

### fromBundle

```
@UnstableApi
java-static fun fromBundle(bundle: Bundle!): Tracks.Group!
```

Restores a group of tracks from a `https://developer.android.com/reference/android/os/Bundle.html`.

### getTrackFormat

```
fun getTrackFormat(trackIndex: Int): Format!
```

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` for a specified track.

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

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` of the track. |

### getTrackSupport

```
@UnstableApi
@C.FormatSupport
fun getTrackSupport(trackIndex: Int): Int
```

Returns the level of support for a specified track.

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

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/C.FormatSupport` of the track. |

### getType

```
@C.TrackType
fun getType(): Int
```

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/C.TrackType` of the group.

### hashCode

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

### isAdaptiveSupported

```
fun isAdaptiveSupported(): Boolean
```

Returns whether adaptive selections containing more than one track are supported.

### isSelected

```
fun isSelected(): Boolean
```

Returns whether at least one track in the group is selected for playback.

### isSupported

```
fun isSupported(): Boolean
```

Returns whether at least one track in the group is supported for playback, without exceeding the advertised capabilities of the device. Equivalent to `isSupported(false)`.

### isSupported

```
fun isSupported(allowExceedsCapabilities: Boolean): Boolean
```

Returns whether at least one track in the group is supported for playback.

| Parameters |
|---|---|
| `allowExceedsCapabilities: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether to consider a track as supported if it has a supported `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#sampleMimeType()`, but otherwise exceeds the advertised capabilities of the device. For example, a video track for which there's a corresponding decoder whose maximum advertised resolution is exceeded by the resolution of the track. Such tracks may be playable in some cases. |

### isTrackSelected

```
fun isTrackSelected(trackIndex: Int): Boolean
```

Returns whether a specified track is selected for playback.

Note that multiple tracks in the group may be selected. This is common in adaptive streaming, where tracks of different qualities are selected and the player switches between them during playback (e.g., based on the available network bandwidth).

This class doesn't provide a way to determine which of the selected tracks is currently playing, however some player implementations have ways of getting such information. For example, ExoPlayer provides this information via `ExoTrackSelection.getSelectedFormat`.

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

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True if the track is selected, false otherwise. |

### isTrackSupported

```
fun isTrackSupported(trackIndex: Int): Boolean
```

Returns whether a specified track is supported for playback, without exceeding the advertised capabilities of the device. Equivalent to `isTrackSupported(trackIndex, false)`.

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

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True if the track's format can be played, false otherwise. |

### isTrackSupported

```
fun isTrackSupported(trackIndex: Int, allowExceedsCapabilities: Boolean): Boolean
```

Returns whether a specified track is supported for playback.

| Parameters |
|---|---|
| `trackIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the track in the group. |
| `allowExceedsCapabilities: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether to consider the track as supported if it has a supported `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#sampleMimeType()`, but otherwise exceeds the advertised capabilities of the device. For example, a video track for which there's a corresponding decoder whose maximum advertised resolution is exceeded by the resolution of the track. Such tracks may be playable in some cases. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True if the track's format can be played, false otherwise. |

### toBundle

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

## Public properties

### length

```
val length: Int
```

The number of tracks in the group.

### mediaTrackGroup

```
val mediaTrackGroup: TrackGroup!
```