DefaultTrackSelector.Parameters.Builder


class DefaultTrackSelector.Parameters.Builder : TrackSelectionParameters.Builder


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

Summary

Public constructors

This function is deprecated.

Context constraints will not be set using this constructor.

Builder(context: Context!)

Creates a builder with default initial values.

Public functions

DefaultTrackSelector.Parameters.Builder!

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

DefaultTrackSelector.Parameters!

Builds a Parameters instance with the selected values.

DefaultTrackSelector.Parameters.Builder!

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

DefaultTrackSelector.Parameters.Builder!

Removes all overrides.

DefaultTrackSelector.Parameters.Builder!

Removes all overrides of the provided track type.

DefaultTrackSelector.Parameters.Builder!

This function is deprecated.

Use clearOverride.

DefaultTrackSelector.Parameters.Builder!

This function is deprecated.

Use clearOverrides.

DefaultTrackSelector.Parameters.Builder!

This function is deprecated.

Use clearOverridesOfType.

DefaultTrackSelector.Parameters.Builder!

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

DefaultTrackSelector.Parameters.Builder!

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

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setAllowAudioMixedChannelCountAdaptiveness(
    allowAudioMixedChannelCountAdaptiveness: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setAllowAudioMixedDecoderSupportAdaptiveness(
    allowAudioMixedDecoderSupportAdaptiveness: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setAllowAudioMixedMimeTypeAdaptiveness(
    allowAudioMixedMimeTypeAdaptiveness: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setAllowAudioMixedSampleRateAdaptiveness(
    allowAudioMixedSampleRateAdaptiveness: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setAllowAudioNonSeamlessAdaptiveness(
    allowAudioNonSeamlessAdaptiveness: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setAllowInvalidateSelectionsOnRendererCapabilitiesChange(
    allowInvalidateSelectionsOnRendererCapabilitiesChange: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setAllowMultipleAdaptiveSelections(
    allowMultipleAdaptiveSelections: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setAllowVideoMixedDecoderSupportAdaptiveness(
    allowVideoMixedDecoderSupportAdaptiveness: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setAllowVideoMixedMimeTypeAdaptiveness(
    allowVideoMixedMimeTypeAdaptiveness: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setAllowVideoNonSeamlessAdaptiveness(
    allowVideoNonSeamlessAdaptiveness: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!

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

DefaultTrackSelector.Parameters.Builder!

This function is deprecated.

Use setIgnoredTextSelectionFlags.

DefaultTrackSelector.Parameters.Builder!

This function is deprecated.

Use setTrackTypeDisabled.

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setExceedAudioConstraintsIfNecessary(
    exceedAudioConstraintsIfNecessary: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setExceedRendererCapabilitiesIfNecessary(
    exceedRendererCapabilitiesIfNecessary: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setExceedVideoConstraintsIfNecessary(
    exceedVideoConstraintsIfNecessary: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!

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

DefaultTrackSelector.Parameters.Builder!

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

DefaultTrackSelector.Parameters.Builder!

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

DefaultTrackSelector.Parameters.Builder!

Sets the maximum allowed audio bitrate.

DefaultTrackSelector.Parameters.Builder!

Sets the maximum allowed audio channel count.

DefaultTrackSelector.Parameters.Builder!

Sets the maximum allowed video bitrate.

DefaultTrackSelector.Parameters.Builder!

Sets the maximum allowed video frame rate.

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setMaxVideoSize(maxVideoWidth: Int, maxVideoHeight: Int)

Sets the maximum allowed video width and height.

DefaultTrackSelector.Parameters.Builder!

Equivalent to setMaxVideoSize(1279, 719).

DefaultTrackSelector.Parameters.Builder!

Sets the minimum allowed video bitrate.

DefaultTrackSelector.Parameters.Builder!

Sets the minimum allowed video frame rate.

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setMinVideoSize(minVideoWidth: Int, minVideoHeight: Int)

Sets the minimum allowed video width and height.

DefaultTrackSelector.Parameters.Builder!

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

DefaultTrackSelector.Parameters.Builder!

Sets the preferred language for audio and forced text tracks.

DefaultTrackSelector.Parameters.Builder!

Sets the preferred languages for audio and forced text tracks.

DefaultTrackSelector.Parameters.Builder!

Sets the preferred sample MIME type for audio tracks.

DefaultTrackSelector.Parameters.Builder!

Sets the preferred sample MIME types for audio tracks.

DefaultTrackSelector.Parameters.Builder!

Sets the preferred C.RoleFlags for audio tracks.

DefaultTrackSelector.Parameters.Builder!

Sets the preferred language for text tracks.

DefaultTrackSelector.Parameters.Builder!

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

DefaultTrackSelector.Parameters.Builder!

Sets the preferred languages for text tracks.

DefaultTrackSelector.Parameters.Builder!

Sets the preferred C.RoleFlags for text tracks.

DefaultTrackSelector.Parameters.Builder!

Sets the preferred sample MIME type for video tracks.

DefaultTrackSelector.Parameters.Builder!

Sets the preferred sample MIME types for video tracks.

DefaultTrackSelector.Parameters.Builder!

Sets the preferred C.RoleFlags for video tracks.

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setRendererDisabled(rendererIndex: Int, disabled: Boolean)

Sets whether the renderer at the specified index is disabled.

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setSelectUndeterminedTextLanguage(
    selectUndeterminedTextLanguage: Boolean
)

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.Parameters.Builder!
@CanIgnoreReturnValue
setSelectionOverride(
    rendererIndex: Int,
    groups: TrackGroupArray!,
    override: DefaultTrackSelector.SelectionOverride?
)

This function is deprecated.

Use addOverride.

DefaultTrackSelector.Parameters.Builder!

Sets whether a track type is disabled.

DefaultTrackSelector.Parameters.Builder!

Sets whether to enable tunneling if possible.

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setViewportSize(
    viewportWidth: Int,
    viewportHeight: Int,
    viewportOrientationMayChange: Boolean
)

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

DefaultTrackSelector.Parameters.Builder!
@CanIgnoreReturnValue
setViewportSizeToPhysicalDisplaySize(
    context: Context!,
    viewportOrientationMayChange: Boolean
)

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

Protected functions

DefaultTrackSelector.Parameters.Builder!

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

Inherited functions

From androidx.media3.common.TrackSelectionParameters.Builder
TrackSelectionParameters.Builder!

Sets the audio offload mode preferences.

TrackSelectionParameters.Builder!
@UnstableApi
@CanIgnoreReturnValue
setPrioritizeImageOverVideoEnabled(
    isPrioritizeImageOverVideoEnabled: Boolean
)

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

Public constructors

Builder

Builder()

Builder

Builder(context: Context!)

Creates a builder with default initial values.

Parameters
context: Context!

Any context.

Public functions

addOverride

@CanIgnoreReturnValue
fun addOverride(override: TrackSelectionOverride!): DefaultTrackSelector.Parameters.Builder!

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

build

fun build(): DefaultTrackSelector.Parameters!

Builds a Parameters instance with the selected values.

clearOverride

@CanIgnoreReturnValue
fun clearOverride(trackGroup: TrackGroup!): DefaultTrackSelector.Parameters.Builder!

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

clearOverrides

@CanIgnoreReturnValue
fun clearOverrides(): DefaultTrackSelector.Parameters.Builder!

Removes all overrides.

clearOverridesOfType

@CanIgnoreReturnValue
fun clearOverridesOfType(@C.TrackType trackType: Int): DefaultTrackSelector.Parameters.Builder!

Removes all overrides of the provided track type.

clearSelectionOverride

@CanIgnoreReturnValue
fun clearSelectionOverride(rendererIndex: Int, groups: TrackGroupArray!): DefaultTrackSelector.Parameters.Builder!

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

Parameters
rendererIndex: Int

The renderer index.

groups: TrackGroupArray!

The TrackGroupArray for which the override should be cleared.

clearSelectionOverrides

@CanIgnoreReturnValue
fun clearSelectionOverrides(): DefaultTrackSelector.Parameters.Builder!

Clears all track selection overrides for all renderers.

clearSelectionOverrides

@CanIgnoreReturnValue
fun clearSelectionOverrides(rendererIndex: Int): DefaultTrackSelector.Parameters.Builder!

Clears all track selection overrides for the specified renderer.

Parameters
rendererIndex: Int

The renderer index.

setAllowAudioMixedChannelCountAdaptiveness

@CanIgnoreReturnValue
fun setAllowAudioMixedChannelCountAdaptiveness(
    allowAudioMixedChannelCountAdaptiveness: Boolean
): DefaultTrackSelector.Parameters.Builder!

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

Adaptations between different channel counts may not be completely seamless.

Parameters
allowAudioMixedChannelCountAdaptiveness: Boolean

Whether to allow adaptive audio selections containing mixed channel counts.

setAllowAudioMixedDecoderSupportAdaptiveness

@CanIgnoreReturnValue
fun setAllowAudioMixedDecoderSupportAdaptiveness(
    allowAudioMixedDecoderSupportAdaptiveness: Boolean
): DefaultTrackSelector.Parameters.Builder!

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

Parameters
allowAudioMixedDecoderSupportAdaptiveness: Boolean

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

setAllowAudioMixedMimeTypeAdaptiveness

@CanIgnoreReturnValue
fun setAllowAudioMixedMimeTypeAdaptiveness(
    allowAudioMixedMimeTypeAdaptiveness: Boolean
): DefaultTrackSelector.Parameters.Builder!

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
allowAudioMixedMimeTypeAdaptiveness: Boolean

Whether to allow adaptive audio selections containing mixed MIME types.

setAllowAudioMixedSampleRateAdaptiveness

@CanIgnoreReturnValue
fun setAllowAudioMixedSampleRateAdaptiveness(
    allowAudioMixedSampleRateAdaptiveness: Boolean
): DefaultTrackSelector.Parameters.Builder!

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

Adaptations between different sample rates may not be completely seamless.

Parameters
allowAudioMixedSampleRateAdaptiveness: Boolean

Whether to allow adaptive audio selections containing mixed sample rates.

setAllowAudioNonSeamlessAdaptiveness

@CanIgnoreReturnValue
fun setAllowAudioNonSeamlessAdaptiveness(
    allowAudioNonSeamlessAdaptiveness: Boolean
): DefaultTrackSelector.Parameters.Builder!

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

Parameters
allowAudioNonSeamlessAdaptiveness: Boolean

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

setAllowInvalidateSelectionsOnRendererCapabilitiesChange

@CanIgnoreReturnValue
fun setAllowInvalidateSelectionsOnRendererCapabilitiesChange(
    allowInvalidateSelectionsOnRendererCapabilitiesChange: Boolean
): DefaultTrackSelector.Parameters.Builder!

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

Parameters
allowInvalidateSelectionsOnRendererCapabilitiesChange: Boolean

Whether to allow to invalidate selections.

setAllowMultipleAdaptiveSelections

@CanIgnoreReturnValue
fun setAllowMultipleAdaptiveSelections(
    allowMultipleAdaptiveSelections: Boolean
): DefaultTrackSelector.Parameters.Builder!

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

Parameters
allowMultipleAdaptiveSelections: Boolean

Whether multiple adaptive selections are allowed.

setAllowVideoMixedDecoderSupportAdaptiveness

@CanIgnoreReturnValue
fun setAllowVideoMixedDecoderSupportAdaptiveness(
    allowVideoMixedDecoderSupportAdaptiveness: Boolean
): DefaultTrackSelector.Parameters.Builder!

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

Parameters
allowVideoMixedDecoderSupportAdaptiveness: Boolean

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

setAllowVideoMixedMimeTypeAdaptiveness

@CanIgnoreReturnValue
fun setAllowVideoMixedMimeTypeAdaptiveness(
    allowVideoMixedMimeTypeAdaptiveness: Boolean
): DefaultTrackSelector.Parameters.Builder!

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
allowVideoMixedMimeTypeAdaptiveness: Boolean

Whether to allow adaptive video selections containing mixed MIME types.

setAllowVideoNonSeamlessAdaptiveness

@CanIgnoreReturnValue
fun setAllowVideoNonSeamlessAdaptiveness(
    allowVideoNonSeamlessAdaptiveness: Boolean
): DefaultTrackSelector.Parameters.Builder!

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

Parameters
allowVideoNonSeamlessAdaptiveness: Boolean

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

setConstrainAudioChannelCountToDeviceCapabilities

@CanIgnoreReturnValue
fun setConstrainAudioChannelCountToDeviceCapabilities(enabled: Boolean): DefaultTrackSelector.Parameters.Builder!

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 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 spatialization properties 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 Context via the deprecated DefaultTrackSelector constructor.

setDisabledTextTrackSelectionFlags

@CanIgnoreReturnValue
fun setDisabledTextTrackSelectionFlags(
    @C.SelectionFlags disabledTextTrackSelectionFlags: Int
): DefaultTrackSelector.Parameters.Builder!

setDisabledTrackTypes

@CanIgnoreReturnValue
fun setDisabledTrackTypes(disabledTrackTypes: (Mutable)Set<@C.TrackType Int!>!): DefaultTrackSelector.Parameters.Builder!

setExceedAudioConstraintsIfNecessary

@CanIgnoreReturnValue
fun setExceedAudioConstraintsIfNecessary(
    exceedAudioConstraintsIfNecessary: Boolean
): DefaultTrackSelector.Parameters.Builder!

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

Parameters
exceedAudioConstraintsIfNecessary: Boolean

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

setExceedRendererCapabilitiesIfNecessary

@CanIgnoreReturnValue
fun setExceedRendererCapabilitiesIfNecessary(
    exceedRendererCapabilitiesIfNecessary: Boolean
): DefaultTrackSelector.Parameters.Builder!

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: Boolean

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

setExceedVideoConstraintsIfNecessary

@CanIgnoreReturnValue
fun setExceedVideoConstraintsIfNecessary(
    exceedVideoConstraintsIfNecessary: Boolean
): DefaultTrackSelector.Parameters.Builder!

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

Parameters
exceedVideoConstraintsIfNecessary: Boolean

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

setForceHighestSupportedBitrate

@CanIgnoreReturnValue
fun setForceHighestSupportedBitrate(forceHighestSupportedBitrate: Boolean): DefaultTrackSelector.Parameters.Builder!

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

Parameters
forceHighestSupportedBitrate: Boolean

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

setForceLowestBitrate

@CanIgnoreReturnValue
fun setForceLowestBitrate(forceLowestBitrate: Boolean): DefaultTrackSelector.Parameters.Builder!

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

Parameters
forceLowestBitrate: Boolean

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

setIgnoredTextSelectionFlags

@CanIgnoreReturnValue
fun setIgnoredTextSelectionFlags(
    @C.SelectionFlags ignoredTextSelectionFlags: Int
): DefaultTrackSelector.Parameters.Builder!

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

Parameters
@C.SelectionFlags ignoredTextSelectionFlags: Int

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

setMaxAudioBitrate

@CanIgnoreReturnValue
fun setMaxAudioBitrate(maxAudioBitrate: Int): DefaultTrackSelector.Parameters.Builder!

Sets the maximum allowed audio bitrate.

Parameters
maxAudioBitrate: Int

Maximum allowed audio bitrate in bits per second.

setMaxAudioChannelCount

@CanIgnoreReturnValue
fun setMaxAudioChannelCount(maxAudioChannelCount: Int): DefaultTrackSelector.Parameters.Builder!

Sets the maximum allowed audio channel count.

Parameters
maxAudioChannelCount: Int

Maximum allowed audio channel count.

setMaxVideoBitrate

@CanIgnoreReturnValue
fun setMaxVideoBitrate(maxVideoBitrate: Int): DefaultTrackSelector.Parameters.Builder!

Sets the maximum allowed video bitrate.

Parameters
maxVideoBitrate: Int

Maximum allowed video bitrate in bits per second.

setMaxVideoFrameRate

@CanIgnoreReturnValue
fun setMaxVideoFrameRate(maxVideoFrameRate: Int): DefaultTrackSelector.Parameters.Builder!

Sets the maximum allowed video frame rate.

Parameters
maxVideoFrameRate: Int

Maximum allowed video frame rate in hertz.

setMaxVideoSize

@CanIgnoreReturnValue
fun setMaxVideoSize(maxVideoWidth: Int, maxVideoHeight: Int): DefaultTrackSelector.Parameters.Builder!

Sets the maximum allowed video width and height.

Parameters
maxVideoWidth: Int

Maximum allowed video width in pixels.

maxVideoHeight: Int

Maximum allowed video height in pixels.

setMinVideoBitrate

@CanIgnoreReturnValue
fun setMinVideoBitrate(minVideoBitrate: Int): DefaultTrackSelector.Parameters.Builder!

Sets the minimum allowed video bitrate.

Parameters
minVideoBitrate: Int

Minimum allowed video bitrate in bits per second.

setMinVideoFrameRate

@CanIgnoreReturnValue
fun setMinVideoFrameRate(minVideoFrameRate: Int): DefaultTrackSelector.Parameters.Builder!

Sets the minimum allowed video frame rate.

Parameters
minVideoFrameRate: Int

Minimum allowed video frame rate in hertz.

setMinVideoSize

@CanIgnoreReturnValue
fun setMinVideoSize(minVideoWidth: Int, minVideoHeight: Int): DefaultTrackSelector.Parameters.Builder!

Sets the minimum allowed video width and height.

Parameters
minVideoWidth: Int

Minimum allowed video width in pixels.

minVideoHeight: Int

Minimum allowed video height in pixels.

setOverrideForType

@CanIgnoreReturnValue
fun setOverrideForType(override: TrackSelectionOverride!): DefaultTrackSelector.Parameters.Builder!

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

setPreferredAudioLanguage

@CanIgnoreReturnValue
fun setPreferredAudioLanguage(preferredAudioLanguage: String?): DefaultTrackSelector.Parameters.Builder!

Sets the preferred language for audio and forced text tracks.

Parameters
preferredAudioLanguage: String?

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
fun setPreferredAudioLanguages(preferredAudioLanguages: Array<String!>!): DefaultTrackSelector.Parameters.Builder!

Sets the preferred languages for audio and forced text tracks.

Parameters
preferredAudioLanguages: Array<String!>!

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
fun setPreferredAudioMimeType(mimeType: String?): DefaultTrackSelector.Parameters.Builder!

Sets the preferred sample MIME type for audio tracks.

Parameters
mimeType: String?

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

setPreferredAudioMimeTypes

@CanIgnoreReturnValue
fun setPreferredAudioMimeTypes(mimeTypes: Array<String!>!): DefaultTrackSelector.Parameters.Builder!

Sets the preferred sample MIME types for audio tracks.

Parameters
mimeTypes: Array<String!>!

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

setPreferredAudioRoleFlags

@CanIgnoreReturnValue
fun setPreferredAudioRoleFlags(@C.RoleFlags preferredAudioRoleFlags: Int): DefaultTrackSelector.Parameters.Builder!

Sets the preferred C.RoleFlags for audio tracks.

Parameters
@C.RoleFlags preferredAudioRoleFlags: Int

Preferred audio role flags.

setPreferredTextLanguage

@CanIgnoreReturnValue
fun setPreferredTextLanguage(preferredTextLanguage: String?): DefaultTrackSelector.Parameters.Builder!

Sets the preferred language for text tracks.

Parameters
preferredTextLanguage: String?

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
fun setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings(
    context: Context!
): DefaultTrackSelector.Parameters.Builder!

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: Context!

A Context.

setPreferredTextLanguages

@CanIgnoreReturnValue
fun setPreferredTextLanguages(preferredTextLanguages: Array<String!>!): DefaultTrackSelector.Parameters.Builder!

Sets the preferred languages for text tracks.

Parameters
preferredTextLanguages: Array<String!>!

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
fun setPreferredTextRoleFlags(@C.RoleFlags preferredTextRoleFlags: Int): DefaultTrackSelector.Parameters.Builder!

Sets the preferred C.RoleFlags for text tracks.

Parameters
@C.RoleFlags preferredTextRoleFlags: Int

Preferred text role flags.

setPreferredVideoMimeType

@CanIgnoreReturnValue
fun setPreferredVideoMimeType(mimeType: String?): DefaultTrackSelector.Parameters.Builder!

Sets the preferred sample MIME type for video tracks.

Parameters
mimeType: String?

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

setPreferredVideoMimeTypes

@CanIgnoreReturnValue
fun setPreferredVideoMimeTypes(mimeTypes: Array<String!>!): DefaultTrackSelector.Parameters.Builder!

Sets the preferred sample MIME types for video tracks.

Parameters
mimeTypes: Array<String!>!

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

setPreferredVideoRoleFlags

@CanIgnoreReturnValue
fun setPreferredVideoRoleFlags(@C.RoleFlags preferredVideoRoleFlags: Int): DefaultTrackSelector.Parameters.Builder!

Sets the preferred C.RoleFlags for video tracks.

Parameters
@C.RoleFlags preferredVideoRoleFlags: Int

Preferred video role flags.

setRendererDisabled

@CanIgnoreReturnValue
fun setRendererDisabled(rendererIndex: Int, disabled: Boolean): DefaultTrackSelector.Parameters.Builder!

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

Parameters
rendererIndex: Int

The renderer index.

disabled: Boolean

Whether the renderer is disabled.

setSelectUndeterminedTextLanguage

@CanIgnoreReturnValue
fun setSelectUndeterminedTextLanguage(
    selectUndeterminedTextLanguage: Boolean
): DefaultTrackSelector.Parameters.Builder!

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: Boolean

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

setSelectionOverride

@CanIgnoreReturnValue
fun setSelectionOverride(
    rendererIndex: Int,
    groups: TrackGroupArray!,
    override: DefaultTrackSelector.SelectionOverride?
): DefaultTrackSelector.Parameters.Builder!

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 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
rendererIndex: Int

The renderer index.

groups: TrackGroupArray!

The TrackGroupArray for which the override should be applied.

override: DefaultTrackSelector.SelectionOverride?

The override.

setTrackTypeDisabled

@CanIgnoreReturnValue
fun setTrackTypeDisabled(@C.TrackType trackType: Int, disabled: Boolean): DefaultTrackSelector.Parameters.Builder!

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

Parameters
@C.TrackType trackType: Int

The track type.

disabled: Boolean

Whether the track type should be disabled.

setTunnelingEnabled

@CanIgnoreReturnValue
fun setTunnelingEnabled(tunnelingEnabled: Boolean): DefaultTrackSelector.Parameters.Builder!

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: Boolean

Whether to enable tunneling if possible.

setViewportSize

@CanIgnoreReturnValue
fun setViewportSize(
    viewportWidth: Int,
    viewportHeight: Int,
    viewportOrientationMayChange: Boolean
): DefaultTrackSelector.Parameters.Builder!

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

Parameters
viewportWidth: Int

Viewport width in pixels.

viewportHeight: Int

Viewport height in pixels.

viewportOrientationMayChange: Boolean

Whether the viewport orientation may change during playback.

setViewportSizeToPhysicalDisplaySize

@CanIgnoreReturnValue
fun setViewportSizeToPhysicalDisplaySize(
    context: Context!,
    viewportOrientationMayChange: Boolean
): DefaultTrackSelector.Parameters.Builder!

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

Parameters
context: Context!

Any context.

viewportOrientationMayChange: Boolean

Whether the viewport orientation may change during playback.

Protected functions

set

@CanIgnoreReturnValue
protected fun set(parameters: TrackSelectionParameters!): DefaultTrackSelector.Parameters.Builder!

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