Class TrackSelectionUtil
- java.lang.Object
-
- com.google.android.exoplayer2.trackselection.TrackSelectionUtil
-
public final class TrackSelectionUtil extends Object
Track selection related utility methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TrackSelectionUtil.AdaptiveTrackSelectionFactory
Functional interface to create a single adaptive track selection.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LoadErrorHandlingPolicy.FallbackOptions
createFallbackOptions(ExoTrackSelection trackSelection)
Returns theLoadErrorHandlingPolicy.FallbackOptions
with the tracks of the givenExoTrackSelection
and with a single location option indicating that there are no alternative locations available.static @NullableType ExoTrackSelection[]
createTrackSelectionsForDefinitions(@NullableType ExoTrackSelection.Definition[] definitions, TrackSelectionUtil.AdaptiveTrackSelectionFactory adaptiveTrackSelectionFactory)
Creates track selections for an array of track selection definitions, with at most one multi-track adaptive selection.static DefaultTrackSelector.Parameters
updateParametersWithOverride(DefaultTrackSelector.Parameters parameters, int rendererIndex, TrackGroupArray trackGroupArray, boolean isDisabled, DefaultTrackSelector.SelectionOverride override)
UpdatesDefaultTrackSelector.Parameters
with an override.
-
-
-
Method Detail
-
createTrackSelectionsForDefinitions
public static @NullableType ExoTrackSelection[] createTrackSelectionsForDefinitions(@NullableType ExoTrackSelection.Definition[] definitions, TrackSelectionUtil.AdaptiveTrackSelectionFactory adaptiveTrackSelectionFactory)
Creates track selections for an array of track selection definitions, with at most one multi-track adaptive selection.- Parameters:
definitions
- The list of track selectiondefinitions
. May include null values.adaptiveTrackSelectionFactory
- A factory for the multi-track adaptive track selection.- Returns:
- The array of created track selection. For null entries in
definitions
returns null values.
-
updateParametersWithOverride
public static DefaultTrackSelector.Parameters updateParametersWithOverride(DefaultTrackSelector.Parameters parameters, int rendererIndex, TrackGroupArray trackGroupArray, boolean isDisabled, @Nullable DefaultTrackSelector.SelectionOverride override)
UpdatesDefaultTrackSelector.Parameters
with an override.- Parameters:
parameters
- The currentDefaultTrackSelector.Parameters
to build upon.rendererIndex
- The renderer index to update.trackGroupArray
- TheTrackGroupArray
of the renderer.isDisabled
- Whether the renderer should be set disabled.override
- An optional override for the renderer. If null, no override will be set and an existing override for this renderer will be cleared.- Returns:
- The updated
DefaultTrackSelector.Parameters
.
-
createFallbackOptions
public static LoadErrorHandlingPolicy.FallbackOptions createFallbackOptions(ExoTrackSelection trackSelection)
Returns theLoadErrorHandlingPolicy.FallbackOptions
with the tracks of the givenExoTrackSelection
and with a single location option indicating that there are no alternative locations available.- Parameters:
trackSelection
- The track selection to get the number of total and excluded tracks.- Returns:
- The
LoadErrorHandlingPolicy.FallbackOptions
for the given track selection.
-
-