TrackSelectionParameters.Builder


public class TrackSelectionParameters.Builder


A builder for TrackSelectionParameters. See the TrackSelectionParameters documentation for explanations of the parameters that can be configured using this builder.

Summary

Public constructors

Creates a builder with default initial values.

@InlineMe(replacement = "this()")
Builder(Context context)

This method is deprecated.

Use Builder instead.

Protected constructors

Creates a builder with the initial values specified in bundle.

Creates a builder with the initial values specified in initialValues.

Public methods

TrackSelectionParameters.Builder

Adds an override, replacing any override for the same TrackGroup.

TrackSelectionParameters

Builds a TrackSelectionParameters instance with the selected values.

TrackSelectionParameters.Builder

Removes the override for the provided media TrackGroup, if there is one.

TrackSelectionParameters.Builder

Removes all overrides.

TrackSelectionParameters.Builder

Removes all overrides of the provided track type.

TrackSelectionParameters.Builder

Equivalent to setMaxVideoSize(Integer.MAX_VALUE, Integer.MAX_VALUE).

TrackSelectionParameters.Builder

Equivalent to setViewportSize(Integer.MAX_VALUE, Integer.MAX_VALUE, true).

TrackSelectionParameters.Builder

Sets the audio offload mode preferences.

TrackSelectionParameters.Builder

Sets the disabled track types, preventing all tracks of those types from being selected for playback.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setForceHighestSupportedBitrate(boolean forceHighestSupportedBitrate)

Sets whether to force selection of the highest bitrate audio and video tracks that comply with all other constraints.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setForceLowestBitrate(boolean forceLowestBitrate)

Sets whether to force selection of the single lowest bitrate audio and video tracks that comply with all other constraints.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setIgnoredTextSelectionFlags(
    @C.SelectionFlags int ignoredTextSelectionFlags
)

Sets a bitmask of selection flags that are ignored for text track selections.

TrackSelectionParameters.Builder

Sets the maximum allowed audio bitrate.

TrackSelectionParameters.Builder

Sets the maximum allowed audio channel count.

TrackSelectionParameters.Builder

Sets the maximum allowed video bitrate.

TrackSelectionParameters.Builder

Sets the maximum allowed video frame rate.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setMaxVideoSize(int maxVideoWidth, int maxVideoHeight)

Sets the maximum allowed video width and height.

TrackSelectionParameters.Builder

Equivalent to setMaxVideoSize(1279, 719).

TrackSelectionParameters.Builder

Sets the minimum allowed video bitrate.

TrackSelectionParameters.Builder

Sets the minimum allowed video frame rate.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setMinVideoSize(int minVideoWidth, int minVideoHeight)

Sets the minimum allowed video width and height.

TrackSelectionParameters.Builder

Sets an override, replacing all existing overrides with the same track type.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setPreferredAudioLabels(String[] preferredAudioLabels)

Sets the preferred labels for audio tracks.

TrackSelectionParameters.Builder
setPreferredAudioLanguage(@Nullable String preferredAudioLanguage)

Sets the preferred language for audio and forced text tracks.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setPreferredAudioLanguages(String[] preferredAudioLanguages)

Sets the preferred languages for audio and forced text tracks.

TrackSelectionParameters.Builder

Sets the preferred sample MIME type for audio tracks.

TrackSelectionParameters.Builder

Sets the preferred sample MIME types for audio tracks.

TrackSelectionParameters.Builder

Sets the preferred C.RoleFlags for audio tracks.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setPreferredTextLabels(String[] preferredTextLabels)

Sets the preferred labels for text tracks.

TrackSelectionParameters.Builder
setPreferredTextLanguage(@Nullable String preferredTextLanguage)

Sets the preferred language for text tracks.

TrackSelectionParameters.Builder

Sets whether the preferred languages and the preferred role flags for text tracks should be set according the CaptioningManager preferences, if enabled in the system settings and no other explicit language or role flag preferences are specified.

TrackSelectionParameters.Builder

This method is deprecated.

Use setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings instead.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setPreferredTextLanguages(String[] preferredTextLanguages)

Sets the preferred languages for text tracks.

TrackSelectionParameters.Builder

Sets the preferred C.RoleFlags for text tracks.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setPreferredVideoLabels(String[] preferredVideoLabels)

Sets the preferred labels for video tracks.

TrackSelectionParameters.Builder

Sets the preferred language for video tracks.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setPreferredVideoLanguages(String[] preferredVideoLanguages)

Sets the preferred languages for video tracks.

TrackSelectionParameters.Builder

Sets the preferred sample MIME type for video tracks.

TrackSelectionParameters.Builder

Sets the preferred sample MIME types for video tracks.

TrackSelectionParameters.Builder

Sets the preferred C.RoleFlags for video tracks.

TrackSelectionParameters.Builder
@UnstableApi
@CanIgnoreReturnValue
setPrioritizeImageOverVideoEnabled(
    boolean isPrioritizeImageOverVideoEnabled
)

Sets whether an image track would be selected over a video track if both are available.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setSelectTextByDefault(boolean selectTextByDefault)

Sets whether to prefer to select any text track by default.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setSelectUndeterminedTextLanguage(
    boolean selectUndeterminedTextLanguage
)

Sets whether a text track with undetermined language should be selected if no track with a preferred language is available, or if the preferred language is unset.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setTrackTypeDisabled(@C.TrackType int trackType, boolean disabled)

Sets whether a track type is disabled.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setViewportSize(
    int viewportWidth,
    int viewportHeight,
    boolean viewportOrientationMayChange
)

Sets the viewport size to constrain adaptive video selections so that only tracks suitable for the viewport are selected.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setViewportSizeToPhysicalDisplaySize(
    boolean viewportOrientationMayChange
)

Sets whether the viewport size should be assumed to the physical display size if no other specific viewport size constraint is specified.

TrackSelectionParameters.Builder
@CanIgnoreReturnValue
setViewportSizeToPhysicalDisplaySize(
    Context context,
    boolean viewportOrientationMayChange
)

This method is deprecated.

Use setViewportSizeToPhysicalDisplaySize instead.

Protected methods

TrackSelectionParameters.Builder

Overrides the value of the builder with the value of TrackSelectionParameters.

Public constructors

Builder

public Builder()

Creates a builder with default initial values.

Builder

@InlineMe(replacement = "this()")
public Builder(Context context)

Protected constructors

Builder

@UnstableApi
protected Builder(Bundle bundle)

Creates a builder with the initial values specified in bundle.

Builder

@UnstableApi
protected Builder(TrackSelectionParameters initialValues)

Creates a builder with the initial values specified in initialValues.

Public methods

addOverride

@CanIgnoreReturnValue
public TrackSelectionParameters.Builder addOverride(TrackSelectionOverride override)

Adds an override, replacing any override for the same TrackGroup.

build

public TrackSelectionParameters build()

Builds a TrackSelectionParameters instance with the selected values.

clearOverride

@CanIgnoreReturnValue
public TrackSelectionParameters.Builder clearOverride(TrackGroup mediaTrackGroup)

Removes the override for the provided media TrackGroup, if there is one.

clearOverrides

@CanIgnoreReturnValue
public TrackSelectionParameters.Builder clearOverrides()

Removes all overrides.

clearOverridesOfType

@CanIgnoreReturnValue
public TrackSelectionParameters.Builder clearOverridesOfType(@C.TrackType int trackType)

Removes all overrides of the provided track type.

setAudioOffloadPreferences

@UnstableApi
@CanIgnoreReturnValue
public TrackSelectionParameters.Builder setAudioOffloadPreferences(
    TrackSelectionParameters.AudioOffloadPreferences audioOffloadPreferences
)

Sets the audio offload mode preferences. This includes whether to enable/disable offload as well as to set requirements like if the device must support gapless transitions or speed change during offload.

setDisabledTrackTypes

@CanIgnoreReturnValue
@UnstableApi
public TrackSelectionParameters.Builder setDisabledTrackTypes(Set<@C.TrackType Integer> disabledTrackTypes)

Sets the disabled track types, preventing all tracks of those types from being selected for playback. Any previously disabled track types are cleared.

Parameters
Set<@C.TrackType Integer> disabledTrackTypes

The track types to disable.

Returns
TrackSelectionParameters.Builder

This builder.

setForceHighestSupportedBitrate

@CanIgnoreReturnValue
public TrackSelectionParameters.Builder setForceHighestSupportedBitrate(boolean forceHighestSupportedBitrate)

Sets whether to