# Tracks

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)

*** ** * ** ***

<br />

```
public final class Tracks
```

<br />

*** ** * ** ***

Information about groups of tracks.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/common/Tracks.Group` Information about a single group of tracks, including the underlying `https://developer.android.com/reference/androidx/media3/common/TrackGroup`, the level to which each track is supported by the player, and whether any of the tracks are selected. |

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/androidx/media3/common/Tracks` | `https://developer.android.com/reference/androidx/media3/common/Tracks#EMPTY()` Empty tracks. |

| ### Public fields |
|---|---|
| `final https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/androidx/media3/common/Tracks.Group>` | `https://developer.android.com/reference/androidx/media3/common/Tracks#groups()` |

| ### Public constructors |
|---|
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Tracks#Tracks(java.util.List<androidx.media3.common.Tracks.Group>)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Tracks.Group> groups)` Constructs an instance. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/Tracks#containsType(int)(@https://developer.android.com/reference/androidx/media3/common/C.TrackType int trackType)` Returns true if there are tracks of type `trackType`, and false otherwise. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/Tracks#equals(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html other)` |
| `static https://developer.android.com/reference/androidx/media3/common/Tracks` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Tracks#fromBundle(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html bundle)` Restores a `Tracks` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/androidx/media3/common/Tracks.Group>` | `https://developer.android.com/reference/androidx/media3/common/Tracks#getGroups()()` Returns the `https://developer.android.com/reference/androidx/media3/common/Tracks.Group` of tracks. |
| `int` | `https://developer.android.com/reference/androidx/media3/common/Tracks#hashCode()()` |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/Tracks#isEmpty()()` Returns `true` if there are no tracks, and `false` otherwise. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/Tracks#isTypeSelected(int)(@https://developer.android.com/reference/androidx/media3/common/C.TrackType int trackType)` Returns true if at least one track of the type `trackType` is selected for playback. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/Tracks#isTypeSupported(int)(@https://developer.android.com/reference/androidx/media3/common/C.TrackType int trackType)` Returns true if at least one track of type `trackType` is `https://developer.android.com/reference/androidx/media3/common/Tracks.Group#isTrackSupported(int)`. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/Tracks#isTypeSupported(int,boolean)( @https://developer.android.com/reference/androidx/media3/common/C.TrackType int trackType, boolean allowExceedsCapabilities )` Returns true if at least one track of type `trackType` is `https://developer.android.com/reference/androidx/media3/common/Tracks.Group#isTrackSupported(int,boolean)`. |
| `boolean` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [isTypeSupportedOrEmpty](https://developer.android.com/reference/androidx/media3/common/Tracks#isTypeSupportedOrEmpty(int))(@https://developer.android.com/reference/androidx/media3/common/C.TrackType int trackType)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Tracks#containsType(int)` and `https://developer.android.com/reference/androidx/media3/common/Tracks#isTypeSupported(int)`. <br /> |
| `boolean` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [isTypeSupportedOrEmpty](https://developer.android.com/reference/androidx/media3/common/Tracks#isTypeSupportedOrEmpty(int,boolean))( @https://developer.android.com/reference/androidx/media3/common/C.TrackType int trackType, boolean allowExceedsCapabilities )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Tracks#containsType(int)` and `https://developer.android.com/reference/androidx/media3/common/Tracks#isTypeSupported(int,boolean)`. <br /> |
| `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/Tracks#toBundle()()` |

## Constants

### EMPTY

```
public static final Tracks EMPTY
```

Empty tracks.

## Public fields

### groups

```
public final ImmutableList<Tracks.Group> groups
```

## Public constructors

### Tracks

```
@UnstableApi
public Tracks(List<Tracks.Group> groups)
```

Constructs an instance.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Tracks.Group> groups` | The `https://developer.android.com/reference/androidx/media3/common/Tracks.Group` of tracks. |

## Public methods

### containsType

```
public boolean containsType(@C.TrackType int trackType)
```

Returns true if there are tracks of type `trackType`, and false otherwise.

### equals

```
public boolean equals(@Nullable Object other)
```

### fromBundle

```
@UnstableApi
public static Tracks fromBundle(Bundle bundle)
```

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

### getGroups

```
public ImmutableList<Tracks.Group> getGroups()
```

Returns the `https://developer.android.com/reference/androidx/media3/common/Tracks.Group` of tracks.

### hashCode

```
public int hashCode()
```

### isEmpty

```
public boolean isEmpty()
```

Returns `true` if there are no tracks, and `false` otherwise.

### isTypeSelected

```
public boolean isTypeSelected(@C.TrackType int trackType)
```

Returns true if at least one track of the type `trackType` is selected for playback.

### isTypeSupported

```
public boolean isTypeSupported(@C.TrackType int trackType)
```

Returns true if at least one track of type `trackType` is `https://developer.android.com/reference/androidx/media3/common/Tracks.Group#isTrackSupported(int)`.

### isTypeSupported

```
public boolean isTypeSupported(
    @C.TrackType int trackType,
    boolean allowExceedsCapabilities
)
```

Returns true if at least one track of type `trackType` is `https://developer.android.com/reference/androidx/media3/common/Tracks.Group#isTrackSupported(int,boolean)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/C.TrackType int trackType` | The track type to query support for. |
| `boolean allowExceedsCapabilities` | Whether to consider the track as supported if it has a supported `https://developer.android.com/reference/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. |

### isTypeSupportedOrEmpty

```
@UnstableApi
public boolean [isTypeSupportedOrEmpty](https://developer.android.com/reference/androidx/media3/common/Tracks#isTypeSupportedOrEmpty(int))(@C.TrackType int trackType)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Tracks#containsType(int)` and `https://developer.android.com/reference/androidx/media3/common/Tracks#isTypeSupported(int)`.

### isTypeSupportedOrEmpty

```
@UnstableApi
public boolean [isTypeSupportedOrEmpty](https://developer.android.com/reference/androidx/media3/common/Tracks#isTypeSupportedOrEmpty(int,boolean))(
    @C.TrackType int trackType,
    boolean allowExceedsCapabilities
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Tracks#containsType(int)` and `https://developer.android.com/reference/androidx/media3/common/Tracks#isTypeSupported(int,boolean)`.

### toBundle

```
@UnstableApi
public Bundle toBundle()
```