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 interfaceTrackSelectionUtil.AdaptiveTrackSelectionFactoryFunctional interface to create a single adaptive track selection.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LoadErrorHandlingPolicy.FallbackOptionscreateFallbackOptions(ExoTrackSelection trackSelection)Returns theLoadErrorHandlingPolicy.FallbackOptionswith the tracks of the givenExoTrackSelectionand 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.ParametersupdateParametersWithOverride(DefaultTrackSelector.Parameters parameters, int rendererIndex, TrackGroupArray trackGroupArray, boolean isDisabled, DefaultTrackSelector.SelectionOverride override)UpdatesDefaultTrackSelector.Parameterswith 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
definitionsreturns null values.
-
updateParametersWithOverride
public static DefaultTrackSelector.Parameters updateParametersWithOverride(DefaultTrackSelector.Parameters parameters, int rendererIndex, TrackGroupArray trackGroupArray, boolean isDisabled, @Nullable DefaultTrackSelector.SelectionOverride override)
UpdatesDefaultTrackSelector.Parameterswith an override.- Parameters:
parameters- The currentDefaultTrackSelector.Parametersto build upon.rendererIndex- The renderer index to update.trackGroupArray- TheTrackGroupArrayof 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.FallbackOptionswith the tracks of the givenExoTrackSelectionand 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.FallbackOptionsfor the given track selection.
-
-