docs/doc/reference/com/google/android/exoplayer2/trackselection/BaseTrackSelection.html
Package com.google.android.exoplayer2.trackselection
All Implemented Interfaces:ExoTrackSelection, TrackSelectionDirect Known Subclasses:AdaptiveTrackSelection, FixedTrackSelection, RandomTrackSelection
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public abstract classBaseTrackSelectionextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[ExoTrackSelection](ExoTrackSelection.html "interface in com.google.android.exoplayer2.trackselection")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
An abstract base class suitable for most ExoTrackSelection implementations.
-
ExoTrackSelection.Definition, ExoTrackSelection.Factory
-
TrackSelection.Type
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| protected TrackGroup | group |
Deprecated.
The selected TrackGroup.
|
| protected int | length |
Deprecated.
The number of selected tracks within the TrackGroup.
|
| protected int[] | tracks |
Deprecated.
The indices of the selected tracks in group, in order of decreasing bandwidth.
|
-
TYPE_CUSTOM_BASE, TYPE_UNSET
Constructors | Constructor | Description |
| --- | --- |
| BaseTrackSelection(TrackGroup group, int... tracks) |
Deprecated.
|
| BaseTrackSelection(TrackGroup group, int[] tracks, @com.google.android.exoplayer2.trackselection.TrackSelection.Type int type) |
Deprecated.
|
All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | disable() |
Deprecated.
Disables this track selection.
|
| void | enable() |
Deprecated.
Enables the track selection.
|
| boolean | equals(Object obj) |
Deprecated.
|
| int | evaluateQueueSize(long playbackPositionUs, List<? extends MediaChunk> queue) |
Deprecated.
Returns the number of chunks that should be retained in the queue.
|
| boolean | excludeTrack(int index, long exclusionDurationMs) |
Deprecated.
Attempts to exclude the track at the specified index in the selection, making it ineligible for selection by calls to ExoTrackSelection.updateSelectedTrack(long, long, long, List, MediaChunkIterator[]) for the specified period of time.
|
| Format | getFormat(int index) |
Deprecated.
Returns the format of the track at a given index in the selection.
|
| int | getIndexInTrackGroup(int index) |
Deprecated.
Returns the index in the track group of the track at a given index in the selection.
|
| Format | getSelectedFormat() |
Deprecated.
Returns the Format of the individual selected track.
|
| int | getSelectedIndexInTrackGroup() |
Deprecated.
Returns the index in the track group of the individual selected track.
|
| TrackGroup | getTrackGroup() |
Deprecated.
Returns the TrackGroup to which the selected tracks belong.
|
| int | getType() |
Deprecated.
Returns an integer specifying the type of the selection, or TrackSelection.TYPE_UNSET if not specified.
|
| int | hashCode() |
Deprecated.
|
| int | indexOf(int indexInTrackGroup) |
Deprecated.
Returns the index in the selection of the track with the specified index in the track group.
|
| int | indexOf(Format format) |
Deprecated.
Returns the index in the selection of the track with the specified format.
|
| boolean | isTrackExcluded(int index, long nowMs) |
Deprecated.
Returns whether the track at the specified index in the selection is excluded.
|
| int | length() |
Deprecated.
Returns the number of tracks in the selection.
|
| void | onPlaybackSpeed(float playbackSpeed) |
Deprecated.
Called to notify the selection of the current playback speed. |
-
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
getLatestBitrateEstimate, getSelectedIndex, getSelectionData, getSelectionReason, onDiscontinuity, onPlayWhenReadyChanged, onRebuffer, shouldCancelChunkLoad, updateSelectedTrack
-
protected final[TrackGroup](../source/TrackGroup.html "class in com.google.android.exoplayer2.source")group
Deprecated.
The selected TrackGroup.
-
protected final int length
Deprecated.
The number of selected tracks within the TrackGroup. Always greater than zero.
-
protected final int[] tracks
Deprecated.
The indices of the selected tracks in group, in order of decreasing bandwidth.
-
public BaseTrackSelection([TrackGroup](../source/TrackGroup.html "class in com.google.android.exoplayer2.source")group,
int... tracks)
Deprecated.
Parameters:group - The TrackGroup. Must not be null.tracks - The indices of the selected tracks within the TrackGroup. Must not be null or empty. May be in any order.
-
public BaseTrackSelection([TrackGroup](../source/TrackGroup.html "class in com.google.android.exoplayer2.source")group,
int[] tracks,
@com.google.android.exoplayer2.trackselection.TrackSelection.Type int type)
Deprecated.
Parameters:group - The TrackGroup. Must not be null.tracks - The indices of the selected tracks within the TrackGroup. Must not be null or empty. May be in any order.type - The type that will be returned from TrackSelection.getType().
-
public final int getType()
Deprecated.
Description copied from interface: TrackSelection
Returns an integer specifying the type of the selection, or TrackSelection.TYPE_UNSET if not specified.
Track selection types are specific to individual applications, but should be defined starting from TrackSelection.TYPE_CUSTOM_BASE to ensure they don't conflict with any types that may be added to the library in the future.
Specified by:getType in interface TrackSelection
-
public final[TrackGroup](../source/TrackGroup.html "class in com.google.android.exoplayer2.source")getTrackGroup()
Deprecated.
Description copied from interface: TrackSelection
Returns the TrackGroup to which the selected tracks belong.
Specified by:getTrackGroup in interface TrackSelection
-
public final int length()
Deprecated.
Description copied from interface: TrackSelection
Returns the number of tracks in the selection.
Specified by:length in interface TrackSelection
-
public final[Format](../Format.html "class in com.google.android.exoplayer2")getFormat(int index)
Deprecated.
Description copied from interface: TrackSelection
Returns the format of the track at a given index in the selection.
Specified by:getFormat in interface TrackSelectionParameters:index - The index in the selection.Returns:The format of the selected track.
-
public final int getIndexInTrackGroup(int index)
Deprecated.
Description copied from interface: TrackSelection
Returns the index in the track group of the track at a given index in the selection.
Specified by:getIndexInTrackGroup in interface TrackSelectionParameters:index - The index in the selection.Returns:The index of the selected track.
-
public final int indexOf([Format](../Format.html "class in com.google.android.exoplayer2")format)
Deprecated.
Description copied from interface: TrackSelection
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.
Specified by:indexOf in interface TrackSelectionParameters:format - The format.Returns:The index in the selection, or C.INDEX_UNSET if the track with the specified format is not part of the selection.
-
public final int indexOf(int indexInTrackGroup)
Deprecated.
Description copied from interface: TrackSelection
Returns the index in the selection of the track with the specified index in the track group.
Specified by:indexOf in interface TrackSelectionParameters:indexInTrackGroup - The index in the track group.Returns:The index in the selection, or C.INDEX_UNSET if the track with the specified index is not part of the selection.
-
public final[Format](../Format.html "class in com.google.android.exoplayer2")getSelectedFormat()
Deprecated.
Description copied from interface: ExoTrackSelection
Returns the Format of the individual selected track.
Specified by:getSelectedFormat in interface ExoTrackSelection
-
public final int getSelectedIndexInTrackGroup()
Deprecated.
Description copied from interface: ExoTrackSelection
Returns the index in the track group of the individual selected track.
Specified by:getSelectedIndexInTrackGroup in interface ExoTrackSelection
-
public void enable()
Deprecated.
Description copied from interface: ExoTrackSelection
Enables the track selection. Dynamic changes via ExoTrackSelection.updateSelectedTrack(long, long, long, List, MediaChunkIterator[]), ExoTrackSelection.evaluateQueueSize(long, List) or ExoTrackSelection.shouldCancelChunkLoad(long, Chunk, List) will only happen after this call.
This method may not be called when the track selection is already enabled.
Specified by:enable in interface ExoTrackSelection
-
public void disable()
Deprecated.
Description copied from interface: ExoTrackSelection
Disables this track selection. No further dynamic changes via ExoTrackSelection.updateSelectedTrack(long, long, long, List, MediaChunkIterator[]), ExoTrackSelection.evaluateQueueSize(long, List) or ExoTrackSelection.shouldCancelChunkLoad(long, Chunk, List) will happen after this call.
This method may only be called when the track selection is already enabled.
Specified by:disable in interface ExoTrackSelection
-
public void onPlaybackSpeed(float playbackSpeed)
Deprecated.
Description copied from interface: ExoTrackSelection
Called to notify the selection of the current playback speed. The playback speed may affect adaptive track selection.
Specified by:onPlaybackSpeed in interface ExoTrackSelectionParameters:playbackSpeed - The factor by which playback is sped up.
-
public int evaluateQueueSize(long playbackPositionUs,[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<? extends[MediaChunk](../source/chunk/MediaChunk.html "class in com.google.android.exoplayer2.source.chunk")> queue)
Deprecated.
Description copied from interface: ExoTrackSelection
Returns the number of chunks that should be retained in the queue.
May be called by sources that load media in discrete MediaChunks 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 ExoTrackSelection.updateSelectedTrack(long, long, long, List, 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 MediaChunks in the queue are currently loading.
Specified by:evaluateQueueSize in interface ExoTrackSelectionParameters:playbackPositionUs - 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 - The queue of buffered MediaChunks. Must not be modified.Returns:The number of chunks to retain in the queue.
-
public boolean excludeTrack(int index,
long exclusionDurationMs)
Deprecated.
Description copied from interface: ExoTrackSelection
Attempts to exclude the track at the specified index in the selection, making it ineligible for selection by calls to ExoTrackSelection.updateSelectedTrack(long, long, long, List, MediaChunkIterator[]) for the specified period of time.
Exclusion will fail if all other tracks are currently excluded. If excluding the currently selected track, note that it will remain selected until the next call to ExoTrackSelection.updateSelectedTrack(long, long, long, List, MediaChunkIterator[]).
This method will only be called when the selection is enabled.
Specified by:excludeTrack in interface ExoTrackSelectionParameters:index - The index of the track in the selection.exclusionDurationMs - The duration of time for which the track should be excluded, in milliseconds.Returns:Whether exclusion was successful.
-
public boolean isTrackExcluded(int index,
long nowMs)
Deprecated.
Description copied from interface: ExoTrackSelection
Returns whether the track at the specified index in the selection is excluded.
Specified by:isTrackExcluded in interface ExoTrackSelectionParameters:index - The index of the track in the selection.nowMs - The current time in the timebase of SystemClock.elapsedRealtime().
-
public int hashCode()
Deprecated.
Overrides:hashCode in class Object
-
public boolean equals(@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")obj)
Deprecated.
Overrides:equals in class Object