public final class

TracksInfo.TrackGroupInfo

extends java.lang.Object

implements Bundleable

 java.lang.Object

↳androidx.media3.common.TracksInfo.TrackGroupInfo

Overview

Information about a single group of tracks, including the underlying TrackGroup, the type of tracks it contains, and the level to which each track is supported by the player.

Summary

Fields
public static final Bundleable.Creator<TracksInfo.TrackGroupInfo>CREATOR

Object that can restores a TracksInfo from a .

Constructors
publicTrackGroupInfo(TrackGroup trackGroup, int[] trackSupport[], int trackType, boolean[] tracksSelected[])

Constructs a TrackGroupInfo.

Methods
public booleanequals(java.lang.Object other)

public TrackGroupgetTrackGroup()

Returns the TrackGroup described by this TrackGroupInfo.

public intgetTrackSupport(int trackIndex)

Returns the level of support for a specified track.

public intgetTrackType()

Returns the C.TrackType of the group.

public inthashCode()

public booleanisSelected()

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

public booleanisSupported()

Returns whether at least one track in the group is supported for playback, without exceeding the advertised capabilities of the device.

public booleanisSupported(boolean allowExceedsCapabilities)

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

public booleanisTrackSelected(int trackIndex)

Returns whether a specified track is selected for playback.

public booleanisTrackSupported(int trackIndex)

Returns whether a specified track is supported for playback, without exceeding the advertised capabilities of the device.

public booleanisTrackSupported(int trackIndex, boolean allowExceedsCapabilities)

Returns whether a specified track is supported for playback.

public BundletoBundle()

from java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

Fields

public static final Bundleable.Creator<TracksInfo.TrackGroupInfo> CREATOR

Object that can restores a TracksInfo from a .

Constructors

public TrackGroupInfo(TrackGroup trackGroup, int[] trackSupport[], int trackType, boolean[] tracksSelected[])

Constructs a TrackGroupInfo.

Parameters:

trackGroup: The TrackGroup described.
trackSupport: The C.FormatSupport of each track in the trackGroup.
trackType: The C.TrackType of the tracks in the trackGroup.
tracksSelected: Whether a track is selected for each track in trackGroup.

Methods

public TrackGroup getTrackGroup()

Returns the TrackGroup described by this TrackGroupInfo.

public int getTrackSupport(int trackIndex)

Returns the level of support for a specified track.

Parameters:

trackIndex: The index of the track in the TrackGroup.

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 TrackGroup.

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 TrackGroup.
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 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 TrackGroup.

Returns:

True if the track is selected, false otherwise.

public int getTrackType()

Returns the C.TrackType of the group.

public boolean equals(java.lang.Object other)

public int hashCode()

public Bundle toBundle()