@UnstableApi
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 = )
annotation TrackSelection.Type

Represents a type track selection.

Constants

const Int

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

const Int

An unspecified track selection type.

Public functions

Format!
getFormat(index: Int)

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

Int

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

TrackGroup!

Returns the TrackGroup to which the selected tracks belong.

Int

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

Int
indexOf(format: Format!)

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

Int
indexOf(indexInTrackGroup: Int)

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

Int

Returns the number of tracks in the selection.

Constants

TYPE_CUSTOM_BASE

const val TYPE_CUSTOM_BASE = 10000: Int

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

TYPE_UNSET

const val TYPE_UNSET = 0: Int

An unspecified track selection type.

Public functions

getFormat

fun getFormat(index: Int): Format!

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

Parameters
index: Int

The index in the selection.

Returns
Format!

The format of the selected track.

getIndexInTrackGroup

fun getIndexInTrackGroup(index: Int): Int

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

Parameters
index: Int

The index in the selection.

Returns
Int

The index of the selected track.

getTrackGroup

fun getTrackGroup(): TrackGroup!

Returns the TrackGroup to which the selected tracks belong.

getType

@TrackSelection.Type
fun getType(): Int

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

fun indexOf(format: Format!): Int

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

fun indexOf(indexInTrackGroup: Int): Int

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

Parameters
indexInTrackGroup: Int

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

fun length(): Int

Returns the number of tracks in the selection.