DefaultTrackSelector.ParametersBuilder


public final class DefaultTrackSelector.ParametersBuilder extends TrackSelectionParameters.Builder


Summary

Public constructors

This method is deprecated.

Context constraints will not be set using this constructor.

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 the preferred language and role flags for text tracks based on the accessibility settings of CaptioningManager.

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 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(
    Context context,
    boolean viewportOrientationMayChange
)

Equivalent to calling setViewportSize with the viewport size obtained from getCurrentDisplayModeSize.

Protected methods

DefaultTrackSelector.ParametersBuilder

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

Public constructors

ParametersBuilder

public ParametersBuilder()

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)

Sets the minimum allowed video bitrate.

Parameters
int minVideoBitrate

Minimum allowed video bitrate in bits per second.

setMinVideoFrameRate

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setMinVideoFrameRate(int minVideoFrameRate)

Sets the minimum allowed video frame rate.

Parameters
int minVideoFrameRate

Minimum allowed video frame rate in hertz.

setMinVideoSize

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

Sets the minimum allowed video width and height.

Parameters
int minVideoWidth

Minimum allowed video width in pixels.

int minVideoHeight

Minimum allowed video height in pixels.

setOverrideForType

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setOverrideForType(TrackSelectionOverride override)

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

setPreferredAudioLanguage

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setPreferredAudioLanguage(@Nullable String preferredAudioLanguage)

Sets the preferred language for audio and forced text tracks.

Parameters
@Nullable String 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.

setPreferredAudioLanguages

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

Sets the preferred languages for audio and forced text tracks.

Parameters
String[] 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.

setPreferredAudioMimeType

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setPreferredAudioMimeType(@Nullable String mimeType)

Sets the preferred sample MIME type for audio tracks.

Parameters
@Nullable String mimeType

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

setPreferredAudioMimeTypes

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setPreferredAudioMimeTypes(String[] mimeTypes)

Sets the preferred sample MIME types for audio tracks.

Parameters
String[] mimeTypes

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

setPreferredAudioRoleFlags

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setPreferredAudioRoleFlags(@C.RoleFlags int preferredAudioRoleFlags)

Sets the preferred C.RoleFlags for audio tracks.

Parameters
@C.RoleFlags int preferredAudioRoleFlags

Preferred audio role flags.

setPreferredTextLanguage

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setPreferredTextLanguage(@Nullable String preferredTextLanguage)

Sets the preferred language for text tracks.

Parameters
@Nullable String 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.

setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings(
    Context context
)

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

Does nothing for API levels <19 or when the CaptioningManager is disabled.

Parameters
Context context

A Context.

setPreferredTextLanguages

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

Sets the preferred languages for text tracks.

Parameters
String[] 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.

setPreferredTextRoleFlags

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setPreferredTextRoleFlags(@C.RoleFlags int preferredTextRoleFlags)

Sets the preferred C.RoleFlags for text tracks.

Parameters
@C.RoleFlags int preferredTextRoleFlags

Preferred text role flags.

setPreferredVideoMimeType

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setPreferredVideoMimeType(@Nullable String mimeType)

Sets the preferred sample MIME type for video tracks.

Parameters
@Nullable String mimeType

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

setPreferredVideoMimeTypes

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setPreferredVideoMimeTypes(String[] mimeTypes)

Sets the preferred sample MIME types for video tracks.

Parameters
String[] mimeTypes

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

setPreferredVideoRoleFlags

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setPreferredVideoRoleFlags(@C.RoleFlags int preferredVideoRoleFlags)

Sets the preferred C.RoleFlags for video tracks.

Parameters
@C.RoleFlags int preferredVideoRoleFlags

Preferred video role flags.

setPrioritizeImageOverVideoEnabled

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setPrioritizeImageOverVideoEnabled(
    boolean isPrioritizeImageOverVideoEnabled
)

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

Parameters
boolean isPrioritizeImageOverVideoEnabled

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

setRendererDisabled

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

The renderer index.

boolean disabled

Whether the renderer is disabled.

setSelectUndeterminedTextLanguage

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

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

setSelectionOverride

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setSelectionOverride(
    int rendererIndex,
    TrackGroupArray groups,
    @Nullable DefaultTrackSelector.SelectionOverride override
)

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 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 setRendererDisabled because the renderer is disabled conditionally on the TrackGroupArray mapped to it, where-as setRendererDisabled disables the renderer unconditionally.

To remove overrides use clearSelectionOverride, clearSelectionOverrides or clearSelectionOverrides.

Parameters
int rendererIndex

The renderer index.

TrackGroupArray groups

The TrackGroupArray for which the override should be applied.

@Nullable DefaultTrackSelector.SelectionOverride override

The override.

setTrackTypeDisabled

@CanIgnoreReturnValue
public DefaultTrackSelector.ParametersBuilder setTrackTypeDisabled(@C.TrackType 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
@C.TrackType int trackType

The track type.

boolean disabled

Whether the track type should be disabled.

setTunnelingEnabled

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

Whether to enable tunneling if possible.

setViewportSize

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

Viewport width in pixels.

int viewportHeight

Viewport height in pixels.

boolean viewportOrientationMayChange

Whether the viewport orientation may change during playback.

setViewportSizeToPhysicalDisplaySize

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

Equivalent to calling setViewportSize with the viewport size obtained from getCurrentDisplayModeSize.

Parameters
Context context

Any context.

boolean viewportOrientationMayChange

Whether the viewport orientation may change during playback.

Protected methods

set

@CanIgnoreReturnValue
protected DefaultTrackSelector.ParametersBuilder set(TrackSelectionParameters parameters)

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