# AdaptiveTrackSelection

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/AdaptiveTrackSelection.java+class:androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection)

*** ** * ** ***

<br />

```
@UnstableApi
class AdaptiveTrackSelection : 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.AdaptiveTrackSelection](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection) |

*** ** * ** ***

A bandwidth based adaptive `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection`, whose selected track is updated to be the highest priority track given the current network conditions and the state of the buffer.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection.AdaptationCheckpoint` Checkpoint to determine allocated bandwidth. |
| `class https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection.Factory : https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection.Factory` Factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection` instances. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#DEFAULT_BANDWIDTH_FRACTION() = 0.7f` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE() = 0.75f` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#DEFAULT_MAX_DURATION_FOR_QUALITY_DECREASE_MS() = 25000` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#DEFAULT_MAX_HEIGHT_TO_DISCARD() = 719` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#DEFAULT_MAX_WIDTH_TO_DISCARD() = 1279` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#DEFAULT_MIN_DURATION_FOR_QUALITY_INCREASE_MS() = 10000` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#DEFAULT_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS() = 25000` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#AdaptiveTrackSelection(androidx.media3.common.TrackGroup,int[],androidx.media3.exoplayer.upstream.BandwidthMeter)( group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!, tracks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!, bandwidthMeter: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/BandwidthMeter! )` |

| ### Protected constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#AdaptiveTrackSelection(androidx.media3.common.TrackGroup,int[],int,androidx.media3.exoplayer.upstream.BandwidthMeter,long,long,long,int,int,float,float,java.util.List<androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection.AdaptationCheckpoint>,androidx.media3.common.util.Clock)( group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!, tracks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<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, bandwidthMeter: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/BandwidthMeter!, minDurationForQualityIncreaseMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, maxDurationForQualityDecreaseMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, minDurationToRetainAfterDiscardMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, maxWidthToDiscard: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, maxHeightToDiscard: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, bandwidthFraction: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, bufferedFractionToLiveEdgeForQualityIncrease: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, adaptationCheckpoints: (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/trackselection/AdaptiveTrackSelection.AdaptationCheckpoint!>!, clock: https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock! )` |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#AdaptiveTrackSelection(androidx.media3.common.TrackGroup,int[],int,androidx.media3.exoplayer.upstream.BandwidthMeter,long,long,long,int,int,float,float,java.util.List<androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection.AdaptationCheckpoint>,androidx.media3.common.util.Clock,java.util.Comparator<androidx.media3.common.Format>)( group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!, tracks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<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, bandwidthMeter: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/BandwidthMeter!, minDurationForQualityIncreaseMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, maxDurationForQualityDecreaseMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, minDurationToRetainAfterDiscardMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, maxWidthToDiscard: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, maxHeightToDiscard: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, bandwidthFraction: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, bufferedFractionToLiveEdgeForQualityIncrease: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, adaptationCheckpoints: (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/trackselection/AdaptiveTrackSelection.AdaptationCheckpoint!>!, clock: https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock!, trackFormatComparator: https://developer.android.com/reference/java/util/Comparator.html<https://developer.android.com/reference/kotlin/androidx/media3/common/Format!>! )` |

| ### Public functions |
|---|---|
| `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/AdaptiveTrackSelection#disable()()` Disables this track 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/AdaptiveTrackSelection#enable()()` Enables the track selection. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#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/-any/index.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#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/AdaptiveTrackSelection#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/AdaptiveTrackSelection#onPlaybackSpeed(float)(playbackSpeed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Called to notify the selection of the current playback speed. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#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. |

| ### Protected functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#canSelectFormat(androidx.media3.common.Format,int,long)(format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!, trackBitrate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, effectiveBitrate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Called when updating the selected track to determine whether a candidate track can be selected. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#shouldEvaluateQueueSize(long,java.util.List<? extends androidx.media3.exoplayer.source.chunk.MediaChunk>)(nowMs: 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!>!)` Called from `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#evaluateQueueSize(long,java.util.List<? extends androidx.media3.exoplayer.source.chunk.MediaChunk>)` to determine whether an evaluation should be performed. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#latestBitrateEstimate()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#selectedIndex()` |

| ### Protected properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#minDurationToRetainAfterDiscardUs()` |

### 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/-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/-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.
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/-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.

## Constants

### DEFAULT_BANDWIDTH_FRACTION

```
const val DEFAULT_BANDWIDTH_FRACTION = 0.7f: Float
```

### DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE

```
const val DEFAULT_BUFFERED_FRACTION_TO_LIVE_EDGE_FOR_QUALITY_INCREASE = 0.75f: Float
```

### DEFAULT_MAX_DURATION_FOR_QUALITY_DECREASE_MS

```
const val DEFAULT_MAX_DURATION_FOR_QUALITY_DECREASE_MS = 25000: Int
```

### DEFAULT_MAX_HEIGHT_TO_DISCARD

```
const val DEFAULT_MAX_HEIGHT_TO_DISCARD = 719: Int
```

### DEFAULT_MAX_WIDTH_TO_DISCARD

```
const val DEFAULT_MAX_WIDTH_TO_DISCARD = 1279: Int
```

### DEFAULT_MIN_DURATION_FOR_QUALITY_INCREASE_MS

```
const val DEFAULT_MIN_DURATION_FOR_QUALITY_INCREASE_MS = 10000: Int
```

### DEFAULT_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS

```
const val DEFAULT_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS = 25000: Int
```

## Public constructors

### AdaptiveTrackSelection

```
AdaptiveTrackSelection(
    group: TrackGroup!,
    tracks: IntArray<Int>!,
    bandwidthMeter: BandwidthMeter!
)
```

| Parameters |
|---|---|
| `group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. |
| `tracks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | The indices of the selected tracks within the `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. Must not be empty. May be in any order. |
| `bandwidthMeter: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/BandwidthMeter!` | Provides an estimate of the currently available bandwidth. |

## Protected constructors

### AdaptiveTrackSelection

```
protected AdaptiveTrackSelection(
    group: TrackGroup!,
    tracks: IntArray<Int>!,
    @TrackSelection.Type type: Int,
    bandwidthMeter: BandwidthMeter!,
    minDurationForQualityIncreaseMs: Long,
    maxDurationForQualityDecreaseMs: Long,
    minDurationToRetainAfterDiscardMs: Long,
    maxWidthToDiscard: Int,
    maxHeightToDiscard: Int,
    bandwidthFraction: Float,
    bufferedFractionToLiveEdgeForQualityIncrease: Float,
    adaptationCheckpoints: (Mutable)List<AdaptiveTrackSelection.AdaptationCheckpoint!>!,
    clock: Clock!
)
```

| Parameters |
|---|---|
| `group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. |
| `tracks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | The indices of the selected tracks within the `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. Must not be empty. May be in any order. |
| `@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()`. |
| `bandwidthMeter: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/BandwidthMeter!` | Provides an estimate of the currently available bandwidth. |
| `minDurationForQualityIncreaseMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The minimum duration of buffered data required for the selected track to switch to one of higher quality. |
| `maxDurationForQualityDecreaseMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The maximum duration of buffered data required for the selected track to switch to one of lower quality. |
| `minDurationToRetainAfterDiscardMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | When switching to a video track of higher quality, the selection may indicate that media already buffered at the lower quality can be discarded to speed up the switch. This is the minimum duration of media that must be retained at the lower quality. It must be at least `minDurationForQualityIncreaseMs`. |
| `maxWidthToDiscard: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The maximum video width that the selector may discard from the buffer to speed up switching to a higher quality. |
| `maxHeightToDiscard: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The maximum video height that the selector may discard from the buffer to speed up switching to a higher quality. |
| `bandwidthFraction: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The fraction of the available bandwidth that the selection should consider available for use. Setting to a value less than 1 is recommended to account for inaccuracies in the bandwidth estimator. |
| `bufferedFractionToLiveEdgeForQualityIncrease: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | For live streaming, the fraction of the duration from current playback position to the live edge that has to be buffered before the selected track can be switched to one of higher quality. This parameter is only applied when the playback position is closer to the live edge than ` minDurationForQualityIncreaseMs`, which would otherwise prevent switching to a higher quality from happening. |
| `adaptationCheckpoints: (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/trackselection/AdaptiveTrackSelection.AdaptationCheckpoint!>!` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection.AdaptationCheckpoint` that can be used to calculate available bandwidth for this selection. |
| `clock: https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock`. |

### AdaptiveTrackSelection

```
protected AdaptiveTrackSelection(
    group: TrackGroup!,
    tracks: IntArray<Int>!,
    @TrackSelection.Type type: Int,
    bandwidthMeter: BandwidthMeter!,
    minDurationForQualityIncreaseMs: Long,
    maxDurationForQualityDecreaseMs: Long,
    minDurationToRetainAfterDiscardMs: Long,
    maxWidthToDiscard: Int,
    maxHeightToDiscard: Int,
    bandwidthFraction: Float,
    bufferedFractionToLiveEdgeForQualityIncrease: Float,
    adaptationCheckpoints: (Mutable)List<AdaptiveTrackSelection.AdaptationCheckpoint!>!,
    clock: Clock!,
    trackFormatComparator: Comparator<Format!>!
)
```

| Parameters |
|---|---|
| `group: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. |
| `tracks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | The indices of the selected tracks within the `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackGroup`. Must not be empty. May be in any order. |
| `@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()`. |
| `bandwidthMeter: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/BandwidthMeter!` | Provides an estimate of the currently available bandwidth. |
| `minDurationForQualityIncreaseMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The minimum duration of buffered data required for the selected track to switch to one of higher quality. |
| `maxDurationForQualityDecreaseMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The maximum duration of buffered data required for the selected track to switch to one of lower quality. |
| `minDurationToRetainAfterDiscardMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | When switching to a video track of higher quality, the selection may indicate that media already buffered at the lower quality can be discarded to speed up the switch. This is the minimum duration of media that must be retained at the lower quality. It must be at least `minDurationForQualityIncreaseMs`. |
| `maxWidthToDiscard: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The maximum video width that the selector may discard from the buffer to speed up switching to a higher quality. |
| `maxHeightToDiscard: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The maximum video height that the selector may discard from the buffer to speed up switching to a higher quality. |
| `bandwidthFraction: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The fraction of the available bandwidth that the selection should consider available for use. Setting to a value less than 1 is recommended to account for inaccuracies in the bandwidth estimator. |
| `bufferedFractionToLiveEdgeForQualityIncrease: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | For live streaming, the fraction of the duration from current playback position to the live edge that has to be buffered before the selected track can be switched to one of higher quality. This parameter is only applied when the playback position is closer to the live edge than ` minDurationForQualityIncreaseMs`, which would otherwise prevent switching to a higher quality from happening. |
| `adaptationCheckpoints: (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/trackselection/AdaptiveTrackSelection.AdaptationCheckpoint!>!` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection.AdaptationCheckpoint` that can be used to calculate available bandwidth for this selection. |
| `clock: https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock`. |
| `trackFormatComparator: https://developer.android.com/reference/java/util/Comparator.html<https://developer.android.com/reference/kotlin/androidx/media3/common/Format!>!` | Comparator used to order selected formats. |

## Public functions

### disable

```
@CallSuper
fun disable(): Unit
```

Disables this track selection. No further dynamic changes via `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[])`, `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection#evaluateQueueSize(long,java.util.List<? extends androidx.media3.exoplayer.source.chunk.MediaChunk>)` or `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>)` will happen after this call.

This method may only be called when the track selection is already enabled.

### enable

```
@CallSuper
fun enable(): Unit
```

Enables the track selection. Dynamic changes via `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[])`, `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection#evaluateQueueSize(long,java.util.List<? extends androidx.media3.exoplayer.source.chunk.MediaChunk>)` or `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>)` will only happen after this call.

This method may not be called when the track selection is already enabled.

### evaluateQueueSize

```
fun evaluateQueueSize(
    playbackPositionUs: Long,
    queue: (Mutable)List<MediaChunk!>!
): Int
```

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

May be called by sources that load media in discrete `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk` and support discarding of buffered chunks.

To avoid excessive re-buffering, implementations should normally return the size of the queue. An example of a case where a smaller value may be returned is if network conditions have improved dramatically, allowing chunks to be discarded and re-buffered in a track of significantly higher quality. Discarding chunks may allow faster switching to a higher quality track in this case.

Note that even if the source supports discarding of buffered chunks, the actual number of discarded chunks is not guaranteed. The source will call `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[])` with the updated queue of chunks before loading a new chunk to allow switching to another quality.

This method will only be called when the selection is enabled and none of the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk` in the queue are currently loading.

| 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. |
| `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 buffered `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk`. Must not be modified. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of chunks to retain in the queue. |

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

### onPlaybackSpeed

```
fun onPlaybackSpeed(playbackSpeed: Float): Unit
```

Called to notify the selection of the current playback speed. The playback speed may affect adaptive track selection.

| Parameters |
|---|---|
| `playbackSpeed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The factor by which playback is sped up. |

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

## Protected functions

### canSelectFormat

```
protected fun canSelectFormat(format: Format!, trackBitrate: Int, effectiveBitrate: Long): Boolean
```

Called when updating the selected track to determine whether a candidate track can be selected.

| Parameters |
|---|---|
| `format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` of the candidate track. |
| `trackBitrate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The estimated bitrate of the track. May differ from `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#bitrate()` if a more accurate estimate of the current track bitrate is available. |
| `effectiveBitrate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The bitrate available to this selection. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether this `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` can be selected. |

### shouldEvaluateQueueSize

```
protected fun shouldEvaluateQueueSize(nowMs: Long, queue: (Mutable)List<MediaChunk!>!): Boolean
```

Called from `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection#evaluateQueueSize(long,java.util.List<? extends androidx.media3.exoplayer.source.chunk.MediaChunk>)` to determine whether an evaluation should be performed.

| Parameters |
|---|---|
| `nowMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The current value of `https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock#elapsedRealtime()`. |
| `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 buffered `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/chunk/MediaChunk`. Must not be modified. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether an evaluation should be performed. |

## Public properties

### latestBitrateEstimate

```
val latestBitrateEstimate: Long
```

### selectedIndex

```
val selectedIndex: Int
```

## Protected properties

### minDurationToRetainAfterDiscardUs

```
protected val minDurationToRetainAfterDiscardUs: Long
```