TrackSelectionParameters
class TrackSelectionParameters
DefaultTrackSelector.Parameters |
Extends |
Parameters for controlling track selection.
Parameters can be queried and set on a Player. For example the following code modifies the parameters to restrict video track selections to SD, and to select a German audio track if there is one:
// Build on the current parameters. TrackSelectionParameters currentParameters = player.getTrackSelectionParameters(); // Build the resulting parameters. TrackSelectionParameters newParameters = currentParameters .buildUpon() .setMaxVideoSizeSd() .setPreferredAudioLanguage("de") .build(); // Set the new parameters. player.setTrackSelectionParameters(newParameters);
Summary
Nested types |
|---|
|
Preferences and constraints for enabling audio offload. |
@DocumentedThe preference level for enabling audio offload on the audio sink. |
|
A builder for |
|
A builder for |
Constants |
|
|---|---|
const TrackSelectionParameters! |
An instance with default parameters. |
const TrackSelectionParameters! |
This property is deprecated. Use |
const Int |
@UnstableApiDefines a minimum field ID value for subclasses to use when implementing |
Protected constructors |
|---|
Public functions |
|
|---|---|
TrackSelectionParameters.Builder! |
Creates a new |
Boolean |
|
java-static TrackSelectionParameters! |
fromBundle(bundle: Bundle!) |
java-static TrackSelectionParameters! |
This function is deprecated. Use |
Int |
hashCode() |
Bundle! |
Public properties |
|
|---|---|
TrackSelectionParameters.AudioOffloadPreferences! |
The preferred offload mode settings for audio playback. |
ImmutableSet<@C.TrackType Int!>! |
The track types that are disabled. |
Boolean |
Whether to force selection of the highest bitrate audio and video tracks that comply with all other constraints. |
Boolean |
Whether to force selection of the single lowest bitrate audio and video tracks that comply with all other constraints. |
Int |
Bitmask of selection flags that are ignored for text track selections. |
Boolean |
Whether an image track will be selected over a video track if both are available. |
Boolean |
Whether the viewport size should be assumed to the physical display size if no other specific viewport size constraint is specified. |
Int |
Maximum allowed audio bitrate in bits per second. |
Int |
Maximum allowed audio channel count. |
Int |
Maximum allowed video bitrate in bits per second. |
Int |
Maximum allowed video frame rate in hertz. |
Int |
Maximum allowed video height in pixels. |
Int |
Maximum allowed video width in pixels. |
Int |
Minimum allowed video bitrate in bits per second. |
Int |
Minimum allowed video frame rate in hertz. |
Int |
Minimum allowed video height in pixels. |
Int |
Minimum allowed video width in pixels. |
ImmutableMap<TrackGroup!, TrackSelectionOverride!>! |
Overrides to force selection of specific tracks. |
ImmutableList<String!>! |
The preferred labels for audio tracks in order of preference, or an empty list for no preference. |
ImmutableList<String!>! |
The preferred languages for audio and forced text tracks as IETF BCP 47 conformant tags in order of preference. |
ImmutableList<String!>! |
The preferred sample MIME types for audio tracks in order of preference, or an empty list for no preference. |
Int |
The preferred |
ImmutableList<String!>! |
The preferred labels for text tracks in order of preference, or an empty list for no preference. |
ImmutableList<String!>! |
The preferred languages for text tracks as IETF BCP 47 conformant tags in order of preference. |
Int |
The preferred |
ImmutableList<String!>! |
The preferred labels for video tracks in order of preference, or an empty list for no preference. |
ImmutableList<String!>! |
The preferred languages for video tracks as IETF BCP 47 conformant tags in order of preference. |
ImmutableList<String!>! |
The preferred sample MIME types for video tracks in order of preference, or an empty list for no preference. |
Int |
The preferred |
Boolean |
Prefer to select any text track by default. |
Boolean |
Whether a text track with undetermined language should be selected if no track with |
Boolean |
Whether the preferred languages and the preferred role flags for text tracks should be set according the |
Int |
Viewport height in pixels. |
Boolean |
Whether the viewport orientation may change during playback. |
Int |
Viewport width in pixels. |
Constants
DEFAULT
@UnstableApi
const val DEFAULT: TrackSelectionParameters!
An instance with default parameters.
FIELD_CUSTOM_ID_BASE
@UnstableApi
protected const val FIELD_CUSTOM_ID_BASE = 1000: Int
Defines a minimum field ID value for subclasses to use when implementing toBundle and delegating to Builder.
Subclasses should obtain keys for their Bundle representation by applying a non-negative offset on this constant and passing the result to intToStringMaxRadix.
Protected constructors
TrackSelectionParameters
@UnstableApi
protected TrackSelectionParameters(builder: TrackSelectionParameters.Builder!)
Public functions
buildUpon
fun buildUpon(): TrackSelectionParameters.Builder!
Creates a new Builder, copying the initial values from this instance.
Public properties
audioOffloadPreferences
@UnstableApi
val audioOffloadPreferences: TrackSelectionParameters.AudioOffloadPreferences!
The preferred offload mode settings for audio playback. The default is DEFAULT.
disabledTrackTypes
val disabledTrackTypes: ImmutableSet<@C.TrackType Int!>!
The track types that are disabled. No track of a disabled type will be selected, thus no track type contained in the set will be played. The default value is that no track type is disabled (empty set).
forceHighestSupportedBitrate
val forceHighestSupportedBitrate: Boolean
Whether to force selection of the highest bitrate audio and video tracks that comply with all other constraints. The default value is false.
forceLowestBitrate
val forceLowestBitrate: Boolean
Whether to force selection of the single lowest bitrate audio and video tracks that comply with all other constraints. The default value is false.
ignoredTextSelectionFlags
@C.SelectionFlags
val ignoredTextSelectionFlags: Int
Bitmask of selection flags that are ignored for text track selections. See C.SelectionFlags. The default value is 0 (i.e., no flags are ignored).
isPrioritizeImageOverVideoEnabled
@UnstableApi
val isPrioritizeImageOverVideoEnabled: Boolean
Whether an image track will be selected over a video track if both are available. The default value is false.
isViewportSizeLimitedByPhysicalDisplaySize
val isViewportSizeLimitedByPhysicalDisplaySize: Boolean
Whether the viewport size should be assumed to the physical display size if no other specific viewport size constraint is specified. Constrains video track selections for adaptive content so that only tracks suitable for the viewport are selected. The default value is true.
maxAudioBitrate
val maxAudioBitrate: Int
Maximum allowed audio bitrate in bits per second. The default value is MAX_VALUE (i.e. no constraint).
maxAudioChannelCount
val maxAudioChannelCount: Int
Maximum allowed audio channel count. The default value is MAX_VALUE (i.e. no constraint).
maxVideoBitrate
val maxVideoBitrate: Int
Maximum allowed video bitrate in bits per second. The default value is MAX_VALUE (i.e. no constraint).
maxVideoFrameRate
val maxVideoFrameRate: Int
Maximum allowed video frame rate in hertz. The default value is MAX_VALUE (i.e. no constraint).
maxVideoHeight
val maxVideoHeight: Int
Maximum allowed video height in pixels. The default value is MAX_VALUE (i.e. no constraint).
To constrain adaptive video track selections to be suitable for a given viewport (the region of the display within which video will be played), use (viewportWidth, viewportHeight and viewportOrientationMayChange) instead.
maxVideoWidth
val maxVideoWidth: Int
Maximum allowed video width in pixels. The default value is MAX_VALUE (i.e. no constraint).
To constrain adaptive video track selections to be suitable for a given viewport (the region of the display within which video will be played), use (viewportWidth, viewportHeight and viewportOrientationMayChange) instead.
minVideoBitrate
val minVideoBitrate: Int
Minimum allowed video bitrate in bits per second. The default value is 0 (i.e. no constraint).
minVideoFrameRate
val minVideoFrameRate: Int
Minimum allowed video frame rate in hertz. The default value is 0 (i.e. no constraint).
minVideoHeight
val minVideoHeight: Int
Minimum allowed video height in pixels. The default value is 0 (i.e. no constraint).
minVideoWidth
val minVideoWidth: Int
Minimum allowed video width in pixels. The default value is 0 (i.e. no constraint).
overrides
val overrides: ImmutableMap<TrackGroup!, TrackSelectionOverride!>!
Overrides to force selection of specific tracks.
preferredAudioLabels
@UnstableApi
val preferredAudioLabels: ImmutableList<String!>!
The preferred labels for audio tracks in order of preference, or an empty list for no preference. The default is an empty list.
preferredAudioLanguages
val preferredAudioLanguages: ImmutableList<String!>!
The preferred languages for audio and forced text tracks as IETF BCP 47 conformant tags in order of preference. An empty list selects the default track, or the first track if there's no default. The default value is an empty list.
preferredAudioMimeTypes
val preferredAudioMimeTypes: ImmutableList<String!>!
The preferred sample MIME types for audio tracks in order of preference, or an empty list for no preference. The default is an empty list.
preferredAudioRoleFlags
@C.RoleFlags
val preferredAudioRoleFlags: Int
The preferred C.RoleFlags for audio tracks. 0 selects the default track if there is one, or the first track if there's no default. The default value is 0.
preferredTextLabels
@UnstableApi
val preferredTextLabels: ImmutableList<String!>!
The preferred labels for text tracks in order of preference, or an empty list for no preference. The default is an empty list.
preferredTextLanguages
val preferredTextLanguages: ImmutableList<String!>!
The preferred languages for text tracks as IETF BCP 47 conformant tags in order of preference. An empty list selects the default track if there is one, or no track otherwise. The default value is an empty list.
preferredTextRoleFlags
@C.RoleFlags
val preferredTextRoleFlags: Int
The preferred C.RoleFlags for text tracks. 0 selects the default track if there is one, or no track otherwise. The default value is 0.
preferredVideoLabels
@UnstableApi
val preferredVideoLabels: ImmutableList<String!>!
The preferred labels for video tracks in order of preference, or an empty list for no preference. The default is an empty list.
preferredVideoLanguages
@UnstableApi
val preferredVideoLanguages: ImmutableList<String!>!
The preferred languages for video tracks as IETF BCP 47 conformant tags in order of preference.
preferredVideoMimeTypes
val preferredVideoMimeTypes: ImmutableList<String!>!
The preferred sample MIME types for video tracks in order of preference, or an empty list for no preference. The default is an empty list.
preferredVideoRoleFlags
@C.RoleFlags
val preferredVideoRoleFlags: Int
The preferred C.RoleFlags for video tracks. 0 selects the default track if there is one, or the first track if there's no default. The default value is 0.
selectTextByDefault
@UnstableApi
val selectTextByDefault: Boolean
Prefer to select any text track by default.
If false, text tracks are only selected if they match any of the other preference settings.
The default value is false.
selectUndeterminedTextLanguage
val selectUndeterminedTextLanguage: Boolean
Whether a text track with undetermined language should be selected if no track with preferredTextLanguages is available, or if preferredTextLanguages is unset. The default value is false.
usePreferredTextLanguagesAndRoleFlagsFromCaptioningManager
val usePreferredTextLanguagesAndRoleFlagsFromCaptioningManager: Boolean
Whether the preferred languages and the preferred role flags for text tracks should be set according the CaptioningManager preferences, if enabled in the system settings and no other explicit language or role flag preferences are specified. The default value is
true.
viewportHeight
val viewportHeight: Int
Viewport height in pixels. Constrains video track selections for adaptive content so that only tracks suitable for the viewport are selected. The default value is the physical height of the primary display, in pixels.
viewportOrientationMayChange
val viewportOrientationMayChange: Boolean
Whether the viewport orientation may change during playback. Constrains video track selections for adaptive content so that only tracks suitable for the viewport are selected. The default value is true.
viewportWidth
val viewportWidth: Int
Viewport width in pixels. Constrains video track selections for adaptive content so that only tracks suitable for the viewport are selected. The default value is the physical width of the primary display, in pixels.