Back to Exoplayer

TrackGroup (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/source/TrackGroup.html

latest8.0 KB
Original Source

Package com.google.android.exoplayer2.source

Class TrackGroup

  • java.lang.Object

    • com.google.android.exoplayer2.source.TrackGroup
  • All Implemented Interfaces:Bundleable


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classTrackGroupextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[Bundleable](../Bundleable.html "interface in com.google.android.exoplayer2")

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

An immutable group of tracks available within a media stream. All tracks in a group present the same content, but their formats may differ.

As an example of how tracks can be grouped, consider an adaptive playback where a main video feed is provided in five resolutions, and an alternative video feed (e.g., a different camera angle in a sports match) is provided in two resolutions. In this case there will be two video track groups, one corresponding to the main video feed containing five tracks, and a second for the alternative video feed containing two tracks.

Note that audio tracks whose languages differ are not grouped, because content in different languages is not considered to be the same. Conversely, audio tracks in the same language that only differ in properties such as bitrate, sampling rate, channel count and so on can be grouped. This also applies to text tracks.

Note also that this class only contains information derived from the media itself. Unlike Tracks.Group, it does not include runtime information such as the extent to which playback of each track is supported by the device, or which tracks are currently selected.

Nested Class Summary

- 

Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Bundleable

Bundleable.Creator<T extends Bundleable>

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | static Bundleable.Creator<TrackGroup> | CREATOR | Deprecated.

Object that can restore TrackGroup from a Bundle. | | String | id | Deprecated.

An identifier for the track group. | | int | length | Deprecated.

The number of tracks in the group. | | @com.google.android.exoplayer2.C.TrackType int | type | Deprecated.

The type of tracks in the group. |

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | TrackGroup​(Format... formats) | Deprecated.

Constructs a track group containing the provided formats. | | TrackGroup​(String id, Format... formats) | Deprecated.

Constructs a track group with the provided id and formats. |

Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | TrackGroup | copyWithId​(String id) | Deprecated.

Returns a copy of this track group with the specified id. | | boolean | equals​(Object obj) | Deprecated. | | Format | getFormat​(int index) | Deprecated.

Returns the format of the track at a given index. | | int | hashCode() | Deprecated. | | int | indexOf​(Format format) | Deprecated.

Returns the index of the track with the given format in the group. | | Bundle | toBundle() | Deprecated.

Returns a Bundle representing the information stored in this object. |

- 

Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

Field Detail

- 

length

public final int length

Deprecated.

The number of tracks in the group.

- 

id

public final[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")id

Deprecated.

An identifier for the track group.

- 

type

public final @com.google.android.exoplayer2.C.TrackType int type

Deprecated.

The type of tracks in the group.

- 

CREATOR

public static final[Bundleable.Creator](../Bundleable.Creator.html "interface in com.google.android.exoplayer2")<[TrackGroup](TrackGroup.html "class in com.google.android.exoplayer2.source")> CREATOR

Deprecated.

Object that can restore TrackGroup from a Bundle.

Constructor Detail

- 

TrackGroup

public TrackGroup​([Format](../Format.html "class in com.google.android.exoplayer2")... formats)

Deprecated.

Constructs a track group containing the provided formats. Parameters:formats - The list of Formats. Must not be empty.

- 

TrackGroup

public TrackGroup​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")id,[Format](../Format.html "class in com.google.android.exoplayer2")... formats)

Deprecated.

Constructs a track group with the provided id and formats. Parameters:id - The identifier of the track group. May be an empty string.formats - The list of Formats. Must not be empty.

Method Detail

- 

copyWithId

@CheckResult
public[TrackGroup](TrackGroup.html "class in com.google.android.exoplayer2.source")copyWithId​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")id)

Deprecated.

Returns a copy of this track group with the specified id. Parameters:id - The identifier for the copy of the track group.Returns:The copied track group.

- 

getFormat

public[Format](../Format.html "class in com.google.android.exoplayer2")getFormat​(int index)

Deprecated.

Returns the format of the track at a given index. Parameters:index - The index of the track.Returns:The track's format.

- 

indexOf

public int indexOf​([Format](../Format.html "class in com.google.android.exoplayer2")format)

Deprecated.

Returns the index of the track with the given format in the group. The format is located by identity so, for example, group.indexOf(group.getFormat(index)) == index even if multiple tracks have formats that contain the same values. Parameters:format - The format.Returns:The index of the track, or C.INDEX_UNSET if no such track exists.

- 

hashCode

public int hashCode()

Deprecated. Overrides:hashCode in class Object

- 

equals

public boolean equals​(@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")obj)

Deprecated. Overrides:equals in class Object

- 

toBundle

public[Bundle](https://developer.android.com/reference/android/os/Bundle.html "class or interface in android.os")toBundle()

Deprecated.

Description copied from interface: Bundleable

Returns a Bundle representing the information stored in this object. Specified by:toBundle in interface Bundleable