Interface ExoTrackSelection
-
- All Superinterfaces:
TrackSelection
- All Known Implementing Classes:
AdaptiveTrackSelection,BaseTrackSelection,FakeTrackSelection,FixedTrackSelection,RandomTrackSelection
@Deprecated public interface ExoTrackSelection extends 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.ATrackSelectionthat can change the individually selected track as a result of callingupdateSelectedTrack(long, long, long, List, MediaChunkIterator[])orevaluateQueueSize(long, List). This only happens between calls toenable()anddisable().
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classExoTrackSelection.DefinitionDeprecated.Contains of a subset of selected tracks belonging to aTrackGroup.static interfaceExoTrackSelection.FactoryDeprecated.Factory forExoTrackSelectioninstances.-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.trackselection.TrackSelection
TrackSelection.Type
-
-
Field Summary
-
Fields inherited from interface com.google.android.exoplayer2.trackselection.TrackSelection
TYPE_CUSTOM_BASE, TYPE_UNSET
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voiddisable()Deprecated.Disables this track selection.voidenable()Deprecated.Enables the track selection.intevaluateQueueSize(long playbackPositionUs, List<? extends MediaChunk> queue)Deprecated.Returns the number of chunks that should be retained in the queue.booleanexcludeTrack(int index, long exclusionDurationMs)Deprecated.Attempts to exclude the track at the specified index in the selection, making it ineligible for selection by calls toupdateSelectedTrack(long, long, long, List, MediaChunkIterator[])for the specified period of time.default longgetLatestBitrateEstimate()Deprecated.Returns the most recent bitrate estimate utilised for track selection.FormatgetSelectedFormat()Deprecated.Returns theFormatof the individual selected track.intgetSelectedIndex()Deprecated.Returns the index of the selected track.intgetSelectedIndexInTrackGroup()Deprecated.Returns the index in the track group of the individual selected track.ObjectgetSelectionData()Deprecated.Returns optional data associated with the current track selection.@com.google.android.exoplayer2.C.SelectionReason intgetSelectionReason()Deprecated.Returns the reason for the current track selection.booleanisTrackExcluded(int index, long nowMs)Deprecated.Returns whether the track at the specified index in the selection is excluded.default voidonDiscontinuity()Deprecated.Called to notify the selection of a position discontinuity.voidonPlaybackSpeed(float playbackSpeed)Deprecated.Called to notify the selection of the current playback speed.default voidonPlayWhenReadyChanged(boolean playWhenReady)Deprecated.Called to notify when the playback is paused or resumed.default voidonRebuffer()Deprecated.Called to notify when a rebuffer occurred.default booleanshouldCancelChunkLoad(long playbackPositionUs, Chunk loadingChunk, List<? extends MediaChunk> queue)Deprecated.Returns whether an ongoing load of a chunk should be canceled.voidupdateSelectedTrack(long playbackPositionUs, long bufferedDurationUs, long availableDurationUs, List<? extends MediaChunk> queue, MediaChunkIterator[] mediaChunkIterators)Deprecated.Updates the selected track for sources that load media in discreteMediaChunks.-
Methods inherited from interface com.google.android.exoplayer2.trackselection.TrackSelection
getFormat, getIndexInTrackGroup, getTrackGroup, getType, indexOf, indexOf, length
-
-
-
-
Method Detail
-
enable
void enable()
Deprecated.Enables the track selection. Dynamic changes viaupdateSelectedTrack(long, long, long, List, MediaChunkIterator[]),evaluateQueueSize(long, List)orshouldCancelChunkLoad(long, Chunk, List)will only happen after this call.This method may not be called when the track selection is already enabled.
-
disable
void disable()
Deprecated.Disables this track selection. No further dynamic changes viaupdateSelectedTrack(long, long, long, List, MediaChunkIterator[]),evaluateQueueSize(long, List)orshouldCancelChunkLoad(long, Chunk, List)will happen after this call.This method may only be called when the track selection is already enabled.
-
getSelectedFormat
Format getSelectedFormat()
Deprecated.Returns theFormatof the individual selected track.
-
getSelectedIndexInTrackGroup
int getSelectedIndexInTrackGroup()
Deprecated.Returns the index in the track group of the individual selected track.
-
getSelectedIndex
int getSelectedIndex()
Deprecated.Returns the index of the selected track.
-
getSelectionReason
@com.google.android.exoplayer2.C.SelectionReason int getSelectionReason()
Deprecated.Returns the reason for the current track selection.
-
getSelectionData
@Nullable Object getSelectionData()
Deprecated.Returns optional data associated with the current track selection.
-
onPlaybackSpeed
void onPlaybackSpeed(float playbackSpeed)
Deprecated.Called to notify the selection of the current playback speed. The playback speed may affect adaptive track selection.- Parameters:
playbackSpeed- The factor by which playback is sped up.
-
onDiscontinuity
default void onDiscontinuity()
Deprecated.Called to notify the selection of a position discontinuity.This happens when the playback position jumps, e.g., as a result of a seek being performed.
-
onRebuffer
default void onRebuffer()
Deprecated.Called to notify when a rebuffer occurred.A rebuffer is defined to be caused by buffer depletion rather than a user action. Hence this method is not called during initial buffering or when buffering as a result of a seek operation.
-
onPlayWhenReadyChanged
default void onPlayWhenReadyChanged(boolean playWhenReady)
Deprecated.Called to notify when the playback is paused or resumed.- Parameters:
playWhenReady- Whether playback will proceed when ready.
-
updateSelectedTrack
void updateSelectedTrack(long playbackPositionUs, long bufferedDurationUs, long availableDurationUs, List<? extends MediaChunk> queue, MediaChunkIterator[] mediaChunkIterators)Deprecated.Updates the selected track for sources that load media in discreteMediaChunks.This method will only be called when the selection is enabled.
- Parameters:
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.bufferedDurationUs- 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- The duration of media available for buffering from the current playback position, in microseconds, orC.TIME_UNSETif media can be buffered to the end of the current period. Note that if not set toC.TIME_UNSET, the position up to which media is available for buffering can be calculated as(playbackPositionUs + availableDurationUs).queue- The queue of already bufferedMediaChunks. Must not be modified.mediaChunkIterators- An array ofMediaChunkIterators 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.
-
evaluateQueueSize
int evaluateQueueSize(long playbackPositionUs, List<? extends MediaChunk> queue)Deprecated.Returns the number of chunks that should be retained in the queue.May be called by sources that load media in discrete
MediaChunksand 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
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
MediaChunksin the queue are currently loading.- Parameters:
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 bufferedMediaChunks. Must not be modified.- Returns:
- The number of chunks to retain in the queue.
-
shouldCancelChunkLoad
default boolean shouldCancelChunkLoad(long playbackPositionUs, Chunk loadingChunk, List<? extends MediaChunk> queue)Deprecated.Returns whether an ongoing load of a chunk should be canceled.May be called by sources that load media in discrete
MediaChunksand support canceling the ongoing chunk load. The ongoing chunk load is either the lastMediaChunkin the queue or another type ofChunk, for example, if the source loads initialization or encryption data.To avoid excessive re-buffering, implementations should normally return
false. An example wheretruemight be returned is if a load of a high quality chunk gets stuck and canceling this load in favor of a lower quality alternative may avoid a rebuffer.The source will call
evaluateQueueSize(long, List)after the cancelation finishes to allow discarding of chunks, andupdateSelectedTrack(long, long, long, List, MediaChunkIterator[])before loading a new chunk to allow switching to another quality.This method will only be called when the selection is enabled.
- Parameters:
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.loadingChunk- The currently loadingChunkthat will be canceled if this method returnstrue.queue- The queue of bufferedMediaChunks, including theloadingChunkif it's aMediaChunk. Must not be modified.- Returns:
- Whether the ongoing load of
loadingChunkshould be canceled.
-
excludeTrack
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 toupdateSelectedTrack(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
updateSelectedTrack(long, long, long, List, MediaChunkIterator[]).This method will only be called when the selection is enabled.
- Parameters:
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.
-
isTrackExcluded
boolean isTrackExcluded(int index, long nowMs)Deprecated.Returns whether the track at the specified index in the selection is excluded.- Parameters:
index- The index of the track in the selection.nowMs- The current time in the timebase ofSystemClock.elapsedRealtime().
-
getLatestBitrateEstimate
default long getLatestBitrateEstimate()
Deprecated.Returns the most recent bitrate estimate utilised for track selection.The default behavior is to return
Long.MIN_VALUE, indicating that the bitrate estimate was not computed for the track selection decision.
-
-