docs/doc/reference/com/google/android/exoplayer2/trackselection/AdaptiveTrackSelection.Factory.html
Package com.google.android.exoplayer2.trackselection
All Implemented Interfaces:ExoTrackSelection.FactoryEnclosing class:AdaptiveTrackSelection
public static classAdaptiveTrackSelection.Factoryextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[ExoTrackSelection.Factory](ExoTrackSelection.Factory.html "interface in com.google.android.exoplayer2.trackselection")
Factory for AdaptiveTrackSelection instances.
Constructors | Constructor | Description |
| --- | --- |
| Factory() |
Creates an adaptive track selection factory with default parameters.
|
| Factory(int minDurationForQualityIncreaseMs, int maxDurationForQualityDecreaseMs, int minDurationToRetainAfterDiscardMs, float bandwidthFraction) |
Creates an adaptive track selection factory.
|
| Factory(int minDurationForQualityIncreaseMs, int maxDurationForQualityDecreaseMs, int minDurationToRetainAfterDiscardMs, float bandwidthFraction, float bufferedFractionToLiveEdgeForQualityIncrease, Clock clock) |
Creates an adaptive track selection factory.
|
| Factory(int minDurationForQualityIncreaseMs, int maxDurationForQualityDecreaseMs, int minDurationToRetainAfterDiscardMs, int maxWidthToDiscard, int maxHeightToDiscard, float bandwidthFraction) |
Creates an adaptive track selection factory.
|
| Factory(int minDurationForQualityIncreaseMs, int maxDurationForQualityDecreaseMs, int minDurationToRetainAfterDiscardMs, int maxWidthToDiscard, int maxHeightToDiscard, float bandwidthFraction, float bufferedFractionToLiveEdgeForQualityIncrease, Clock clock) |
Creates an adaptive track selection factory.
|
All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| protected AdaptiveTrackSelection | createAdaptiveTrackSelection(TrackGroup group, int[] tracks, int type, BandwidthMeter bandwidthMeter, ImmutableList<AdaptiveTrackSelection.AdaptationCheckpoint> adaptationCheckpoints) |
Creates a single adaptive selection for the given group, bandwidth meter and tracks.
|
| @NullableType ExoTrackSelection[] | createTrackSelections(@NullableType ExoTrackSelection.Definition[] definitions, BandwidthMeter bandwidthMeter, MediaSource.MediaPeriodId mediaPeriodId, Timeline timeline) |
Creates track selections for the provided Definitions.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public Factory()
Creates an adaptive track selection factory with default parameters.
-
public Factory(int minDurationForQualityIncreaseMs,
int maxDurationForQualityDecreaseMs,
int minDurationToRetainAfterDiscardMs,
float bandwidthFraction)
Creates an adaptive track selection factory.
Parameters:minDurationForQualityIncreaseMs - The minimum duration of buffered data required for the selected track to switch to one of higher quality.maxDurationForQualityDecreaseMs - The maximum duration of buffered data required for the selected track to switch to one of lower quality.minDurationToRetainAfterDiscardMs - 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.bandwidthFraction - 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.
-
public Factory(int minDurationForQualityIncreaseMs,
int maxDurationForQualityDecreaseMs,
int minDurationToRetainAfterDiscardMs,
int maxWidthToDiscard,
int maxHeightToDiscard,
float bandwidthFraction)
Creates an adaptive track selection factory.
Parameters:minDurationForQualityIncreaseMs - The minimum duration of buffered data required for the selected track to switch to one of higher quality.maxDurationForQualityDecreaseMs - The maximum duration of buffered data required for the selected track to switch to one of lower quality.minDurationToRetainAfterDiscardMs - 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 - The maximum video width that the selector may discard from the buffer to speed up switching to a higher quality.maxHeightToDiscard - The maximum video height that the selector may discard from the buffer to speed up switching to a higher quality.bandwidthFraction - 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.
-
public Factory(int minDurationForQualityIncreaseMs,
int maxDurationForQualityDecreaseMs,
int minDurationToRetainAfterDiscardMs,
float bandwidthFraction,
float bufferedFractionToLiveEdgeForQualityIncrease,[Clock](../util/Clock.html "interface in com.google.android.exoplayer2.util")clock)
Creates an adaptive track selection factory.
Parameters:minDurationForQualityIncreaseMs - The minimum duration of buffered data required for the selected track to switch to one of higher quality.maxDurationForQualityDecreaseMs - The maximum duration of buffered data required for the selected track to switch to one of lower quality.minDurationToRetainAfterDiscardMs - 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.bandwidthFraction - 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 - 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.clock - A Clock.
-
public Factory(int minDurationForQualityIncreaseMs,
int maxDurationForQualityDecreaseMs,
int minDurationToRetainAfterDiscardMs,
int maxWidthToDiscard,
int maxHeightToDiscard,
float bandwidthFraction,
float bufferedFractionToLiveEdgeForQualityIncrease,[Clock](../util/Clock.html "interface in com.google.android.exoplayer2.util")clock)
Creates an adaptive track selection factory.
Parameters:minDurationForQualityIncreaseMs - The minimum duration of buffered data required for the selected track to switch to one of higher quality.maxDurationForQualityDecreaseMs - The maximum duration of buffered data required for the selected track to switch to one of lower quality.minDurationToRetainAfterDiscardMs - 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 - The maximum video width that the selector may discard from the buffer to speed up switching to a higher quality.maxHeightToDiscard - The maximum video height that the selector may discard from the buffer to speed up switching to a higher quality.bandwidthFraction - 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 - 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.clock - A Clock.
-
public final @NullableType[ExoTrackSelection](ExoTrackSelection.html "interface in com.google.android.exoplayer2.trackselection")[] createTrackSelections(@NullableType[ExoTrackSelection.Definition](ExoTrackSelection.Definition.html "class in com.google.android.exoplayer2.trackselection")[] definitions,[BandwidthMeter](../upstream/BandwidthMeter.html "interface in com.google.android.exoplayer2.upstream")bandwidthMeter,[MediaSource.MediaPeriodId](../source/MediaSource.MediaPeriodId.html "class in com.google.android.exoplayer2.source")mediaPeriodId,[Timeline](../Timeline.html "class in com.google.android.exoplayer2")timeline)
Description copied from interface: ExoTrackSelection.Factory
Creates track selections for the provided Definitions.
Implementations that create at most one adaptive track selection may use TrackSelectionUtil.createTrackSelectionsForDefinitions(com.google.android.exoplayer2.trackselection.ExoTrackSelection.Definition[], com.google.android.exoplayer2.trackselection.TrackSelectionUtil.AdaptiveTrackSelectionFactory).
Specified by:createTrackSelections in interface ExoTrackSelection.FactoryParameters:definitions - A ExoTrackSelection.Definition array. May include null values.bandwidthMeter - A BandwidthMeter which can be used to select tracks.mediaPeriodId - The MediaSource.MediaPeriodId of the period for which tracks are to be selected.timeline - The Timeline holding the period for which tracks are to be selected.Returns:The created selections. Must have the same length as definitions and may include null values.
-
protected[AdaptiveTrackSelection](AdaptiveTrackSelection.html "class in com.google.android.exoplayer2.trackselection")createAdaptiveTrackSelection([TrackGroup](../source/TrackGroup.html "class in com.google.android.exoplayer2.source")group,
int[] tracks,
int type,[BandwidthMeter](../upstream/BandwidthMeter.html "interface in com.google.android.exoplayer2.upstream")bandwidthMeter,[ImmutableList](https://guava.dev/releases/31.1-android/api/docs/com/google/common/collect/ImmutableList.html?is-external=true "class or interface in com.google.common.collect")<[AdaptiveTrackSelection.AdaptationCheckpoint](AdaptiveTrackSelection.AdaptationCheckpoint.html "class in com.google.android.exoplayer2.trackselection")> adaptationCheckpoints)
Creates a single adaptive selection for the given group, bandwidth meter and tracks.
Parameters:group - The TrackGroup.tracks - The indices of the selected tracks in the track group.type - The type that will be returned from TrackSelection.getType().bandwidthMeter - A BandwidthMeter which can be used to select tracks.adaptationCheckpoints - The checkpoints that can be used to calculate available bandwidth for this selection.Returns:An AdaptiveTrackSelection for the specified tracks.