# FixedTrackSelection

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/trackselection/FixedTrackSelection.java+class:androidx.media3.exoplayer.trackselection.FixedTrackSelection)

*** ** * ** ***

<br />

```
@UnstableApi
class FixedTrackSelection : BaseTrackSelection
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.media3.exoplayer.trackselection.BaseTrackSelection](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection) ||
|   | ↳ | [androidx.media3.exoplayer.trackselection.FixedTrackSelection](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/FixedTrackSelection) |

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/TrackSelection` consisting of a single track.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/FixedTrackSelection#FixedTrackSelection(androidx.media3.common.TrackGroup,int)(group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!, track: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/FixedTrackSelection#FixedTrackSelection(androidx.media3.common.TrackGroup,int,int)( group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!, track: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, @https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/TrackSelection.Type type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/FixedTrackSelection#FixedTrackSelection(androidx.media3.common.TrackGroup,int,int,int,java.lang.Object)( group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!, track: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, @https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/TrackSelection.Type type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, @https://developer.android.com/reference/kotlin/androidx/media3/common/C.SelectionReason reason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html? )` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/FixedTrackSelection#getSelectedIndex()()` Returns the index of the selected track. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/FixedTrackSelection#getSelectionData()()` Returns optional data associated with the current track selection. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.SelectionReason https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/FixedTrackSelection#getSelectionReason()()` Returns the reason for the current track selection. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/FixedTrackSelection#updateSelectedTrack(long,long,long,java.util.List<? extends androidx.media3.exoplayer.source.chunk.MediaChunk>,androidx.media3.exoplayer.source.chunk.MediaChunkIterator[])( playbackPositionUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, bufferedDurationUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, availableDurationUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, queue: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk!>!, mediaChunkIterators: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunkIterator!>! )` Updates the selected track for sources that load media in discrete `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk`s. |

### Inherited Constants

From [androidx.media3.exoplayer.trackselection.BaseTrackSelection](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection) `const https://developer.android.com/reference/java/util/Comparator.html<https://developer.android.com/reference/kotlin/androidx/media3/common/Format!>!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#DEFAULT_FORMAT_COMPARATOR()`

The default `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` comparator, which sorts formats by bitrate in descending order.
From [androidx.media3.exoplayer.trackselection.TrackSelection](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/TrackSelection) `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/TrackSelection#TYPE_CUSTOM_BASE() = 10000`

The first value that can be used for application specific track selection types.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/TrackSelection#TYPE_UNSET() = 0`

An unspecified track selection type.

### Inherited functions

From [androidx.media3.exoplayer.trackselection.BaseTrackSelection](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#clearTrackExclusions()()`

Clears the existing track exclusions.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#disable()()`

Disables this track selection.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#enable()()`

Enables the track selection.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#equals(java.lang.Object)(obj: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#evaluateQueueSize(long,java.util.List<? extends androidx.media3.exoplayer.source.chunk.MediaChunk>)(

playbackPositionUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html,

queue: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk!>!

)`

Returns the number of chunks that should be retained in the queue.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#excludeTrack(int,long)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, exclusionDurationMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Attempts to exclude the track at the specified index in the selection, making it ineligible for selection by calls to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection#updateSelectedTrack(long,long,long,java.util.List<? extends androidx.media3.exoplayer.source.chunk.MediaChunk>,androidx.media3.exoplayer.source.chunk.MediaChunkIterator[])` for the specified period of time.
`https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#getFormat(int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Returns the format of the track at a given index in the selection.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#getIndexInTrackGroup(int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Returns the index in the track group of the track at a given index in the selection.
`https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#getSelectedFormat()()`

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` of the individual selected track.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#getSelectedIndexInTrackGroup()()`

Returns the index in the track group of the individual selected track.
`https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#getTrackGroup()()`

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup` to which the selected tracks belong.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#hashCode()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#indexOf(androidx.media3.common.Format)(format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)`

Returns the index in the selection of the track with the specified format.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#indexOf(int)(indexInTrackGroup: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Returns the index in the selection of the track with the specified index in the track group.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#isTrackExcluded(int,long)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, nowMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Returns whether the track at the specified index in the selection is excluded.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#length()()`

Returns the number of tracks in the selection.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#onPlayWhenReadyChanged(boolean)(playWhenReady: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Called to notify when the playback is paused or resumed.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#onPlaybackSpeed(float)(playbackSpeed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`

Called to notify the selection of the current playback speed.
From [androidx.media3.exoplayer.trackselection.ExoTrackSelection](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection#getLatestBitrateEstimate()()`

Returns the most recent bitrate estimate utilised for track selection.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection#onDiscontinuity()()`

Called to notify the selection of a position discontinuity.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection#onRebuffer()()`

Called to notify when a rebuffer occurred.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection#shouldCancelChunkLoad(long,androidx.media3.exoplayer.source.chunk.Chunk,java.util.List<? extends androidx.media3.exoplayer.source.chunk.MediaChunk>)(

playbackPositionUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html,

loadingChunk: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/Chunk!,

queue: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk!>!

)`

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

### Inherited properties

From [androidx.media3.exoplayer.trackselection.BaseTrackSelection](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection) `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#group()`

The selected `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#length()`

The number of selected tracks within the `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#playWhenReady()`

The current value of whether playback will proceed when ready.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#tracks()`

The indices of the selected tracks in `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#group()`, in selection order.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/TrackSelection.Type
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/BaseTrackSelection#type()`

The type of the selection.

## Public constructors

### FixedTrackSelection

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

| Parameters |
|---|---|
| `group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. Must not be null. |
| `track: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the selected track within the `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. |

### FixedTrackSelection

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

| Parameters |
|---|---|
| `group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. Must not be null. |
| `track: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the selected track within the `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/TrackSelection.Type type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The type that will be returned from `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/TrackSelection#getType()`. |

### FixedTrackSelection

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

| Parameters |
|---|---|
| `group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. Must not be null. |
| `track: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the selected track within the `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/TrackSelection.Type type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The type that will be returned from `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/TrackSelection#getType()`. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.SelectionReason reason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | A reason for the track selection. |
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | 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 `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk`s.

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

| Parameters |
|---|---|
| `playbackPositionUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | 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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | 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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The duration of media available for buffering from the current playback position, in microseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if media can be buffered to the end of the current period. Note that if not set to `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()`, the position up to which media is available for buffering can be calculated as `(playbackPositionUs + availableDurationUs)`. |
| `queue: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk!>!` | The queue of already buffered `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk`s. Must not be modified. |
| `mediaChunkIterators: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunkIterator!>!` | An array of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunkIterator`s 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. |