class Tracks.Group


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.

Summary

Public constructors

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

Constructs an instance.

Public functions

Tracks.Group!

Copies the Group with a new id.

Boolean
equals(other: Any?)
java-static Tracks.Group!

Restores a group of tracks from a Bundle.

Format!
getTrackFormat(trackIndex: Int)

Returns the Format for a specified track.

Int

Returns the level of support for a specified track.

Int

Returns the C.TrackType of the group.

Int
Boolean

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

Boolean

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

Boolean

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

Boolean
isSupported(allowExceedsCapabilities: Boolean)

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

Boolean
isTrackSelected(trackIndex: Int)

Returns whether a specified track is selected for playback.

Boolean
isTrackSupported(trackIndex: Int)

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

Boolean
isTrackSupported(trackIndex: Int, allowExceedsCapabilities: Boolean)

Returns whether a specified track is supported for playback.

Bundle!

Public properties

Int

The number of tracks in the group.

TrackGroup!

Public constructors

Group

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

Constructs an instance.

Parameters
mediaTrackGroup: TrackGroup!

The underlying TrackGroup defined by the media.

adaptiveSupported: Boolean

Whether the player supports adaptive selections containing more than one track in the group.

@C.FormatSupport trackSupport: IntArray!

The C.FormatSupport of each track in the group.

trackSelected: BooleanArray!

Whether each track in the trackGroup is selected.

Public functions

copyWithId

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

Copies the Group with a new id.

Parameters
groupId: String!

The new id

Returns
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 Bundle.

getTrackFormat

fun getTrackFormat(trackIndex: Int): Format!

Returns the Format for a specified track.

Parameters
trackIndex: Int

The index of the track in the group.

Returns
Format!

The Format of the track.

getTrackSupport

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

Returns the level of support for a specified track.

Parameters
trackIndex: Int

The index of the track in the group.

Returns
Int

The C.FormatSupport of the track.

getType

@C.TrackType
fun getType(): Int

Returns the 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: Boolean

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.

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: Int

The index of the track in the group.

Returns
Boolean

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: Int

The index of the track in the group.

Returns
Boolean

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: Int

The index of the track in the group.

allowExceedsCapabilities: Boolean

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
Boolean

True if the track's format can be played, false otherwise.

toBundle

fun toBundle(): Bundle!

Public properties

length

val lengthInt

The number of tracks in the group.

mediaTrackGroup

val mediaTrackGroupTrackGroup!