public final class

DefaultTrackSelector.Parameters.Builder

extends TrackSelectionParameters.Builder

 java.lang.Object

androidx.media3.common.TrackSelectionParameters.Builder

↳androidx.media3.exoplayer.trackselection.DefaultTrackSelector.Parameters.Builder

Overview

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

Summary

Constructors
publicBuilder()

publicBuilder(Context context)

Creates a builder with default initial values.

Methods
public TrackSelectionParameters.BuilderaddOverride(TrackSelectionOverride override)

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

public DefaultTrackSelector.Parametersbuild()

Builds a DefaultTrackSelector.Parameters instance with the selected values.

public TrackSelectionParameters.BuilderclearOverride(TrackGroup mediaTrackGroup)

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

public TrackSelectionParameters.BuilderclearOverrides()

Removes all overrides.

public TrackSelectionParameters.BuilderclearOverridesOfType(int trackType)

Removes all overrides of the provided track type.

public DefaultTrackSelector.Parameters.BuilderclearSelectionOverride(int rendererIndex, TrackGroupArray groups)

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

public DefaultTrackSelector.Parameters.BuilderclearSelectionOverrides()

Clears all track selection overrides for all renderers.

public DefaultTrackSelector.Parameters.BuilderclearSelectionOverrides(int rendererIndex)

Clears all track selection overrides for the specified renderer.

public TrackSelectionParameters.BuilderclearVideoSizeConstraints()

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

public TrackSelectionParameters.BuilderclearViewportSizeConstraints()

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

protected TrackSelectionParameters.Builderset(TrackSelectionParameters parameters)

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

public DefaultTrackSelector.Parameters.BuildersetAllowAudioMixedChannelCountAdaptiveness(boolean allowAudioMixedChannelCountAdaptiveness)

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

public DefaultTrackSelector.Parameters.BuildersetAllowAudioMixedDecoderSupportAdaptiveness(boolean allowAudioMixedDecoderSupportAdaptiveness)

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

public DefaultTrackSelector.Parameters.BuildersetAllowAudioMixedMimeTypeAdaptiveness(boolean allowAudioMixedMimeTypeAdaptiveness)

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

public DefaultTrackSelector.Parameters.BuildersetAllowAudioMixedSampleRateAdaptiveness(boolean allowAudioMixedSampleRateAdaptiveness)

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

public DefaultTrackSelector.Parameters.BuildersetAllowAudioNonSeamlessAdaptiveness(boolean allowAudioNonSeamlessAdaptiveness)

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

public DefaultTrackSelector.Parameters.BuildersetAllowInvalidateSelectionsOnRendererCapabilitiesChange(boolean allowInvalidateSelectionsOnRendererCapabilitiesChange)

Sets whether to allow to invalidate selections on renderer capabilities change.

public DefaultTrackSelector.Parameters.BuildersetAllowMultipleAdaptiveSelections(boolean allowMultipleAdaptiveSelections)

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

public DefaultTrackSelector.Parameters.BuildersetAllowVideoMixedDecoderSupportAdaptiveness(boolean allowVideoMixedDecoderSupportAdaptiveness)

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

public DefaultTrackSelector.Parameters.BuildersetAllowVideoMixedMimeTypeAdaptiveness(boolean allowVideoMixedMimeTypeAdaptiveness)

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

public DefaultTrackSelector.Parameters.BuildersetAllowVideoNonSeamlessAdaptiveness(boolean allowVideoNonSeamlessAdaptiveness)

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

public DefaultTrackSelector.Parameters.BuildersetConstrainAudioChannelCountToDeviceCapabilities(boolean enabled)

Whether to only select audio tracks with channel counts that don't exceed the device's output capabilities.

public DefaultTrackSelector.Parameters.BuildersetDisabledTextTrackSelectionFlags(int disabledTextTrackSelectionFlags)

public DefaultTrackSelector.Parameters.BuildersetDisabledTrackTypes(java.util.Set<java.lang.Integer> disabledTrackTypes)

public DefaultTrackSelector.Parameters.BuildersetExceedAudioConstraintsIfNecessary(boolean exceedAudioConstraintsIfNecessary)

Sets whether to exceed the DefaultTrackSelector.Parameters.Builder.setMaxAudioChannelCount(int) and DefaultTrackSelector.Parameters.Builder.setMaxAudioBitrate(int) constraints when no selection can be made otherwise.

public DefaultTrackSelector.Parameters.BuildersetExceedRendererCapabilitiesIfNecessary(boolean exceedRendererCapabilitiesIfNecessary)

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

public DefaultTrackSelector.Parameters.BuildersetExceedVideoConstraintsIfNecessary(boolean exceedVideoConstraintsIfNecessary)

Sets whether to exceed the DefaultTrackSelector.Parameters.Builder.setMaxVideoBitrate(int), DefaultTrackSelector.Parameters.Builder.setMaxVideoSize(int, int) and DefaultTrackSelector.Parameters.Builder.setMaxVideoFrameRate(int) constraints when no selection can be made otherwise.

public TrackSelectionParameters.BuildersetForceHighestSupportedBitrate(boolean forceHighestSupportedBitrate)

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

public TrackSelectionParameters.BuildersetForceLowestBitrate(boolean forceLowestBitrate)

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

public TrackSelectionParameters.BuildersetIgnoredTextSelectionFlags(int ignoredTextSelectionFlags)

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

public TrackSelectionParameters.BuildersetMaxAudioBitrate(int maxAudioBitrate)

Sets the maximum allowed audio bitrate.

public TrackSelectionParameters.BuildersetMaxAudioChannelCount(int maxAudioChannelCount)

Sets the maximum allowed audio channel count.

public TrackSelectionParameters.BuildersetMaxVideoBitrate(int maxVideoBitrate)

Sets the maximum allowed video bitrate.

public TrackSelectionParameters.BuildersetMaxVideoFrameRate(int maxVideoFrameRate)

Sets the maximum allowed video frame rate.

public TrackSelectionParameters.BuildersetMaxVideoSize(int maxVideoWidth, int maxVideoHeight)

Sets the maximum allowed video width and height.

public TrackSelectionParameters.BuildersetMaxVideoSizeSd()

Equivalent to setMaxVideoSize(1279, 719).

public TrackSelectionParameters.BuildersetMinVideoBitrate(int minVideoBitrate)

Sets the minimum allowed video bitrate.

public TrackSelectionParameters.BuildersetMinVideoFrameRate(int minVideoFrameRate)

Sets the minimum allowed video frame rate.

public TrackSelectionParameters.BuildersetMinVideoSize(int minVideoWidth, int minVideoHeight)

Sets the minimum allowed video width and height.

public TrackSelectionParameters.BuildersetOverrideForType(TrackSelectionOverride override)

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

public TrackSelectionParameters.BuildersetPreferredAudioLanguage(java.lang.String preferredAudioLanguage)

Sets the preferred language for audio and forced text tracks.

public TrackSelectionParameters.BuildersetPreferredAudioLanguages(java.lang.String preferredAudioLanguages[])

Sets the preferred languages for audio and forced text tracks.

public TrackSelectionParameters.BuildersetPreferredAudioMimeType(java.lang.String mimeType)

Sets the preferred sample MIME type for audio tracks.

public TrackSelectionParameters.BuildersetPreferredAudioMimeTypes(java.lang.String mimeTypes[])

Sets the preferred sample MIME types for audio tracks.

public TrackSelectionParameters.BuildersetPreferredAudioRoleFlags(int preferredAudioRoleFlags)

Sets the preferred C.RoleFlags for audio tracks.

public TrackSelectionParameters.BuildersetPreferredTextLanguage(java.lang.String preferredTextLanguage)

Sets the preferred language for text tracks.

public TrackSelectionParameters.BuildersetPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings(Context context)

Sets the preferred language and role flags for text tracks based on the accessibility settings of CaptioningManager.

public TrackSelectionParameters.BuildersetPreferredTextLanguages(java.lang.String preferredTextLanguages[])

Sets the preferred languages for text tracks.

public TrackSelectionParameters.BuildersetPreferredTextRoleFlags(int preferredTextRoleFlags)

Sets the preferred C.RoleFlags for text tracks.

public TrackSelectionParameters.BuildersetPreferredVideoMimeType(java.lang.String mimeType)

Sets the preferred sample MIME type for video tracks.

public TrackSelectionParameters.BuildersetPreferredVideoMimeTypes(java.lang.String mimeTypes[])

Sets the preferred sample MIME types for video tracks.

public TrackSelectionParameters.BuildersetPreferredVideoRoleFlags(int preferredVideoRoleFlags)

Sets the preferred C.RoleFlags for video tracks.

public DefaultTrackSelector.Parameters.BuildersetRendererDisabled(int rendererIndex, boolean disabled)

Sets whether the renderer at the specified index is disabled.

public DefaultTrackSelector.Parameters.BuildersetSelectionOverride(int rendererIndex, TrackGroupArray groups, DefaultTrackSelector.SelectionOverride override)

Overrides the track selection for the renderer at the specified index.

public TrackSelectionParameters.BuildersetSelectUndeterminedTextLanguage(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.

public TrackSelectionParameters.BuildersetTrackTypeDisabled(int trackType, boolean disabled)

Sets whether a track type is disabled.

public DefaultTrackSelector.Parameters.BuildersetTunnelingEnabled(boolean tunnelingEnabled)

Sets whether to enable tunneling if possible.

public TrackSelectionParameters.BuildersetViewportSize(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.

public TrackSelectionParameters.BuildersetViewportSizeToPhysicalDisplaySize(Context context, boolean viewportOrientationMayChange)

Equivalent to calling TrackSelectionParameters.Builder.setViewportSize(int, int, boolean) with the viewport size obtained from Util.getCurrentDisplayModeSize(Context).

from TrackSelectionParameters.BuildersetAudioOffloadPreferences, setPrioritizeImageOverVideoEnabled
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

Deprecated: constraints will not be set using this constructor. Use DefaultTrackSelector.Parameters.Builder.Builder(Context) instead.

public Builder(Context context)

Creates a builder with default initial values.

Parameters:

context: Any context.

Methods

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

public TrackSelectionParameters.Builder setMaxVideoSizeSd()

Equivalent to setMaxVideoSize(1279, 719).

Returns:

This builder.

public TrackSelectionParameters.Builder clearVideoSizeConstraints()

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

Returns:

This builder.

public TrackSelectionParameters.Builder setMaxVideoSize(int maxVideoWidth, int maxVideoHeight)

Sets the maximum allowed video width and height.

Parameters:

maxVideoWidth: Maximum allowed video width in pixels.
maxVideoHeight: Maximum allowed video height in pixels.

Returns:

This builder.

public TrackSelectionParameters.Builder setMaxVideoFrameRate(int maxVideoFrameRate)

Sets the maximum allowed video frame rate.

Parameters:

maxVideoFrameRate: Maximum allowed video frame rate in hertz.

Returns:

This builder.

public TrackSelectionParameters.Builder setMaxVideoBitrate(int maxVideoBitrate)

Sets the maximum allowed video bitrate.

Parameters:

maxVideoBitrate: Maximum allowed video bitrate in bits per second.

Returns:

This builder.

public TrackSelectionParameters.Builder setMinVideoSize(int minVideoWidth, int minVideoHeight)

Sets the minimum allowed video width and height.

Parameters:

minVideoWidth: Minimum allowed video width in pixels.
minVideoHeight: Minimum allowed video height in pixels.

Returns:

This builder.

public TrackSelectionParameters.Builder setMinVideoFrameRate(int minVideoFrameRate)

Sets the minimum allowed video frame rate.

Parameters:

minVideoFrameRate: Minimum allowed video frame rate in hertz.

Returns:

This builder.

public TrackSelectionParameters.Builder setMinVideoBitrate(int minVideoBitrate)

Sets the minimum allowed video bitrate.

Parameters:

minVideoBitrate: Minimum allowed video bitrate in bits per second.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder setExceedVideoConstraintsIfNecessary(boolean exceedVideoConstraintsIfNecessary)

Sets whether to exceed the DefaultTrackSelector.Parameters.Builder.setMaxVideoBitrate(int), DefaultTrackSelector.Parameters.Builder.setMaxVideoSize(int, int) and DefaultTrackSelector.Parameters.Builder.setMaxVideoFrameRate(int) constraints when no selection can be made otherwise.

Parameters:

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

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder 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 DefaultTrackSelector.Parameters.Builder.setAllowVideoNonSeamlessAdaptiveness(boolean) also needs to be true for mixed MIME type selections to be made.

Parameters:

allowVideoMixedMimeTypeAdaptiveness: Whether to allow adaptive video selections containing mixed MIME types.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder setAllowVideoNonSeamlessAdaptiveness(boolean allowVideoNonSeamlessAdaptiveness)

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

Parameters:

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

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder setAllowVideoMixedDecoderSupportAdaptiveness(boolean allowVideoMixedDecoderSupportAdaptiveness)

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

Parameters:

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

Returns:

This builder.

public TrackSelectionParameters.Builder setViewportSizeToPhysicalDisplaySize(Context context, boolean viewportOrientationMayChange)

Equivalent to calling TrackSelectionParameters.Builder.setViewportSize(int, int, boolean) with the viewport size obtained from Util.getCurrentDisplayModeSize(Context).

Parameters:

context: Any context.
viewportOrientationMayChange: Whether the viewport orientation may change during playback.

Returns:

This builder.

public TrackSelectionParameters.Builder clearViewportSizeConstraints()

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

Returns:

This builder.

public TrackSelectionParameters.Builder 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.

Parameters:

viewportWidth: Viewport width in pixels.
viewportHeight: Viewport height in pixels.
viewportOrientationMayChange: Whether the viewport orientation may change during playback.

Returns:

This builder.

public TrackSelectionParameters.Builder setPreferredVideoMimeType(java.lang.String mimeType)

Sets the preferred sample MIME type for video tracks.

Parameters:

mimeType: The preferred MIME type for video tracks, or null to clear a previously set preference.

Returns:

This builder.

public TrackSelectionParameters.Builder setPreferredVideoMimeTypes(java.lang.String mimeTypes[])

Sets the preferred sample MIME types for video tracks.

Parameters:

mimeTypes: The preferred MIME types for video tracks in order of preference, or an empty list for no preference.

Returns:

This builder.

public TrackSelectionParameters.Builder setPreferredVideoRoleFlags(int preferredVideoRoleFlags)

Sets the preferred C.RoleFlags for video tracks.

Parameters:

preferredVideoRoleFlags: Preferred video role flags.

Returns:

This builder.

public TrackSelectionParameters.Builder setPreferredAudioLanguage(java.lang.String preferredAudioLanguage)

Sets the preferred language for audio and forced text tracks.

Parameters:

preferredAudioLanguage: Preferred audio language as an IETF BCP 47 conformant tag, or null to select the default track, or the first track if there's no default.

Returns:

This builder.

public TrackSelectionParameters.Builder setPreferredAudioLanguages(java.lang.String preferredAudioLanguages[])

Sets the preferred languages for audio and forced text tracks.

Parameters:

preferredAudioLanguages: Preferred audio languages as IETF BCP 47 conformant tags in order of preference, or an empty array to select the default track, or the first track if there's no default.

Returns:

This builder.

public TrackSelectionParameters.Builder setPreferredAudioRoleFlags(int preferredAudioRoleFlags)

Sets the preferred C.RoleFlags for audio tracks.

Parameters:

preferredAudioRoleFlags: Preferred audio role flags.

Returns:

This builder.

public TrackSelectionParameters.Builder setMaxAudioChannelCount(int maxAudioChannelCount)

Sets the maximum allowed audio channel count.

Parameters:

maxAudioChannelCount: Maximum allowed audio channel count.

Returns:

This builder.

public TrackSelectionParameters.Builder setMaxAudioBitrate(int maxAudioBitrate)

Sets the maximum allowed audio bitrate.

Parameters:

maxAudioBitrate: Maximum allowed audio bitrate in bits per second.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder setExceedAudioConstraintsIfNecessary(boolean exceedAudioConstraintsIfNecessary)

Sets whether to exceed the DefaultTrackSelector.Parameters.Builder.setMaxAudioChannelCount(int) and DefaultTrackSelector.Parameters.Builder.setMaxAudioBitrate(int) constraints when no selection can be made otherwise.

Parameters:

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

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder 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 DefaultTrackSelector.Parameters.Builder.setAllowAudioNonSeamlessAdaptiveness(boolean) also needs to be true for mixed MIME type selections to be made.

Parameters:

allowAudioMixedMimeTypeAdaptiveness: Whether to allow adaptive audio selections containing mixed MIME types.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder 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:

allowAudioMixedSampleRateAdaptiveness: Whether to allow adaptive audio selections containing mixed sample rates.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder 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:

allowAudioMixedChannelCountAdaptiveness: Whether to allow adaptive audio selections containing mixed channel counts.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder setAllowAudioMixedDecoderSupportAdaptiveness(boolean allowAudioMixedDecoderSupportAdaptiveness)

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

Parameters:

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

Returns:

This builder.

public TrackSelectionParameters.Builder setPreferredAudioMimeType(java.lang.String mimeType)

Sets the preferred sample MIME type for audio tracks.

Parameters:

mimeType: The preferred MIME type for audio tracks, or null to clear a previously set preference.

Returns:

This builder.

public TrackSelectionParameters.Builder setPreferredAudioMimeTypes(java.lang.String mimeTypes[])

Sets the preferred sample MIME types for audio tracks.

Parameters:

mimeTypes: The preferred MIME types for audio tracks in order of preference, or an empty list for no preference.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder setAllowAudioNonSeamlessAdaptiveness(boolean allowAudioNonSeamlessAdaptiveness)

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

Parameters:

allowAudioNonSeamlessAdaptiveness: Whether to allow adaptive audio selections where adaptation may not be completely seamless.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder setConstrainAudioChannelCountToDeviceCapabilities(boolean enabled)

Whether to only select audio tracks with channel counts that don't exceed the device's output capabilities. The default value is true.

When enabled, the track selector will prefer stereo/mono audio tracks over multichannel if the audio cannot be spatialized or the device is outputting stereo audio. For example, on a mobile device that outputs non-spatialized audio to its speakers. Dolby surround sound formats are excluded from these constraints because some Dolby decoders are known to spatialize multichannel audio on Android OS versions that don't support the Spatializer API.

For devices with Android 12L+ that support audio spatialization, when this is enabled the track selector will trigger a new track selection everytime a change in is detected.

The constraints do not apply on devices with television UI mode.

The constraints do not apply when the track selector is created without a reference to a via the deprecated DefaultTrackSelector constructor.

public TrackSelectionParameters.Builder setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings(Context context)

Sets the preferred language and role flags for text tracks based on the accessibility settings of CaptioningManager.

Does nothing when the CaptioningManager is disabled.

Parameters:

context: A .

Returns:

This builder.

public TrackSelectionParameters.Builder setPreferredTextLanguage(java.lang.String preferredTextLanguage)

Sets the preferred language for text tracks.

Parameters:

preferredTextLanguage: Preferred text language as an IETF BCP 47 conformant tag, or null to select the default track if there is one, or no track otherwise.

Returns:

This builder.

public TrackSelectionParameters.Builder setPreferredTextLanguages(java.lang.String preferredTextLanguages[])

Sets the preferred languages for text tracks.

Parameters:

preferredTextLanguages: Preferred text languages as IETF BCP 47 conformant tags in order of preference, or an empty array to select the default track if there is one, or no track otherwise.

Returns:

This builder.

public TrackSelectionParameters.Builder setPreferredTextRoleFlags(int preferredTextRoleFlags)

Sets the preferred C.RoleFlags for text tracks.

Parameters:

preferredTextRoleFlags: Preferred text role flags.

Returns:

This builder.

public TrackSelectionParameters.Builder setIgnoredTextSelectionFlags(int ignoredTextSelectionFlags)

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

Parameters:

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

Returns:

This builder.

public TrackSelectionParameters.Builder 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.

Parameters:

selectUndeterminedTextLanguage: Whether a text track with undetermined language should be selected if no preferred language track is available.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder setDisabledTextTrackSelectionFlags(int disabledTextTrackSelectionFlags)

Deprecated: Use DefaultTrackSelector.Parameters.Builder.setIgnoredTextSelectionFlags(int).

public TrackSelectionParameters.Builder setForceLowestBitrate(boolean forceLowestBitrate)

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

Parameters:

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

Returns:

This builder.

public TrackSelectionParameters.Builder setForceHighestSupportedBitrate(boolean forceHighestSupportedBitrate)

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

Parameters:

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

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder setAllowInvalidateSelectionsOnRendererCapabilitiesChange(boolean allowInvalidateSelectionsOnRendererCapabilitiesChange)

Sets whether to allow to invalidate selections on renderer capabilities change.

Parameters:

allowInvalidateSelectionsOnRendererCapabilitiesChange: Whether to allow to invalidate selections.

Returns:

This builder.

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

public TrackSelectionParameters.Builder clearOverride(TrackGroup mediaTrackGroup)

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

public TrackSelectionParameters.Builder setOverrideForType(TrackSelectionOverride override)

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

public TrackSelectionParameters.Builder clearOverridesOfType(int trackType)

Removes all overrides of the provided track type.

public TrackSelectionParameters.Builder clearOverrides()

Removes all overrides.

public DefaultTrackSelector.Parameters.Builder setDisabledTrackTypes(java.util.Set<java.lang.Integer> disabledTrackTypes)

Deprecated: Use DefaultTrackSelector.Parameters.Builder.setTrackTypeDisabled(int, boolean).

public TrackSelectionParameters.Builder setTrackTypeDisabled(int trackType, boolean disabled)

Sets whether a track type is disabled. If disabled, no tracks of the specified type will be selected for playback.

Parameters:

trackType: The track type.
disabled: Whether the track type should be disabled.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder 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:

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

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder setTunnelingEnabled(boolean tunnelingEnabled)

Sets whether to enable tunneling if possible. Tunneling will only be enabled if it's supported by the audio and video renderers for the selected tracks.

Tunneling is known to have many device specific issues and limitations. Manual testing is strongly recommended to check that the media plays correctly when this option is enabled. See [#9661](https://github.com/google/ExoPlayer/issues/9661), [#9133](https://github.com/google/ExoPlayer/issues/9133), [#9317](https://github.com/google/ExoPlayer/issues/9317), [#9502](https://github.com/google/ExoPlayer/issues/9502).

Parameters:

tunnelingEnabled: Whether to enable tunneling if possible.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder setAllowMultipleAdaptiveSelections(boolean allowMultipleAdaptiveSelections)

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

Parameters:

allowMultipleAdaptiveSelections: Whether multiple adaptive selections are allowed.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder setRendererDisabled(int rendererIndex, boolean disabled)

Sets whether the renderer at the specified index is disabled. Disabling a renderer prevents the selector from selecting any tracks for it.

Parameters:

rendererIndex: The renderer index.
disabled: Whether the renderer is disabled.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder setSelectionOverride(int rendererIndex, TrackGroupArray groups, DefaultTrackSelector.SelectionOverride override)

Deprecated: Use .

Overrides the track selection for the renderer at the specified index.

When the TrackGroupArray mapped to the renderer matches the one provided, the override is applied. When the TrackGroupArray does not match, the override has no effect. The override replaces any previous override for the specified TrackGroupArray for the specified Renderer.

Passing a null override will cause the renderer to be disabled when the TrackGroupArray mapped to it matches the one provided. When the TrackGroupArray does not match a null override has no effect. Hence a null override differs from disabling the renderer using DefaultTrackSelector.Parameters.Builder.setRendererDisabled(int, boolean) because the renderer is disabled conditionally on the TrackGroupArray mapped to it, where-as DefaultTrackSelector.Parameters.Builder.setRendererDisabled(int, boolean) disables the renderer unconditionally.

To remove overrides use DefaultTrackSelector.Parameters.Builder.clearSelectionOverride(int, TrackGroupArray), DefaultTrackSelector.Parameters.Builder.clearSelectionOverrides(int) or DefaultTrackSelector.Parameters.Builder.clearSelectionOverrides().

Parameters:

rendererIndex: The renderer index.
groups: The TrackGroupArray for which the override should be applied.
override: The override.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder clearSelectionOverride(int rendererIndex, TrackGroupArray groups)

Deprecated: Use .

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

Parameters:

rendererIndex: The renderer index.
groups: The TrackGroupArray for which the override should be cleared.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder clearSelectionOverrides(int rendererIndex)

Deprecated: Use .

Clears all track selection overrides for the specified renderer.

Parameters:

rendererIndex: The renderer index.

Returns:

This builder.

public DefaultTrackSelector.Parameters.Builder clearSelectionOverrides()

Deprecated: Use .

Clears all track selection overrides for all renderers.

Returns:

This builder.

Builds a DefaultTrackSelector.Parameters instance with the selected values.