docs/doc/reference/com/google/android/exoplayer2/Tracks.Group.html
Package com.google.android.exoplayer2
All Implemented Interfaces:BundleableEnclosing class:Tracks
public static final classTracks.Groupextends[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")
Information about a single group of tracks, including the underlying TrackGroup, the level to which each track is supported by the player, and whether any of the tracks are selected.
-
Bundleable.Creator<T extends Bundleable>
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static Bundleable.Creator<Tracks.Group> | CREATOR |
Object that can restore a group of tracks from a Bundle.
|
| int | length |
The number of tracks in the group.
|
Constructors | Constructor | Description |
| --- | --- |
| Group(TrackGroup mediaTrackGroup, boolean adaptiveSupported, @com.google.android.exoplayer2.C.FormatSupport int[] trackSupport, boolean[] trackSelected) |
Constructs an instance.
|
All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| Tracks.Group | copyWithId(String groupId) |
Copies the Group with a new TrackGroup.id.
|
| boolean | equals(Object other) | |
| TrackGroup | getMediaTrackGroup() |
Returns the underlying TrackGroup defined by the media.
|
| Format | getTrackFormat(int trackIndex) |
Returns the Format for a specified track.
|
| @com.google.android.exoplayer2.C.FormatSupport int | getTrackSupport(int trackIndex) |
Returns the level of support for a specified track.
|
| @com.google.android.exoplayer2.C.TrackType int | getType() |
Returns the C.TrackType of the group.
|
| int | hashCode() | |
| boolean | isAdaptiveSupported() |
Returns whether adaptive selections containing more than one track are supported.
|
| boolean | isSelected() |
Returns whether at least one track in the group is selected for playback.
|
| boolean | isSupported() |
Returns whether at least one track in the group is supported for playback, without exceeding the advertised capabilities of the device.
|
| boolean | isSupported(boolean allowExceedsCapabilities) |
Returns whether at least one track in the group is supported for playback.
|
| boolean | isTrackSelected(int trackIndex) |
Returns whether a specified track is selected for playback.
|
| boolean | isTrackSupported(int trackIndex) |
Returns whether a specified track is supported for playback, without exceeding the advertised capabilities of the device.
|
| boolean | isTrackSupported(int trackIndex, boolean allowExceedsCapabilities) |
Returns whether a specified track is supported for playback.
|
| Bundle | toBundle() |
Returns a Bundle representing the information stored in this object.
|
-
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
public final int length
The number of tracks in the group.
-
public static final[Bundleable.Creator](Bundleable.Creator.html "interface in com.google.android.exoplayer2")<[Tracks.Group](Tracks.Group.html "class in com.google.android.exoplayer2")> CREATOR
Object that can restore a group of tracks from a Bundle.
-
public Group([TrackGroup](source/TrackGroup.html "class in com.google.android.exoplayer2.source")mediaTrackGroup,
boolean adaptiveSupported,[@FormatSupport](C.FormatSupport.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.FormatSupport int[] trackSupport,
boolean[] trackSelected)
Constructs an instance.
Parameters:mediaTrackGroup - The underlying TrackGroup defined by the media.adaptiveSupported - Whether the player supports adaptive selections containing more than one track in the group.trackSupport - The C.FormatSupport of each track in the group.trackSelected - Whether each track in the trackGroup is selected.
-
public[TrackGroup](source/TrackGroup.html "class in com.google.android.exoplayer2.source")getMediaTrackGroup()
Returns the underlying TrackGroup defined by the media.
Unlike this class, TrackGroup only contains information defined by the media itself, and does not contain runtime information such as which tracks are supported and currently selected. This makes it suitable for use as a key in certain (key, value) data structures.
-
public[Format](Format.html "class in com.google.android.exoplayer2")getTrackFormat(int trackIndex)
Returns the Format for a specified track.
Parameters:trackIndex - The index of the track in the group.Returns:The Format of the track.
-
[@FormatSupport](C.FormatSupport.html "annotation in com.google.android.exoplayer2")public @com.google.android.exoplayer2.C.FormatSupport int getTrackSupport(int trackIndex)
Returns the level of support for a specified track.
Parameters:trackIndex - The index of the track in the group.Returns:The C.FormatSupport of the track.
-
public boolean isTrackSupported(int trackIndex)
Returns whether a specified track is supported for playback, without exceeding the advertised capabilities of the device. Equivalent to isTrackSupported(trackIndex, false).
Parameters:trackIndex - The index of the track in the group.Returns:True if the track's format can be played, false otherwise.
-
public boolean isTrackSupported(int trackIndex,
boolean allowExceedsCapabilities)
Returns whether a specified track is supported for playback.
Parameters:trackIndex - The index of the track in the group.allowExceedsCapabilities - Whether to consider the track as supported if it has a supported MIME type, 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:True if the track's format can be played, false otherwise.
-
public boolean isSelected()
Returns whether at least one track in the group is selected for playback.
-
public boolean isAdaptiveSupported()
Returns whether adaptive selections containing more than one track are supported.
-
public boolean isSupported()
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).
-
public boolean isSupported(boolean allowExceedsCapabilities)
Returns whether at least one track in the group is supported for playback.
Parameters:allowExceedsCapabilities - Whether to consider a track as supported if it has a supported MIME type, 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.
-
public boolean isTrackSelected(int trackIndex)
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 - The index of the track in the group.Returns:True if the track is selected, false otherwise.
-
public @com.google.android.exoplayer2.C.TrackType int getType()
Returns the C.TrackType of the group.
-
public[Tracks.Group](Tracks.Group.html "class in com.google.android.exoplayer2")copyWithId([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")groupId)
Copies the Group with a new TrackGroup.id.
Parameters:groupId - The new TrackGroup.idReturns:The copied Group.
-
public boolean equals(@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")other)
Overrides:equals in class Object
-
public int hashCode()
Overrides:hashCode in class Object
-
public[Bundle](https://developer.android.com/reference/android/os/Bundle.html "class or interface in android.os")toBundle()
Description copied from interface: Bundleable
Returns a Bundle representing the information stored in this object.
Specified by:toBundle in interface Bundleable