FixedTrackSelection


@UnstableApi
class FixedTrackSelection : BaseTrackSelection


A TrackSelection consisting of a single track.

Summary

Public constructors

FixedTrackSelection(group: TrackGroup!, track: Int)
FixedTrackSelection(
    group: TrackGroup!,
    track: Int,
    @TrackSelection.Type type: Int
)
FixedTrackSelection(
    group: TrackGroup!,
    track: Int,
    @TrackSelection.Type type: Int,
    @C.SelectionReason reason: Int,
    data: Any?
)

Public functions

Int

Returns the index of the selected track.

Any?

Returns optional data associated with the current track selection.

Int

Returns the reason for the current track selection.

Unit
updateSelectedTrack(
    playbackPositionUs: Long,
    bufferedDurationUs: Long,
    availableDurationUs: Long,
    queue: (Mutable)List<MediaChunk!>!,
    mediaChunkIterators: Array<MediaChunkIterator!>!
)

Updates the selected track for sources that load media in discrete MediaChunks.

Inherited Constants

From androidx.media3.exoplayer.trackselection.TrackSelection
const Int

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

const Int

An unspecified track selection type.

Inherited functions

From androidx.media3.exoplayer.trackselection.BaseTrackSelection
Unit

Disables this track selection.

Unit

Enables the track selection.

Boolean
equals(obj: Any?)
Int
evaluateQueueSize(
    playbackPositionUs: Long,
    queue: (Mutable)List<MediaChunk!>!
)

Returns the number of chunks that should be retained in the queue.

Boolean
excludeTrack(index: Int, exclusionDurationMs: Long)

Attempts to exclude the track at the specified index in the selection, making it ineligible for selection by calls to updateSelectedTrack for the specified period of time.

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.

Format!

Returns the Format of the individual selected track.

Int

Returns the index in the track group of the individual selected track.

TrackGroup!

Returns the TrackGroup to which the selected tracks belong.

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

Boolean
isTrackExcluded(index: Int, nowMs: Long)

Returns whether the track at the specified index in the selection is excluded.

Int

Returns the number of tracks in the selection.

Unit
onPlaybackSpeed(playbackSpeed: Float)

Called to notify the selection of the current playback speed.

From androidx.media3.exoplayer.trackselection.ExoTrackSelection
Long

Returns the most recent bitrate estimate utilised for track selection.

Unit

Called to notify the selection of a position discontinuity.

Unit

Called to notify when the playback is paused or resumed.

Unit

Called to notify when a rebuffer occurred.

Boolean
shouldCancelChunkLoad(
    playbackPositionUs: Long,
    loadingChunk: Chunk!,
    queue: (Mutable)List<MediaChunk!>!
)

Returns whether an ongoing load of a chunk should be canceled.

Inherited properties

From androidx.media3.exoplayer.trackselection.BaseTrackSelection
TrackGroup!

The selected TrackGroup.

Int

The number of selected tracks within the TrackGroup.

IntArray<Int>!

The indices of the selected tracks in group, in order of decreasing bandwidth.

Int

The type of the selection.

Public constructors

FixedTrackSelection

FixedTrackSelection(group: TrackGroup!, track: Int)
Parameters
group: TrackGroup!

The TrackGroup. Must not be null.

track: Int

The index of the selected track within the TrackGroup.

FixedTrackSelection

FixedTrackSelection(
    group: TrackGroup!,
    track: Int,
    @TrackSelection.Type type: Int
)
Parameters
group: TrackGroup!

The TrackGroup. Must not be null.

track: Int

The index of the selected track within the TrackGroup.

@TrackSelection.Type type: Int

The type that will be returned from getType.

FixedTrackSelection

FixedTrackSelection(
    group: TrackGroup!,
    track: Int,
    @TrackSelection.Type type: Int,
    @C.SelectionReason reason: Int,
    data: Any?
)
Parameters
group: TrackGroup!

The TrackGroup. Must not be null.

track: Int

The index of the selected track within the TrackGroup.

@TrackSelection.Type type: Int

The type that will be returned from getType.

@C.SelectionReason reason: Int

A reason for the track selection.

data: Any?

Optional data associated with the track selection.

Public functions

getSelectedIndex

fun getSelectedIndex(): Int

Returns the index of the selected track.

getSelectionData

fun getSelectionData(): Any?

Returns optional data associated with the current track selection.

getSelectionReason

@C.SelectionReason
fun getSelectionReason(): Int

Returns the reason for the current track selection.

updateSelectedTrack

fun updateSelectedTrack(
    playbackPositionUs: Long,
    bufferedDurationUs: Long,
    availableDurationUs: Long,
    queue: (Mutable)List<MediaChunk!>!,
    mediaChunkIterators: Array<MediaChunkIterator!>!
): Unit

Updates the selected track for sources that load media in discrete MediaChunks.

This method will only be called when the selection is enabled.

Parameters
playbackPositionUs: Long

The current playback position in microseconds. If playback of the period to which this track selection belongs has not yet started, the value will be the starting position in the period minus the duration of any media in previous periods still to be played.

bufferedDurationUs: Long

The duration of media currently buffered from the current playback position, in microseconds. Note that the next load position can be calculated as (playbackPositionUs + bufferedDurationUs).

availableDurationUs: Long

The duration of media available for buffering from the current playback position, in microseconds, or TIME_UNSET if media can be buffered to the end of the current period. Note that if not set to TIME_UNSET, the position up to which media is available for buffering can be calculated as (playbackPositionUs + availableDurationUs).

queue: (Mutable)List<MediaChunk!>!

The queue of already buffered MediaChunks. Must not be modified.

mediaChunkIterators: Array<MediaChunkIterator!>!

An array of MediaChunkIterators providing information about the sequence of upcoming media chunks for each track in the selection. All iterators start from the media chunk which will be loaded next if the respective track is selected. Note that this information may not be available for all tracks, and so some iterators may be empty.