DefaultTrackSelector.Parameters


public final class DefaultTrackSelector.Parameters extends TrackSelectionParameters


Extends Parameters by adding fields that are specific to DefaultTrackSelector.

Summary

Nested types

A builder for Parameters.

Constants

static final DefaultTrackSelector.Parameters

This field is deprecated.

This instance is not configured using Context constraints.

static final DefaultTrackSelector.Parameters

An instance with default values, except those obtained from the Context.

Public fields

final boolean

Whether to allow adaptive audio selections containing mixed channel counts.

final boolean

Whether to allow adaptive audio selections with mixed levels of and .

final boolean

Whether to allow adaptive audio selections containing mixed MIME types.

final boolean

Whether to allow adaptive audio selections containing mixed sample rates.

final boolean

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

final boolean

Whether to allow to invalidate selections on renderer capabilities change.

final boolean

Whether multiple adaptive selections with more than one track are allowed.

final boolean

Whether to allow adaptive video selections with mixed levels of and .

final boolean

Whether to allow adaptive video selections containing mixed MIME types.

final boolean

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

final boolean

Whether to constrain audio track selection so that the selected track's channel count does not exceed the device's output capabilities.

final boolean

Whether to exceed the maxAudioChannelCount and maxAudioBitrate constraints when no selection can be made otherwise.

final boolean

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

final boolean

Whether to exceed the maxVideoWidth, maxVideoHeight and maxVideoBitrate constraints when no selection can be made otherwise.

final boolean

Whether to enable tunneling if possible.

Public methods

DefaultTrackSelector.Parameters.Builder

Creates a new Parameters.Builder, copying the initial values from this instance.

boolean
static DefaultTrackSelector.Parameters

Restores a Parameters from a Bundle.

static DefaultTrackSelector.Parameters

Returns an instance configured with default values.

boolean
getRendererDisabled(int rendererIndex)

Returns whether the renderer is disabled.

@Nullable DefaultTrackSelector.SelectionOverride
getSelectionOverride(int rendererIndex, TrackGroupArray groups)

This method is deprecated.

Only works to retrieve the overrides set with the deprecated setSelectionOverride.

boolean
hasSelectionOverride(int rendererIndex, TrackGroupArray groups)

This method is deprecated.

Only works to retrieve the overrides set with the deprecated setSelectionOverride.

int
Bundle

Inherited Constants

From androidx.media3.common.TrackSelectionParameters
static final TrackSelectionParameters

This field is deprecated.

This instance is not configured using Context constraints.

static final TrackSelectionParameters

An instance with default values, except those obtained from the Context.

static final int

Defines a minimum field ID value for subclasses to use when implementing toBundle and delegating to Builder.

Inherited fields

From androidx.media3.common.TrackSelectionParameters
final TrackSelectionParameters.AudioOffloadPreferences

The preferred offload mode settings for audio playback.

final ImmutableSet<@C.TrackType Integer>

The track types that are disabled.

final boolean

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

final boolean

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

final int

Bitmask of selection flags that are ignored for text track selections.

final boolean

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

final int

Maximum allowed audio bitrate in bits per second.

final int

Maximum allowed audio channel count.

final int

Maximum allowed video bitrate in bits per second.

final int

Maximum allowed video frame rate in hertz.

final int

Maximum allowed video height in pixels.

final int

Maximum allowed video width in pixels.

final int

Minimum allowed video bitrate in bits per second.

final int

Minimum allowed video frame rate in hertz.

final int

Minimum allowed video height in pixels.

final int

Minimum allowed video width in pixels.

final ImmutableMap<TrackGroupTrackSelectionOverride>

Overrides to force selection of specific tracks.

final ImmutableList<String>

The preferred languages for audio and forced text tracks as IETF BCP 47 conformant tags in order of preference.

final ImmutableList<String>

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

final int

The preferred C.RoleFlags for audio tracks.

final ImmutableList<String>

The preferred languages for text tracks as IETF BCP 47 conformant tags in order of preference.

final int

The preferred C.RoleFlags for text tracks.

final ImmutableList<String>

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

final int

The preferred C.RoleFlags for video tracks.

final boolean

Whether a text track with undetermined language should be selected if no track with preferredTextLanguages is available, or if preferredTextLanguages is unset.

final int

Viewport height in pixels.

final boolean

Whether the viewport orientation may change during playback.

final int

Viewport width in pixels.

Inherited methods

From androidx.media3.common.TrackSelectionParameters
static TrackSelectionParameters

Construct an instance from a Bundle produced by toBundle.

static TrackSelectionParameters

Returns an instance configured with default values.

Constants

DEFAULT

public static final DefaultTrackSelector.Parameters DEFAULT

DEFAULT_WITHOUT_CONTEXT

public static final DefaultTrackSelector.Parameters DEFAULT_WITHOUT_CONTEXT

An instance with default values, except those obtained from the Context.

If possible, use getDefaults instead.

This instance will not have the following settings:

Public fields

allowAudioMixedChannelCountAdaptiveness

public final boolean allowAudioMixedChannelCountAdaptiveness

Whether to allow adaptive audio selections containing mixed channel counts. Adaptations between different channel counts may not be completely seamless. The default value is false.

allowAudioMixedDecoderSupportAdaptiveness

public final boolean allowAudioMixedDecoderSupportAdaptiveness

Whether to allow adaptive audio selections with mixed levels of and .

allowAudioMixedMimeTypeAdaptiveness

public final boolean allowAudioMixedMimeTypeAdaptiveness

Whether to allow adaptive audio selections containing mixed MIME types. Adaptations between different MIME types may not be completely seamless, in which case allowAudioNonSeamlessAdaptiveness also needs to be true for mixed MIME type selections to be made. The default value is false.

allowAudioMixedSampleRateAdaptiveness

public final boolean allowAudioMixedSampleRateAdaptiveness

Whether to allow adaptive audio selections containing mixed sample rates. Adaptations between different sample rates may not be completely seamless. The default value is false.

allowAudioNonSeamlessAdaptiveness

public final boolean allowAudioNonSeamlessAdaptiveness

Whether to allow adaptive audio selections where adaptation may not be completely seamless. The default value is true.

allowInvalidateSelectionsOnRendererCapabilitiesChange

public final boolean allowInvalidateSelectionsOnRendererCapabilitiesChange

Whether to allow to invalidate selections on renderer capabilities change. The default value is false.

allowMultipleAdaptiveSelections

public final boolean allowMultipleAdaptiveSelections

Whether multiple adaptive selections with more than one track are allowed. The default value is true.

Note that tracks are only eligible for adaptation if they define a bitrate, the renderers support the tracks and allow adaptation between them, and they are not excluded based on other track selection parameters.

allowVideoMixedDecoderSupportAdaptiveness

public final boolean allowVideoMixedDecoderSupportAdaptiveness

Whether to allow adaptive video selections with mixed levels of and .

allowVideoMixedMimeTypeAdaptiveness

public final boolean allowVideoMixedMimeTypeAdaptiveness

Whether to allow adaptive video selections containing mixed MIME types. Adaptations between different MIME types may not be completely seamless, in which case allowVideoNonSeamlessAdaptiveness also needs to be true for mixed MIME type selections to be made. The default value is false.

allowVideoNonSeamlessAdaptiveness

public final boolean allowVideoNonSeamlessAdaptiveness

Whether to allow adaptive video selections where adaptation may not be completely seamless. The default value is true.

constrainAudioChannelCountToDeviceCapabilities

public final boolean constrainAudioChannelCountToDeviceCapabilities

Whether to constrain audio track selection so that the selected track's channel count does not exceed the device's output capabilities. The default value is true.

exceedAudioConstraintsIfNecessary

public final boolean exceedAudioConstraintsIfNecessary

Whether to exceed the maxAudioChannelCount and maxAudioBitrate constraints when no selection can be made otherwise. The default value is true.

exceedRendererCapabilitiesIfNecessary

public final boolean exceedRendererCapabilitiesIfNecessary

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. The default value is true.

exceedVideoConstraintsIfNecessary

public final boolean exceedVideoConstraintsIfNecessary

Whether to exceed the maxVideoWidth, maxVideoHeight and maxVideoBitrate constraints when no selection can be made otherwise. The default value is true.

tunnelingEnabled

public final boolean tunnelingEnabled

Whether to enable tunneling if possible.

Public methods

buildUpon

public DefaultTrackSelector.Parameters.Builder buildUpon()

Creates a new Parameters.Builder, copying the initial values from this instance.

equals

public boolean equals(@Nullable Object obj)

fromBundle

public static DefaultTrackSelector.Parameters fromBundle(Bundle bundle)

Restores a Parameters from a Bundle.

getDefaults

public static DefaultTrackSelector.Parameters getDefaults(Context context)

Returns an instance configured with default values.

getRendererDisabled

public boolean getRendererDisabled(int rendererIndex)

Returns whether the renderer is disabled.

Parameters
int rendererIndex

The renderer index.

Returns
boolean

Whether the renderer is disabled.

getSelectionOverride

public @Nullable DefaultTrackSelector.SelectionOverride getSelectionOverride(int rendererIndex, TrackGroupArray groups)

Returns the override for the specified renderer and TrackGroupArray.

Parameters
int rendererIndex

The renderer index.

TrackGroupArray groups

The TrackGroupArray.

Returns
@Nullable DefaultTrackSelector.SelectionOverride

The override, or null if no override exists.

hasSelectionOverride

public boolean hasSelectionOverride(int rendererIndex, TrackGroupArray groups)

Returns whether there is an override for the specified renderer and TrackGroupArray.

Parameters
int rendererIndex

The renderer index.

TrackGroupArray groups

The TrackGroupArray.

Returns
boolean

Whether there is an override.

hashCode

public int hashCode()

toBundle

public Bundle toBundle()