TrackSelectionOverride


public final class TrackSelectionOverride


A track selection override, consisting of a TrackGroup and the indices of the tracks within the group that should be selected.

A track selection override is applied during playback if the media being played contains a TrackGroup equal to the one in the override. If a TrackSelectionParameters contains only one override of a given track type that applies to the media, this override will be used to control the track selection for that type. If multiple overrides of a given track type apply then the player will apply only one of them.

If trackIndices is empty then the override specifies that no tracks should be selected. Adding an empty override to a TrackSelectionParameters is similar to disabling a track type, except that an empty override will only be applied if the media being played contains a TrackGroup equal to the one in the override. Conversely, disabling a track type will prevent selection of tracks of that type for all media.

Summary

Public fields

final TrackGroup

The media TrackGroup whose trackIndices are forced to be selected.

final ImmutableList<Integer>

The indices of tracks in a TrackGroup to be selected.

Public constructors

TrackSelectionOverride(TrackGroup mediaTrackGroup, int trackIndex)

Constructs an instance to force trackIndex in trackGroup to be selected.

TrackSelectionOverride(
    TrackGroup mediaTrackGroup,
    List<Integer> trackIndices
)

Constructs an instance to force trackIndices in trackGroup to be selected.

Public methods

boolean
static TrackSelectionOverride

Restores a TrackSelectionOverride from a Bundle.

int

Returns the C.TrackType of the overridden track group.

int
Bundle

Public fields

mediaTrackGroup

public final TrackGroup mediaTrackGroup

The media TrackGroup whose trackIndices are forced to be selected.

trackIndices

public final ImmutableList<IntegertrackIndices

The indices of tracks in a TrackGroup to be selected.

Public constructors

TrackSelectionOverride

public TrackSelectionOverride(TrackGroup mediaTrackGroup, int trackIndex)

Constructs an instance to force trackIndex in trackGroup to be selected.

Parameters
TrackGroup mediaTrackGroup

The media TrackGroup for which to override the track selection.

int trackIndex

The index of the track in the TrackGroup to select.

TrackSelectionOverride

public TrackSelectionOverride(
    TrackGroup mediaTrackGroup,
    List<Integer> trackIndices
)

Constructs an instance to force trackIndices in trackGroup to be selected.

Parameters
TrackGroup mediaTrackGroup

The media TrackGroup for which to override the track selection.

List<Integer> trackIndices

The indices of the tracks in the TrackGroup to select.

Public methods

equals

public boolean equals(@Nullable Object obj)

fromBundle

@UnstableApi
public static TrackSelectionOverride fromBundle(Bundle bundle)

Restores a TrackSelectionOverride from a Bundle.

getType

@C.TrackType
public int getType()

Returns the C.TrackType of the overridden track group.

hashCode

public int hashCode()

toBundle

@UnstableApi
public Bundle toBundle()