@UnstableApi
public interface TrackSelection

Known direct subclasses
ExoTrackSelection

A TrackSelection that can change the individually selected track as a result of calling updateSelectedTrack or evaluateQueueSize.

Known indirect subclasses
AdaptiveTrackSelection

A bandwidth based adaptive ExoTrackSelection, whose selected track is updated to be the one of highest quality given the current network conditions and the state of the buffer.

BaseTrackSelection

An abstract base class suitable for most ExoTrackSelection implementations.

FakeTrackSelection

A fake ExoTrackSelection that only returns 1 fixed track, and allows querying the number of calls to its methods.

FixedTrackSelection

A TrackSelection consisting of a single track.

RandomTrackSelection

An ExoTrackSelection whose selected track is updated randomly.


A track selection consisting of a static subset of selected tracks belonging to a .

Tracks belonging to the subset are exposed in decreasing bandwidth order.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(open = true, value = )
public annotation TrackSelection.Type

Represents a type track selection.

Constants

default static final int

The first value that can be used for application specific track selection types.

default static final int

An unspecified track selection type.

Public methods

abstract Format
getFormat(int index)

Returns the format of the track at a given index in the selection.

abstract int

Returns the index in the track group of the track at a given index in the selection.

abstract TrackGroup

Returns the TrackGroup to which the selected tracks belong.

abstract int

Returns an integer specifying the type of the selection, or TYPE_UNSET if not specified.

abstract int
indexOf(Format format)

Returns the index in the selection of the track with the specified format.

abstract int
indexOf(int indexInTrackGroup)

Returns the index in the selection of the track with the specified index in the track group.

abstract int

Returns the number of tracks in the selection.

Constants

TYPE_CUSTOM_BASE

default static final int TYPE_CUSTOM_BASE = 10000

The first value that can be used for application specific track selection types.

TYPE_UNSET

default static final int TYPE_UNSET = 0

An unspecified track selection type.

Public methods

getFormat

abstract Format getFormat(int index)

Returns the format of the track at a given index in the selection.

Parameters
int index

The index in the selection.

Returns
Format

The format of the selected track.

getIndexInTrackGroup

abstract int getIndexInTrackGroup(int index)

Returns the index in the track group of the track at a given index in the selection.

Parameters
int index

The index in the selection.

Returns
int

The index of the selected track.

getTrackGroup

abstract TrackGroup getTrackGroup()

Returns the TrackGroup to which the selected tracks belong.

getType

@TrackSelection.Type
abstract int getType()

Returns an integer specifying the type of the selection, or TYPE_UNSET if not specified.

Track selection types are specific to individual applications, but should be defined starting from TYPE_CUSTOM_BASE to ensure they don't conflict with any types that may be added to the library in the future.

indexOf

abstract int indexOf(Format format)

Returns the index in the selection of the track with the specified format. The format is located by identity so, for example, selection.indexOf(selection.getFormat(index)) == index even if multiple selected tracks have formats that contain the same values.

Parameters
Format format

The format.

Returns
int

The index in the selection, or INDEX_UNSET if the track with the specified format is not part of the selection.

indexOf

abstract int indexOf(int indexInTrackGroup)

Returns the index in the selection of the track with the specified index in the track group.

Parameters
int indexInTrackGroup

The index in the track group.

Returns
int

The index in the selection, or INDEX_UNSET if the track with the specified index is not part of the selection.

length

abstract int length()

Returns the number of tracks in the selection.