Class DefaultTrackSelector.Parameters.Builder
- java.lang.Object
-
- com.google.android.exoplayer2.trackselection.TrackSelectionParameters.Builder
-
- com.google.android.exoplayer2.trackselection.DefaultTrackSelector.Parameters.Builder
-
- Enclosing class:
- DefaultTrackSelector.Parameters
public static final class DefaultTrackSelector.Parameters.Builder extends TrackSelectionParameters.Builder
A builder forDefaultTrackSelector.Parameters
. See theDefaultTrackSelector.Parameters
documentation for explanations of the parameters that can be configured using this builder.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DefaultTrackSelector.Parameters.Builder
addOverride(TrackSelectionOverride override)
Adds an override, replacing any override for the sameTrackGroup
.DefaultTrackSelector.Parameters
build()
Builds aDefaultTrackSelector.Parameters
instance with the selected values.DefaultTrackSelector.Parameters.Builder
clearOverride(TrackGroup trackGroup)
Removes the override for the provided mediaTrackGroup
, if there is one.DefaultTrackSelector.Parameters.Builder
clearOverrides()
Removes all overrides.DefaultTrackSelector.Parameters.Builder
clearOverridesOfType(@com.google.android.exoplayer2.C.TrackType int trackType)
Removes all overrides of the provided track type.DefaultTrackSelector.Parameters.Builder
clearSelectionOverride(int rendererIndex, TrackGroupArray groups)
Deprecated.DefaultTrackSelector.Parameters.Builder
clearSelectionOverrides()
Deprecated.DefaultTrackSelector.Parameters.Builder
clearSelectionOverrides(int rendererIndex)
Deprecated.DefaultTrackSelector.Parameters.Builder
clearVideoSizeConstraints()
Equivalent tosetMaxVideoSize(Integer.MAX_VALUE, Integer.MAX_VALUE)
.DefaultTrackSelector.Parameters.Builder
clearViewportSizeConstraints()
Equivalent tosetViewportSize(Integer.MAX_VALUE, Integer.MAX_VALUE, true)
.protected DefaultTrackSelector.Parameters.Builder
set(TrackSelectionParameters parameters)
Overrides the value of the builder with the value ofTrackSelectionParameters
.DefaultTrackSelector.Parameters.Builder
setAllowAudioMixedChannelCountAdaptiveness(boolean allowAudioMixedChannelCountAdaptiveness)
Sets whether to allow adaptive audio selections containing mixed channel counts.DefaultTrackSelector.Parameters.Builder
setAllowAudioMixedDecoderSupportAdaptiveness(boolean allowAudioMixedDecoderSupportAdaptiveness)
Sets whether to allow adaptive audio selections with mixed levels ofRendererCapabilities.DecoderSupport
andRendererCapabilities.HardwareAccelerationSupport
.DefaultTrackSelector.Parameters.Builder
setAllowAudioMixedMimeTypeAdaptiveness(boolean allowAudioMixedMimeTypeAdaptiveness)
Sets whether to allow adaptive audio selections containing mixed MIME types.DefaultTrackSelector.Parameters.Builder
setAllowAudioMixedSampleRateAdaptiveness(boolean allowAudioMixedSampleRateAdaptiveness)
Sets whether to allow adaptive audio selections containing mixed sample rates.DefaultTrackSelector.Parameters.Builder
setAllowInvalidateSelectionsOnRendererCapabilitiesChange(boolean allowInvalidateSelectionsOnRendererCapabilitiesChange)
Sets whether to allow to invalidate selections on renderer capabilities change.DefaultTrackSelector.Parameters.Builder
setAllowMultipleAdaptiveSelections(boolean allowMultipleAdaptiveSelections)
Sets whether multiple adaptive selections with more than one track are allowed.DefaultTrackSelector.Parameters.Builder
setAllowVideoMixedDecoderSupportAdaptiveness(boolean allowVideoMixedDecoderSupportAdaptiveness)
Sets whether to allow adaptive video selections with mixed levels ofRendererCapabilities.DecoderSupport
andRendererCapabilities.HardwareAccelerationSupport
.DefaultTrackSelector.Parameters.Builder
setAllowVideoMixedMimeTypeAdaptiveness(boolean allowVideoMixedMimeTypeAdaptiveness)
Sets whether to allow adaptive video selections containing mixed MIME types.DefaultTrackSelector.Parameters.Builder
setAllowVideoNonSeamlessAdaptiveness(boolean allowVideoNonSeamlessAdaptiveness)
Sets whether to allow adaptive video selections where adaptation may not be completely seamless.DefaultTrackSelector.Parameters.Builder
setConstrainAudioChannelCountToDeviceCapabilities(boolean enabled)
Whether to only select audio tracks with channel counts that don't exceed the device's output capabilities.DefaultTrackSelector.Parameters.Builder
setDisabledTextTrackSelectionFlags(@com.google.android.exoplayer2.C.SelectionFlags int disabledTextTrackSelectionFlags)
DefaultTrackSelector.Parameters.Builder
setDisabledTrackTypes(Set<@TrackType Integer> disabledTrackTypes)
Deprecated.DefaultTrackSelector.Parameters.Builder
setExceedAudioConstraintsIfNecessary(boolean exceedAudioConstraintsIfNecessary)
Sets whether to exceed thesetMaxAudioChannelCount(int)
andsetMaxAudioBitrate(int)
constraints when no selection can be made otherwise.DefaultTrackSelector.Parameters.Builder
setExceedRendererCapabilitiesIfNecessary(boolean exceedRendererCapabilitiesIfNecessary)
Sets whether to exceed renderer capabilities when no selection can be made otherwise.DefaultTrackSelector.Parameters.Builder
setExceedVideoConstraintsIfNecessary(boolean exceedVideoConstraintsIfNecessary)
Sets whether to exceed thesetMaxVideoBitrate(int)
,setMaxVideoSize(int, int)
andsetMaxVideoFrameRate(int)
constraints when no selection can be made otherwise.DefaultTrackSelector.Parameters.Builder
setForceHighestSupportedBitrate(boolean forceHighestSupportedBitrate)
Sets whether to force selection of the highest bitrate audio and video tracks that comply with all other constraints.DefaultTrackSelector.Parameters.Builder
setForceLowestBitrate(boolean forceLowestBitrate)
Sets whether to force selection of the single lowest bitrate audio and video tracks that comply with all other constraints.DefaultTrackSelector.Parameters.Builder
setIgnoredTextSelectionFlags(@com.google.android.exoplayer2.C.SelectionFlags int ignoredTextSelectionFlags)
Sets a bitmask of selection flags that are ignored for text track selections.DefaultTrackSelector.Parameters.Builder
setMaxAudioBitrate(int maxAudioBitrate)
Sets the maximum allowed audio bitrate.DefaultTrackSelector.Parameters.Builder
setMaxAudioChannelCount(int maxAudioChannelCount)
Sets the maximum allowed audio channel count.DefaultTrackSelector.Parameters.Builder
setMaxVideoBitrate(int maxVideoBitrate)
Sets the maximum allowed video bitrate.DefaultTrackSelector.Parameters.Builder
setMaxVideoFrameRate(int maxVideoFrameRate)
Sets the maximum allowed video frame rate.DefaultTrackSelector.Parameters.Builder
setMaxVideoSize(int maxVideoWidth, int maxVideoHeight)
Sets the maximum allowed video width and height.DefaultTrackSelector.Parameters.Builder
setMaxVideoSizeSd()
Equivalent tosetMaxVideoSize(1279, 719)
.DefaultTrackSelector.Parameters.Builder
setMinVideoBitrate(int minVideoBitrate)
Sets the minimum allowed video bitrate.DefaultTrackSelector.Parameters.Builder
setMinVideoFrameRate(int minVideoFrameRate)
Sets the minimum allowed video frame rate.DefaultTrackSelector.Parameters.Builder
setMinVideoSize(int minVideoWidth, int minVideoHeight)
Sets the minimum allowed video width and height.DefaultTrackSelector.Parameters.Builder
setOverrideForType(TrackSelectionOverride override)
Sets an override, replacing all existing overrides with the same track type.DefaultTrackSelector.Parameters.Builder
setPreferredAudioLanguage(String preferredAudioLanguage)
Sets the preferred language for audio and forced text tracks.DefaultTrackSelector.Parameters.Builder
setPreferredAudioLanguages(String... preferredAudioLanguages)
Sets the preferred languages for audio and forced text tracks.DefaultTrackSelector.Parameters.Builder
setPreferredAudioMimeType(String mimeType)
Sets the preferred sample MIME type for audio tracks.DefaultTrackSelector.Parameters.Builder
setPreferredAudioMimeTypes(String... mimeTypes)
Sets the preferred sample MIME types for audio tracks.DefaultTrackSelector.Parameters.Builder
setPreferredAudioRoleFlags(@com.google.android.exoplayer2.C.RoleFlags int preferredAudioRoleFlags)
Sets the preferredC.RoleFlags
for audio tracks.DefaultTrackSelector.Parameters.Builder
setPreferredTextLanguage(String preferredTextLanguage)
Sets the preferred language for text tracks.DefaultTrackSelector.Parameters.Builder
setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings(Context context)
Sets the preferred language and role flags for text tracks based on the accessibility settings ofCaptioningManager
.DefaultTrackSelector.Parameters.Builder
setPreferredTextLanguages(String... preferredTextLanguages)
Sets the preferred languages for text tracks.DefaultTrackSelector.Parameters.Builder
setPreferredTextRoleFlags(@com.google.android.exoplayer2.C.RoleFlags int preferredTextRoleFlags)
Sets the preferredC.RoleFlags
for text tracks.DefaultTrackSelector.Parameters.Builder
setPreferredVideoMimeType(String mimeType)
Sets the preferred sample MIME type for video tracks.DefaultTrackSelector.Parameters.Builder
setPreferredVideoMimeTypes(String... mimeTypes)
Sets the preferred sample MIME types for video tracks.DefaultTrackSelector.Parameters.Builder
setPreferredVideoRoleFlags(@com.google.android.exoplayer2.C.RoleFlags int preferredVideoRoleFlags)
Sets the preferredC.RoleFlags
for video tracks.DefaultTrackSelector.Parameters.Builder
setRendererDisabled(int rendererIndex, boolean disabled)
Sets whether the renderer at the specified index is disabled.DefaultTrackSelector.Parameters.Builder
setSelectionOverride(int rendererIndex, TrackGroupArray groups, DefaultTrackSelector.SelectionOverride override)
Deprecated.DefaultTrackSelector.Parameters.Builder
setSelectUndeterminedTextLanguage(boolean selectUndeterminedTextLanguage)
Sets whether a text track with undetermined language should be selected if no track witha preferred language
is available, or if the preferred language is unset.DefaultTrackSelector.Parameters.Builder
setTrackTypeDisabled(@com.google.android.exoplayer2.C.TrackType int trackType, boolean disabled)
Sets whether a track type is disabled.DefaultTrackSelector.Parameters.Builder
setTunnelingEnabled(boolean tunnelingEnabled)
Sets whether to enable tunneling if possible.DefaultTrackSelector.Parameters.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.DefaultTrackSelector.Parameters.Builder
setViewportSizeToPhysicalDisplaySize(Context context, boolean viewportOrientationMayChange)
Equivalent to callingTrackSelectionParameters.Builder.setViewportSize(int, int, boolean)
with the viewport size obtained fromUtil.getCurrentDisplayModeSize(Context)
.
-
-
-
Constructor Detail
-
Builder
@Deprecated public Builder()
Deprecated.Context
constraints will not be set using this constructor. UseBuilder(Context)
instead.
-
Builder
public Builder(Context context)
Creates a builder with default initial values.- Parameters:
context
- Any context.
-
-
Method Detail
-
set
@CanIgnoreReturnValue protected DefaultTrackSelector.Parameters.Builder set(TrackSelectionParameters parameters)
Description copied from class:TrackSelectionParameters.Builder
Overrides the value of the builder with the value ofTrackSelectionParameters
.- Overrides:
set
in classTrackSelectionParameters.Builder
-
setMaxVideoSizeSd
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setMaxVideoSizeSd()
Description copied from class:TrackSelectionParameters.Builder
Equivalent tosetMaxVideoSize(1279, 719)
.- Overrides:
setMaxVideoSizeSd
in classTrackSelectionParameters.Builder
- Returns:
- This builder.
-
clearVideoSizeConstraints
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder clearVideoSizeConstraints()
Description copied from class:TrackSelectionParameters.Builder
Equivalent tosetMaxVideoSize(Integer.MAX_VALUE, Integer.MAX_VALUE)
.- Overrides:
clearVideoSizeConstraints
in classTrackSelectionParameters.Builder
- Returns:
- This builder.
-
setMaxVideoSize
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setMaxVideoSize(int maxVideoWidth, int maxVideoHeight)
Description copied from class:TrackSelectionParameters.Builder
Sets the maximum allowed video width and height.- Overrides:
setMaxVideoSize
in classTrackSelectionParameters.Builder
- Parameters:
maxVideoWidth
- Maximum allowed video width in pixels.maxVideoHeight
- Maximum allowed video height in pixels.- Returns:
- This builder.
-
setMaxVideoFrameRate
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setMaxVideoFrameRate(int maxVideoFrameRate)
Description copied from class:TrackSelectionParameters.Builder
Sets the maximum allowed video frame rate.- Overrides:
setMaxVideoFrameRate
in classTrackSelectionParameters.Builder
- Parameters:
maxVideoFrameRate
- Maximum allowed video frame rate in hertz.- Returns:
- This builder.
-
setMaxVideoBitrate
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setMaxVideoBitrate(int maxVideoBitrate)
Description copied from class:TrackSelectionParameters.Builder
Sets the maximum allowed video bitrate.- Overrides:
setMaxVideoBitrate
in classTrackSelectionParameters.Builder
- Parameters:
maxVideoBitrate
- Maximum allowed video bitrate in bits per second.- Returns:
- This builder.
-
setMinVideoSize
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setMinVideoSize(int minVideoWidth, int minVideoHeight)
Description copied from class:TrackSelectionParameters.Builder
Sets the minimum allowed video width and height.- Overrides:
setMinVideoSize
in classTrackSelectionParameters.Builder
- Parameters:
minVideoWidth
- Minimum allowed video width in pixels.minVideoHeight
- Minimum allowed video height in pixels.- Returns:
- This builder.
-
setMinVideoFrameRate
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setMinVideoFrameRate(int minVideoFrameRate)
Description copied from class:TrackSelectionParameters.Builder
Sets the minimum allowed video frame rate.- Overrides:
setMinVideoFrameRate
in classTrackSelectionParameters.Builder
- Parameters:
minVideoFrameRate
- Minimum allowed video frame rate in hertz.- Returns:
- This builder.
-
setMinVideoBitrate
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setMinVideoBitrate(int minVideoBitrate)
Description copied from class:TrackSelectionParameters.Builder
Sets the minimum allowed video bitrate.- Overrides:
setMinVideoBitrate
in classTrackSelectionParameters.Builder
- Parameters:
minVideoBitrate
- Minimum allowed video bitrate in bits per second.- Returns:
- This builder.
-
setExceedVideoConstraintsIfNecessary
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setExceedVideoConstraintsIfNecessary(boolean exceedVideoConstraintsIfNecessary)
Sets whether to exceed thesetMaxVideoBitrate(int)
,setMaxVideoSize(int, int)
andsetMaxVideoFrameRate(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.
-
setAllowVideoMixedMimeTypeAdaptiveness
@CanIgnoreReturnValue 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
setAllowVideoNonSeamlessAdaptiveness(boolean)
also needs to betrue
for mixed MIME type selections to be made.- Parameters:
allowVideoMixedMimeTypeAdaptiveness
- Whether to allow adaptive video selections containing mixed MIME types.- Returns:
- This builder.
-
setAllowVideoNonSeamlessAdaptiveness
@CanIgnoreReturnValue 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.
-
setAllowVideoMixedDecoderSupportAdaptiveness
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setAllowVideoMixedDecoderSupportAdaptiveness(boolean allowVideoMixedDecoderSupportAdaptiveness)
Sets whether to allow adaptive video selections with mixed levels ofRendererCapabilities.DecoderSupport
andRendererCapabilities.HardwareAccelerationSupport
.- Parameters:
allowVideoMixedDecoderSupportAdaptiveness
- Whether to allow adaptive video selections with mixed levels of decoder and hardware acceleration support.- Returns:
- This builder.
-
setViewportSizeToPhysicalDisplaySize
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setViewportSizeToPhysicalDisplaySize(Context context, boolean viewportOrientationMayChange)
Description copied from class:TrackSelectionParameters.Builder
Equivalent to callingTrackSelectionParameters.Builder.setViewportSize(int, int, boolean)
with the viewport size obtained fromUtil.getCurrentDisplayModeSize(Context)
.- Overrides:
setViewportSizeToPhysicalDisplaySize
in classTrackSelectionParameters.Builder
- Parameters:
context
- Any context.viewportOrientationMayChange
- Whether the viewport orientation may change during playback.- Returns:
- This builder.
-
clearViewportSizeConstraints
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder clearViewportSizeConstraints()
Description copied from class:TrackSelectionParameters.Builder
Equivalent tosetViewportSize(Integer.MAX_VALUE, Integer.MAX_VALUE, true)
.- Overrides:
clearViewportSizeConstraints
in classTrackSelectionParameters.Builder
- Returns:
- This builder.
-
setViewportSize
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setViewportSize(int viewportWidth, int viewportHeight, boolean viewportOrientationMayChange)
Description copied from class:TrackSelectionParameters.Builder
Sets the viewport size to constrain adaptive video selections so that only tracks suitable for the viewport are selected.- Overrides:
setViewportSize
in classTrackSelectionParameters.Builder
- Parameters:
viewportWidth
- Viewport width in pixels.viewportHeight
- Viewport height in pixels.viewportOrientationMayChange
- Whether the viewport orientation may change during playback.- Returns:
- This builder.
-
setPreferredVideoMimeType
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setPreferredVideoMimeType(@Nullable String mimeType)
Description copied from class:TrackSelectionParameters.Builder
Sets the preferred sample MIME type for video tracks.- Overrides:
setPreferredVideoMimeType
in classTrackSelectionParameters.Builder
- Parameters:
mimeType
- The preferred MIME type for video tracks, ornull
to clear a previously set preference.- Returns:
- This builder.
-
setPreferredVideoMimeTypes
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setPreferredVideoMimeTypes(String... mimeTypes)
Description copied from class:TrackSelectionParameters.Builder
Sets the preferred sample MIME types for video tracks.- Overrides:
setPreferredVideoMimeTypes
in classTrackSelectionParameters.Builder
- Parameters:
mimeTypes
- The preferred MIME types for video tracks in order of preference, or an empty list for no preference.- Returns:
- This builder.
-
setPreferredVideoRoleFlags
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setPreferredVideoRoleFlags(@RoleFlags @com.google.android.exoplayer2.C.RoleFlags int preferredVideoRoleFlags)
Description copied from class:TrackSelectionParameters.Builder
Sets the preferredC.RoleFlags
for video tracks.- Overrides:
setPreferredVideoRoleFlags
in classTrackSelectionParameters.Builder
- Parameters:
preferredVideoRoleFlags
- Preferred video role flags.- Returns:
- This builder.
-
setPreferredAudioLanguage
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setPreferredAudioLanguage(@Nullable String preferredAudioLanguage)
Description copied from class:TrackSelectionParameters.Builder
Sets the preferred language for audio and forced text tracks.- Overrides:
setPreferredAudioLanguage
in classTrackSelectionParameters.Builder
- Parameters:
preferredAudioLanguage
- Preferred audio language as an IETF BCP 47 conformant tag, ornull
to select the default track, or the first track if there's no default.- Returns:
- This builder.
-
setPreferredAudioLanguages
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setPreferredAudioLanguages(String... preferredAudioLanguages)
Description copied from class:TrackSelectionParameters.Builder
Sets the preferred languages for audio and forced text tracks.- Overrides:
setPreferredAudioLanguages
in classTrackSelectionParameters.Builder
- 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.
-
setPreferredAudioRoleFlags
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setPreferredAudioRoleFlags(@RoleFlags @com.google.android.exoplayer2.C.RoleFlags int preferredAudioRoleFlags)
Description copied from class:TrackSelectionParameters.Builder
Sets the preferredC.RoleFlags
for audio tracks.- Overrides:
setPreferredAudioRoleFlags
in classTrackSelectionParameters.Builder
- Parameters:
preferredAudioRoleFlags
- Preferred audio role flags.- Returns:
- This builder.
-
setMaxAudioChannelCount
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setMaxAudioChannelCount(int maxAudioChannelCount)
Description copied from class:TrackSelectionParameters.Builder
Sets the maximum allowed audio channel count.- Overrides:
setMaxAudioChannelCount
in classTrackSelectionParameters.Builder
- Parameters:
maxAudioChannelCount
- Maximum allowed audio channel count.- Returns:
- This builder.
-
setMaxAudioBitrate
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setMaxAudioBitrate(int maxAudioBitrate)
Description copied from class:TrackSelectionParameters.Builder
Sets the maximum allowed audio bitrate.- Overrides:
setMaxAudioBitrate
in classTrackSelectionParameters.Builder
- Parameters:
maxAudioBitrate
- Maximum allowed audio bitrate in bits per second.- Returns:
- This builder.
-
setExceedAudioConstraintsIfNecessary
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setExceedAudioConstraintsIfNecessary(boolean exceedAudioConstraintsIfNecessary)
Sets whether to exceed thesetMaxAudioChannelCount(int)
andsetMaxAudioBitrate(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.
-
setAllowAudioMixedMimeTypeAdaptiveness
@CanIgnoreReturnValue 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.
- Parameters:
allowAudioMixedMimeTypeAdaptiveness
- Whether to allow adaptive audio selections containing mixed MIME types.- Returns:
- This builder.
-
setAllowAudioMixedSampleRateAdaptiveness
@CanIgnoreReturnValue 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.
-
setAllowAudioMixedChannelCountAdaptiveness
@CanIgnoreReturnValue 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.
-
setAllowAudioMixedDecoderSupportAdaptiveness
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setAllowAudioMixedDecoderSupportAdaptiveness(boolean allowAudioMixedDecoderSupportAdaptiveness)
Sets whether to allow adaptive audio selections with mixed levels ofRendererCapabilities.DecoderSupport
andRendererCapabilities.HardwareAccelerationSupport
.- Parameters:
allowAudioMixedDecoderSupportAdaptiveness
- Whether to allow adaptive audio selections with mixed levels of decoder and hardware acceleration support.- Returns:
- This builder.
-
setPreferredAudioMimeType
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setPreferredAudioMimeType(@Nullable String mimeType)
Description copied from class:TrackSelectionParameters.Builder
Sets the preferred sample MIME type for audio tracks.- Overrides:
setPreferredAudioMimeType
in classTrackSelectionParameters.Builder
- Parameters:
mimeType
- The preferred MIME type for audio tracks, ornull
to clear a previously set preference.- Returns:
- This builder.
-
setPreferredAudioMimeTypes
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setPreferredAudioMimeTypes(String... mimeTypes)
Description copied from class:TrackSelectionParameters.Builder
Sets the preferred sample MIME types for audio tracks.- Overrides:
setPreferredAudioMimeTypes
in classTrackSelectionParameters.Builder
- Parameters:
mimeTypes
- The preferred MIME types for audio tracks in order of preference, or an empty list for no preference.- Returns:
- This builder.
-
setConstrainAudioChannelCountToDeviceCapabilities
@CanIgnoreReturnValue 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 istrue
.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 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 deprecatedDefaultTrackSelector(TrackSelectionParameters, ExoTrackSelection.Factory)
constructor.
-
setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings(Context context)
Description copied from class:TrackSelectionParameters.Builder
Sets the preferred language and role flags for text tracks based on the accessibility settings ofCaptioningManager
.Does nothing for API levels < 19 or when the
CaptioningManager
is disabled.- Overrides:
setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings
in classTrackSelectionParameters.Builder
- Parameters:
context
- AContext
.- Returns:
- This builder.
-
setPreferredTextLanguage
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setPreferredTextLanguage(@Nullable String preferredTextLanguage)
Description copied from class:TrackSelectionParameters.Builder
Sets the preferred language for text tracks.- Overrides:
setPreferredTextLanguage
in classTrackSelectionParameters.Builder
- Parameters:
preferredTextLanguage
- Preferred text language as an IETF BCP 47 conformant tag, ornull
to select the default track if there is one, or no track otherwise.- Returns:
- This builder.
-
setPreferredTextLanguages
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setPreferredTextLanguages(String... preferredTextLanguages)
Description copied from class:TrackSelectionParameters.Builder
Sets the preferred languages for text tracks.- Overrides:
setPreferredTextLanguages
in classTrackSelectionParameters.Builder
- 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.
-
setPreferredTextRoleFlags
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setPreferredTextRoleFlags(@RoleFlags @com.google.android.exoplayer2.C.RoleFlags int preferredTextRoleFlags)
Description copied from class:TrackSelectionParameters.Builder
Sets the preferredC.RoleFlags
for text tracks.- Overrides:
setPreferredTextRoleFlags
in classTrackSelectionParameters.Builder
- Parameters:
preferredTextRoleFlags
- Preferred text role flags.- Returns:
- This builder.
-
setIgnoredTextSelectionFlags
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setIgnoredTextSelectionFlags(@SelectionFlags @com.google.android.exoplayer2.C.SelectionFlags int ignoredTextSelectionFlags)
Description copied from class:TrackSelectionParameters.Builder
Sets a bitmask of selection flags that are ignored for text track selections.- Overrides:
setIgnoredTextSelectionFlags
in classTrackSelectionParameters.Builder
- Parameters:
ignoredTextSelectionFlags
- A bitmask ofC.SelectionFlags
that are ignored for text track selections.- Returns:
- This builder.
-
setSelectUndeterminedTextLanguage
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setSelectUndeterminedTextLanguage(boolean selectUndeterminedTextLanguage)
Description copied from class:TrackSelectionParameters.Builder
Sets whether a text track with undetermined language should be selected if no track witha preferred language
is available, or if the preferred language is unset.- Overrides:
setSelectUndeterminedTextLanguage
in classTrackSelectionParameters.Builder
- Parameters:
selectUndeterminedTextLanguage
- Whether a text track with undetermined language should be selected if no preferred language track is available.- Returns:
- This builder.
-
setDisabledTextTrackSelectionFlags
@CanIgnoreReturnValue @Deprecated public DefaultTrackSelector.Parameters.Builder setDisabledTextTrackSelectionFlags(@SelectionFlags @com.google.android.exoplayer2.C.SelectionFlags int disabledTextTrackSelectionFlags)
-
setForceLowestBitrate
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setForceLowestBitrate(boolean forceLowestBitrate)
Description copied from class:TrackSelectionParameters.Builder
Sets whether to force selection of the single lowest bitrate audio and video tracks that comply with all other constraints.- Overrides:
setForceLowestBitrate
in classTrackSelectionParameters.Builder
- Parameters:
forceLowestBitrate
- Whether to force selection of the single lowest bitrate audio and video tracks.- Returns:
- This builder.
-
setForceHighestSupportedBitrate
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setForceHighestSupportedBitrate(boolean forceHighestSupportedBitrate)
Description copied from class:TrackSelectionParameters.Builder
Sets whether to force selection of the highest bitrate audio and video tracks that comply with all other constraints.- Overrides:
setForceHighestSupportedBitrate
in classTrackSelectionParameters.Builder
- Parameters:
forceHighestSupportedBitrate
- Whether to force selection of the highest bitrate audio and video tracks.- Returns:
- This builder.
-
setAllowInvalidateSelectionsOnRendererCapabilitiesChange
@CanIgnoreReturnValue 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.
-
addOverride
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder addOverride(TrackSelectionOverride override)
Description copied from class:TrackSelectionParameters.Builder
Adds an override, replacing any override for the sameTrackGroup
.- Overrides:
addOverride
in classTrackSelectionParameters.Builder
-
clearOverride
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder clearOverride(TrackGroup trackGroup)
Description copied from class:TrackSelectionParameters.Builder
Removes the override for the provided mediaTrackGroup
, if there is one.- Overrides:
clearOverride
in classTrackSelectionParameters.Builder
-
setOverrideForType
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setOverrideForType(TrackSelectionOverride override)
Description copied from class:TrackSelectionParameters.Builder
Sets an override, replacing all existing overrides with the same track type.- Overrides:
setOverrideForType
in classTrackSelectionParameters.Builder
-
clearOverridesOfType
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder clearOverridesOfType(@com.google.android.exoplayer2.C.TrackType int trackType)
Description copied from class:TrackSelectionParameters.Builder
Removes all overrides of the provided track type.- Overrides:
clearOverridesOfType
in classTrackSelectionParameters.Builder
-
clearOverrides
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder clearOverrides()
Description copied from class:TrackSelectionParameters.Builder
Removes all overrides.- Overrides:
clearOverrides
in classTrackSelectionParameters.Builder
-
setDisabledTrackTypes
@CanIgnoreReturnValue @Deprecated public DefaultTrackSelector.Parameters.Builder setDisabledTrackTypes(Set<@TrackType Integer> disabledTrackTypes)
Deprecated.Description copied from class:TrackSelectionParameters.Builder
Sets the disabled track types, preventing all tracks of those types from being selected for playback. Any previously disabled track types are cleared.- Overrides:
setDisabledTrackTypes
in classTrackSelectionParameters.Builder
- Parameters:
disabledTrackTypes
- The track types to disable.- Returns:
- This builder.
-
setTrackTypeDisabled
@CanIgnoreReturnValue public DefaultTrackSelector.Parameters.Builder setTrackTypeDisabled(@com.google.android.exoplayer2.C.TrackType int trackType, boolean disabled)
Description copied from class:TrackSelectionParameters.Builder
Sets whether a track type is disabled. If disabled, no tracks of the specified type will be selected for playback.- Overrides:
setTrackTypeDisabled
in classTrackSelectionParameters.Builder
- Parameters:
trackType
- The track type.disabled
- Whether the track type should be disabled.- Returns:
- This builder.
-
setExceedRendererCapabilitiesIfNecessary
@CanIgnoreReturnValue 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. Iffalse
then no track will be selected.- Parameters:
exceedRendererCapabilitiesIfNecessary
- Whether to exceed renderer capabilities when no selection can be made otherwise.- Returns:
- This builder.
-
setTunnelingEnabled
@CanIgnoreReturnValue 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.
-
setAllowMultipleAdaptiveSelections
@CanIgnoreReturnValue 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.
-
setRendererDisabled
@CanIgnoreReturnValue 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.
-
setSelectionOverride
@CanIgnoreReturnValue @Deprecated public DefaultTrackSelector.Parameters.Builder setSelectionOverride(int rendererIndex, TrackGroupArray groups, @Nullable DefaultTrackSelector.SelectionOverride override)
Deprecated.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 theTrackGroupArray
does not match, the override has no effect. The override replaces any previous override for the specifiedTrackGroupArray
for the specifiedRenderer
.Passing a
null
override will cause the renderer to be disabled when theTrackGroupArray
mapped to it matches the one provided. When theTrackGroupArray
does not match anull
override has no effect. Hence anull
override differs from disabling the renderer usingsetRendererDisabled(int, boolean)
because the renderer is disabled conditionally on theTrackGroupArray
mapped to it, where-assetRendererDisabled(int, boolean)
disables the renderer unconditionally.To remove overrides use
clearSelectionOverride(int, TrackGroupArray)
,clearSelectionOverrides(int)
orclearSelectionOverrides()
.- Parameters:
rendererIndex
- The renderer index.groups
- TheTrackGroupArray
for which the override should be applied.override
- The override.- Returns:
- This builder.
-
clearSelectionOverride
@CanIgnoreReturnValue @Deprecated public DefaultTrackSelector.Parameters.Builder clearSelectionOverride(int rendererIndex, TrackGroupArray groups)
Deprecated.Clears a track selection override for the specified renderer andTrackGroupArray
.- Parameters:
rendererIndex
- The renderer index.groups
- TheTrackGroupArray
for which the override should be cleared.- Returns:
- This builder.
-
clearSelectionOverrides
@CanIgnoreReturnValue @Deprecated public DefaultTrackSelector.Parameters.Builder clearSelectionOverrides(int rendererIndex)
Deprecated.Clears all track selection overrides for the specified renderer.- Parameters:
rendererIndex
- The renderer index.- Returns:
- This builder.
-
clearSelectionOverrides
@CanIgnoreReturnValue @Deprecated public DefaultTrackSelector.Parameters.Builder clearSelectionOverrides()
Deprecated.Clears all track selection overrides for all renderers.- Returns:
- This builder.
-
build
public DefaultTrackSelector.Parameters build()
Builds aDefaultTrackSelector.Parameters
instance with the selected values.- Overrides:
build
in classTrackSelectionParameters.Builder
-
-