DefaultTrackSelector.ParametersBuilder


public final class DefaultTrackSelector.ParametersBuilder extends TrackSelectionParameters.Builder


Summary

Public constructors

Creates a builder with default initial values.

Creates a builder with default initial values.

Public methods

DefaultTrackSelector.ParametersBuilder

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

DefaultTrackSelector.Parameters

Builds a Parameters instance with the selected values.

DefaultTrackSelector.ParametersBuilder

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

DefaultTrackSelector.ParametersBuilder

Removes all overrides.

DefaultTrackSelector.ParametersBuilder

Removes all overrides of the provided track type.

DefaultTrackSelector.ParametersBuilder

This method is deprecated.

Use clearOverride.

DefaultTrackSelector.ParametersBuilder

This method is deprecated.

Use clearOverrides.

DefaultTrackSelector.ParametersBuilder

This method is deprecated.

Use clearOverridesOfType.

DefaultTrackSelector.ParametersBuilder

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

DefaultTrackSelector.ParametersBuilder

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

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setAllowAudioMixedChannelCountAdaptiveness(
    boolean allowAudioMixedChannelCountAdaptiveness
)

Sets whether to allow adaptive audio selections containing mixed channel counts.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setAllowAudioMixedDecoderSupportAdaptiveness(
    boolean allowAudioMixedDecoderSupportAdaptiveness
)

Sets whether to allow adaptive audio selections with mixed levels of and .

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setAllowAudioMixedMimeTypeAdaptiveness(
    boolean allowAudioMixedMimeTypeAdaptiveness
)

Sets whether to allow adaptive audio selections containing mixed MIME types.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setAllowAudioMixedSampleRateAdaptiveness(
    boolean allowAudioMixedSampleRateAdaptiveness
)

Sets whether to allow adaptive audio selections containing mixed sample rates.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setAllowMultipleAdaptiveSelections(
    boolean allowMultipleAdaptiveSelections
)

Sets whether multiple adaptive selections with more than one track are allowed.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setAllowVideoMixedDecoderSupportAdaptiveness(
    boolean allowVideoMixedDecoderSupportAdaptiveness
)

Sets whether to allow adaptive video selections with mixed levels of and .

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setAllowVideoMixedMimeTypeAdaptiveness(
    boolean allowVideoMixedMimeTypeAdaptiveness
)

Sets whether to allow adaptive video selections containing mixed MIME types.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setAllowVideoNonSeamlessAdaptiveness(
    boolean allowVideoNonSeamlessAdaptiveness
)

Sets whether to allow adaptive video selections where adaptation may not be completely seamless.

DefaultTrackSelector.ParametersBuilder

Sets the audio offload mode preferences.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setDisabledTextTrackSelectionFlags(
    @C.SelectionFlags int disabledTextTrackSelectionFlags
)

This method is deprecated.

Use setIgnoredTextSelectionFlags.

DefaultTrackSelector.ParametersBuilder

This method is deprecated.

Use setTrackTypeDisabled.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setExceedAudioConstraintsIfNecessary(
    boolean exceedAudioConstraintsIfNecessary
)

Sets whether to exceed the setMaxAudioChannelCount and setMaxAudioBitrate constraints when no selection can be made otherwise.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setExceedRendererCapabilitiesIfNecessary(
    boolean exceedRendererCapabilitiesIfNecessary
)

Sets whether to exceed renderer capabilities when no selection can be made otherwise.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setExceedVideoConstraintsIfNecessary(
    boolean exceedVideoConstraintsIfNecessary
)

Sets whether to exceed the setMaxVideoBitrate, setMaxVideoSize and setMaxVideoFrameRate constraints when no selection can be made otherwise.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setForceHighestSupportedBitrate(boolean forceHighestSupportedBitrate)

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

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setForceLowestBitrate(boolean forceLowestBitrate)

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

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setIgnoredTextSelectionFlags(
    @C.SelectionFlags int ignoredTextSelectionFlags
)

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

DefaultTrackSelector.ParametersBuilder

Sets the maximum allowed audio bitrate.

DefaultTrackSelector.ParametersBuilder

Sets the maximum allowed audio channel count.

DefaultTrackSelector.ParametersBuilder

Sets the maximum allowed video bitrate.

DefaultTrackSelector.ParametersBuilder

Sets the maximum allowed video frame rate.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setMaxVideoSize(int maxVideoWidth, int maxVideoHeight)

Sets the maximum allowed video width and height.

DefaultTrackSelector.ParametersBuilder

Equivalent to setMaxVideoSize(1279, 719).

DefaultTrackSelector.ParametersBuilder

Sets the minimum allowed video bitrate.

DefaultTrackSelector.ParametersBuilder

Sets the minimum allowed video frame rate.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setMinVideoSize(int minVideoWidth, int minVideoHeight)

Sets the minimum allowed video width and height.

DefaultTrackSelector.ParametersBuilder

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

DefaultTrackSelector.ParametersBuilder

Sets the preferred language for audio and forced text tracks.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setPreferredAudioLanguages(String[] preferredAudioLanguages)

Sets the preferred languages for audio and forced text tracks.

DefaultTrackSelector.ParametersBuilder

Sets the preferred sample MIME type for audio tracks.

DefaultTrackSelector.ParametersBuilder

Sets the preferred sample MIME types for audio tracks.

DefaultTrackSelector.ParametersBuilder

Sets the preferred C.RoleFlags for audio tracks.

DefaultTrackSelector.ParametersBuilder

Sets the preferred language for text tracks.

DefaultTrackSelector.ParametersBuilder

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.

DefaultTrackSelector.ParametersBuilder

This method is deprecated.

Use setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings instead.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setPreferredTextLanguages(String[] preferredTextLanguages)

Sets the preferred languages for text tracks.

DefaultTrackSelector.ParametersBuilder

Sets the preferred C.RoleFlags for text tracks.

DefaultTrackSelector.ParametersBuilder

Sets the preferred language for video tracks.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setPreferredVideoLanguages(String[] preferredVideoLanguages)

Sets the preferred languages for video tracks.

DefaultTrackSelector.ParametersBuilder

Sets the preferred sample MIME type for video tracks.

DefaultTrackSelector.ParametersBuilder

Sets the preferred sample MIME types for video tracks.

DefaultTrackSelector.ParametersBuilder

Sets the preferred C.RoleFlags for video tracks.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setPrioritizeImageOverVideoEnabled(
    boolean isPrioritizeImageOverVideoEnabled
)

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

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setRendererDisabled(int rendererIndex, boolean disabled)

Sets whether the renderer at the specified index is disabled.

DefaultTrackSelector.ParametersBuilder
@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.

DefaultTrackSelector.ParametersBuilder

This method is deprecated.

Use addOverride.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setTrackTypeDisabled(@C.TrackType int trackType, boolean disabled)

Sets whether a track type is disabled.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setTunnelingEnabled(boolean tunnelingEnabled)

Sets whether to enable tunneling if possible.

DefaultTrackSelector.ParametersBuilder
@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.

DefaultTrackSelector.ParametersBuilder
@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.

DefaultTrackSelector.ParametersBuilder
@CanIgnoreReturnValue
setViewportSizeToPhysicalDisplaySize(
    Context context,
    boolean viewportOrientationMayChange
)

This method is deprecated.

Use setViewportSizeToPhysicalDisplaySize instead.

Protected methods

DefaultTrackSelector.ParametersBuilder

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

Public constructors

ParametersBuilder

public ParametersBuilder()

Creates a builder with default initial values.

ParametersBuilder

public ParametersBuilder(Context context)

Creates a builder with default initial values.

Parameters
Context context

Any context.

Public methods

addOverride

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder addOverride(TrackSelectionOverride override)

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

build

public DefaultTrackSelector.Parameters build()

Builds a Parameters instance with the selected values.

clearOverride

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder clearOverride(TrackGroup trackGroup)

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

clearOverrides

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder clearOverrides()

Removes all overrides.

clearOverridesOfType

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder clearOverridesOfType(@C.TrackType int trackType)

Removes all overrides of the provided track type.

clearSelectionOverride

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder clearSelectionOverride(int rendererIndex, TrackGroupArray groups)

Clears a track selection override for the specified renderer and TrackGroupArray.

Parameters
int rendererIndex

The renderer index.

TrackGroupArray groups

The TrackGroupArray for which the override should be cleared.

clearSelectionOverrides

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder clearSelectionOverrides()

Clears all track selection overrides for all renderers.

clearSelectionOverrides

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder clearSelectionOverrides(int rendererIndex)

Clears all track selection overrides for the specified renderer.

Parameters
int rendererIndex

The renderer index.

setAllowAudioMixedChannelCountAdaptiveness

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setAllowAudioMixedChannelCountAdaptiveness(
    boolean allowAudioMixedChannelCountAdaptiveness
)

Sets whether to allow adaptive audio selections containing mixed channel counts.

Adaptations between different channel counts may not be completely seamless.

Parameters
boolean allowAudioMixedChannelCountAdaptiveness

Whether to allow adaptive audio selections containing mixed channel counts.

setAllowAudioMixedDecoderSupportAdaptiveness

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setAllowAudioMixedDecoderSupportAdaptiveness(
    boolean allowAudioMixedDecoderSupportAdaptiveness
)

Sets whether to allow adaptive audio selections with mixed levels of and .

Parameters
boolean allowAudioMixedDecoderSupportAdaptiveness

Whether to allow adaptive audio selections with mixed levels of decoder and hardware acceleration support.

setAllowAudioMixedMimeTypeAdaptiveness

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setAllowAudioMixedMimeTypeAdaptiveness(
    boolean allowAudioMixedMimeTypeAdaptiveness
)

Sets whether to allow adaptive audio selections containing mixed MIME types.

Adaptations between different MIME types may not be completely seamless, in which case setAllowAudioNonSeamlessAdaptiveness also needs to be true for mixed MIME type selections to be made.

Parameters
boolean allowAudioMixedMimeTypeAdaptiveness

Whether to allow adaptive audio selections containing mixed MIME types.

setAllowAudioMixedSampleRateAdaptiveness

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setAllowAudioMixedSampleRateAdaptiveness(
    boolean allowAudioMixedSampleRateAdaptiveness
)

Sets whether to allow adaptive audio selections containing mixed sample rates.

Adaptations between different sample rates may not be completely seamless.

Parameters
boolean allowAudioMixedSampleRateAdaptiveness

Whether to allow adaptive audio selections containing mixed sample rates.

setAllowMultipleAdaptiveSelections

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setAllowMultipleAdaptiveSelections(
    boolean allowMultipleAdaptiveSelections
)

Sets whether multiple adaptive selections with more than one track are allowed.

Parameters
boolean allowMultipleAdaptiveSelections

Whether multiple adaptive selections are allowed.

setAllowVideoMixedDecoderSupportAdaptiveness

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setAllowVideoMixedDecoderSupportAdaptiveness(
    boolean allowVideoMixedDecoderSupportAdaptiveness
)

Sets whether to allow adaptive video selections with mixed levels of and .

Parameters
boolean allowVideoMixedDecoderSupportAdaptiveness

Whether to allow adaptive video selections with mixed levels of decoder and hardware acceleration support.

setAllowVideoMixedMimeTypeAdaptiveness

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setAllowVideoMixedMimeTypeAdaptiveness(
    boolean allowVideoMixedMimeTypeAdaptiveness
)

Sets whether to allow adaptive video selections containing mixed MIME types.

Adaptations between different MIME types may not be completely seamless, in which case setAllowVideoNonSeamlessAdaptiveness also needs to be true for mixed MIME type selections to be made.

Parameters
boolean allowVideoMixedMimeTypeAdaptiveness

Whether to allow adaptive video selections containing mixed MIME types.

setAllowVideoNonSeamlessAdaptiveness

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setAllowVideoNonSeamlessAdaptiveness(
    boolean allowVideoNonSeamlessAdaptiveness
)

Sets whether to allow adaptive video selections where adaptation may not be completely seamless.

Parameters
boolean allowVideoNonSeamlessAdaptiveness

Whether to allow adaptive video selections where adaptation may not be completely seamless.

setAudioOffloadPreferences

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder 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.

setDisabledTextTrackSelectionFlags

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setDisabledTextTrackSelectionFlags(
    @C.SelectionFlags int disabledTextTrackSelectionFlags
)

setDisabledTrackTypes

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setDisabledTrackTypes(Set<@C.TrackType Integer> disabledTrackTypes)

setExceedAudioConstraintsIfNecessary

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setExceedAudioConstraintsIfNecessary(
    boolean exceedAudioConstraintsIfNecessary
)

Sets whether to exceed the setMaxAudioChannelCount and setMaxAudioBitrate constraints when no selection can be made otherwise.

Parameters
boolean exceedAudioConstraintsIfNecessary

Whether to exceed audio constraints when no selection can be made otherwise.

setExceedRendererCapabilitiesIfNecessary

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setExceedRendererCapabilitiesIfNecessary(
    boolean exceedRendererCapabilitiesIfNecessary
)

Sets whether to exceed renderer capabilities when no selection can be made otherwise.

This parameter applies when all of the tracks available for a renderer exceed the renderer's reported capabilities. If the parameter is true then the lowest quality track will still be selected. Playback may succeed if the renderer has under-reported its true capabilities. If false then no track will be selected.

Parameters
boolean exceedRendererCapabilitiesIfNecessary

Whether to exceed renderer capabilities when no selection can be made otherwise.

setExceedVideoConstraintsIfNecessary

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setExceedVideoConstraintsIfNecessary(
    boolean exceedVideoConstraintsIfNecessary
)

Sets whether to exceed the setMaxVideoBitrate, setMaxVideoSize and setMaxVideoFrameRate constraints when no selection can be made otherwise.

Parameters
boolean exceedVideoConstraintsIfNecessary

Whether to exceed video constraints when no selection can be made otherwise.

setForceHighestSupportedBitrate

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setForceHighestSupportedBitrate(boolean forceHighestSupportedBitrate)

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

Parameters
boolean forceHighestSupportedBitrate

Whether to force selection of the highest bitrate audio and video tracks.

setForceLowestBitrate

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setForceLowestBitrate(boolean forceLowestBitrate)

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

Parameters
boolean forceLowestBitrate

Whether to force selection of the single lowest bitrate audio and video tracks.

setIgnoredTextSelectionFlags

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setIgnoredTextSelectionFlags(
    @C.SelectionFlags int ignoredTextSelectionFlags
)

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

Parameters
@C.SelectionFlags int ignoredTextSelectionFlags

A bitmask of C.SelectionFlags that are ignored for text track selections.

setMaxAudioBitrate

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setMaxAudioBitrate(int maxAudioBitrate)

Sets the maximum allowed audio bitrate.

Parameters
int maxAudioBitrate

Maximum allowed audio bitrate in bits per second.

setMaxAudioChannelCount

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setMaxAudioChannelCount(int maxAudioChannelCount)

Sets the maximum allowed audio channel count.

Parameters
int maxAudioChannelCount

Maximum allowed audio channel count.

setMaxVideoBitrate

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setMaxVideoBitrate(int maxVideoBitrate)

Sets the maximum allowed video bitrate.

Parameters
int maxVideoBitrate

Maximum allowed video bitrate in bits per second.

setMaxVideoFrameRate

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setMaxVideoFrameRate(int maxVideoFrameRate)

Sets the maximum allowed video frame rate.

Parameters
int maxVideoFrameRate

Maximum allowed video frame rate in hertz.

setMaxVideoSize

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setMaxVideoSize(int maxVideoWidth, int maxVideoHeight)

Sets the maximum allowed video width and height.

Parameters
int maxVideoWidth

Maximum allowed video width in pixels.

int maxVideoHeight

Maximum allowed video height in pixels.

setMinVideoBitrate

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setMinVideoBitrate(int minVideoBitrate)