Class TrackSelectionParameters
- java.lang.Object
-
- com.google.android.exoplayer2.trackselection.TrackSelectionParameters
-
- All Implemented Interfaces:
Bundleable
- Direct Known Subclasses:
DefaultTrackSelector.Parameters
public class TrackSelectionParameters extends Object implements Bundleable
Constraint parameters for track selection.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("deu") .build(); // Set the new parameters. player.setTrackSelectionParameters(newParameters);
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TrackSelectionParameters.Builder
A builder forTrackSelectionParameters
.-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Bundleable
Bundleable.Creator<T extends Bundleable>
-
-
Field Summary
Fields Modifier and Type Field Description static Bundleable.Creator<TrackSelectionParameters>
CREATOR
Object that can restoreTrackSelectionParameters
from aBundle
.static TrackSelectionParameters
DEFAULT
Deprecated.This instance is not configured usingContext
constraints.static TrackSelectionParameters
DEFAULT_WITHOUT_CONTEXT
An instance with default values, except those obtained from theContext
.ImmutableSet<@TrackType Integer>
disabledTrackTypes
The track types that are disabled.boolean
forceHighestSupportedBitrate
Whether to force selection of the highest bitrate audio and video tracks that comply with all other constraints.boolean
forceLowestBitrate
Whether to force selection of the single lowest bitrate audio and video tracks that comply with all other constraints.int
maxAudioBitrate
Maximum allowed audio bitrate in bits per second.int
maxAudioChannelCount
Maximum allowed audio channel count.int
maxVideoBitrate
Maximum allowed video bitrate in bits per second.int
maxVideoFrameRate
Maximum allowed video frame rate in hertz.int
maxVideoHeight
Maximum allowed video height in pixels.int
maxVideoWidth
Maximum allowed video width in pixels.int
minVideoBitrate
Minimum allowed video bitrate in bits per second.int
minVideoFrameRate
Minimum allowed video frame rate in hertz.int
minVideoHeight
Minimum allowed video height in pixels.int
minVideoWidth
Minimum allowed video width in pixels.ImmutableList<String>
preferredAudioLanguages
The preferred languages for audio and forced text tracks as IETF BCP 47 conformant tags in order of preference.ImmutableList<String>
preferredAudioMimeTypes
The preferred sample MIME types for audio tracks in order of preference, or an empty list for no preference.@com.google.android.exoplayer2.C.RoleFlags int
preferredAudioRoleFlags
The preferredC.RoleFlags
for audio tracks.ImmutableList<String>
preferredTextLanguages
The preferred languages for text tracks as IETF BCP 47 conformant tags in order of preference.@com.google.android.exoplayer2.C.RoleFlags int
preferredTextRoleFlags
The preferredC.RoleFlags
for text tracks.ImmutableList<String>
preferredVideoMimeTypes
The preferred sample MIME types for video tracks in order of preference, or an empty list for no preference.boolean
selectUndeterminedTextLanguage
Whether a text track with undetermined language should be selected if no track withpreferredTextLanguages
is available, or ifpreferredTextLanguages
is unset.TrackSelectionOverrides
trackSelectionOverrides
Overrides to force tracks to be selected.int
viewportHeight
Viewport height in pixels.boolean
viewportOrientationMayChange
Whether the viewport orientation may change during playback.int
viewportWidth
Viewport width in pixels.
-
Constructor Summary
Constructors Modifier Constructor Description protected
TrackSelectionParameters(TrackSelectionParameters.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TrackSelectionParameters.Builder
buildUpon()
Creates a newTrackSelectionParameters.Builder
, copying the initial values from this instance.boolean
equals(Object obj)
static TrackSelectionParameters
getDefaults(Context context)
Returns an instance configured with default values.int
hashCode()
Bundle
toBundle()
Returns aBundle
representing the information stored in this object.
-
-
-
Field Detail
-
DEFAULT_WITHOUT_CONTEXT
public static final TrackSelectionParameters DEFAULT_WITHOUT_CONTEXT
An instance with default values, except those obtained from theContext
.If possible, use
getDefaults(Context)
instead.This instance will not have the following settings:
Viewport constraints
configured for the primary display.Preferred text language and role flags
configured to the accessibility settings ofCaptioningManager
.
-
DEFAULT
@Deprecated public static final TrackSelectionParameters DEFAULT
Deprecated.This instance is not configured usingContext
constraints. UsegetDefaults(Context)
instead.
-
maxVideoWidth
public final int maxVideoWidth
Maximum allowed video width in pixels. The default value isInteger.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
andviewportOrientationMayChange
) instead.
-
maxVideoHeight
public final int maxVideoHeight
Maximum allowed video height in pixels. The default value isInteger.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
andviewportOrientationMayChange
) instead.
-
maxVideoFrameRate
public final int maxVideoFrameRate
Maximum allowed video frame rate in hertz. The default value isInteger.MAX_VALUE
(i.e. no constraint).
-
maxVideoBitrate
public final int maxVideoBitrate
Maximum allowed video bitrate in bits per second. The default value isInteger.MAX_VALUE
(i.e. no constraint).
-
minVideoWidth
public final int minVideoWidth
Minimum allowed video width in pixels. The default value is 0 (i.e. no constraint).
-
minVideoHeight
public final int minVideoHeight
Minimum allowed video height in pixels. The default value is 0 (i.e. no constraint).
-
minVideoFrameRate
public final int minVideoFrameRate
Minimum allowed video frame rate in hertz. The default value is 0 (i.e. no constraint).
-
minVideoBitrate
public final int minVideoBitrate
Minimum allowed video bitrate in bits per second. The default value is 0 (i.e. no constraint).
-
viewportWidth
public final int viewportWidth
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.
-
viewportHeight
public final int viewportHeight
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
public final boolean viewportOrientationMayChange
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 istrue
.
-
preferredVideoMimeTypes
public final ImmutableList<String> preferredVideoMimeTypes
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.
-
preferredAudioLanguages
public final ImmutableList<String> preferredAudioLanguages
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.
-
preferredAudioRoleFlags
@RoleFlags public final @com.google.android.exoplayer2.C.RoleFlags int preferredAudioRoleFlags
The preferredC.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 is0
.
-
maxAudioChannelCount
public final int maxAudioChannelCount
Maximum allowed audio channel count. The default value isInteger.MAX_VALUE
(i.e. no constraint).
-
maxAudioBitrate
public final int maxAudioBitrate
Maximum allowed audio bitrate in bits per second. The default value isInteger.MAX_VALUE
(i.e. no constraint).
-
preferredAudioMimeTypes
public final ImmutableList<String> preferredAudioMimeTypes
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.
-
preferredTextLanguages
public final ImmutableList<String> preferredTextLanguages
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, or the language of the accessibilityCaptioningManager
if enabled.
-
preferredTextRoleFlags
@RoleFlags public final @com.google.android.exoplayer2.C.RoleFlags int preferredTextRoleFlags
The preferredC.RoleFlags
for text tracks.0
selects the default track if there is one, or no track otherwise. The default value is0
, orC.ROLE_FLAG_SUBTITLE
|C.ROLE_FLAG_DESCRIBES_MUSIC_AND_SOUND
if the accessibilityCaptioningManager
is enabled.
-
selectUndeterminedTextLanguage
public final boolean selectUndeterminedTextLanguage
Whether a text track with undetermined language should be selected if no track withpreferredTextLanguages
is available, or ifpreferredTextLanguages
is unset. The default value isfalse
.
-
forceLowestBitrate
public final boolean forceLowestBitrate
Whether to force selection of the single lowest bitrate audio and video tracks that comply with all other constraints. The default value isfalse
.
-
forceHighestSupportedBitrate
public final boolean forceHighestSupportedBitrate
Whether to force selection of the highest bitrate audio and video tracks that comply with all other constraints. The default value isfalse
.
-
trackSelectionOverrides
public final TrackSelectionOverrides trackSelectionOverrides
Overrides to force tracks to be selected.
-
disabledTrackTypes
public final ImmutableSet<@TrackType Integer> disabledTrackTypes
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).
-
CREATOR
public static final Bundleable.Creator<TrackSelectionParameters> CREATOR
Object that can restoreTrackSelectionParameters
from aBundle
.
-
-
Constructor Detail
-
TrackSelectionParameters
protected TrackSelectionParameters(TrackSelectionParameters.Builder builder)
-
-
Method Detail
-
getDefaults
public static TrackSelectionParameters getDefaults(Context context)
Returns an instance configured with default values.
-
buildUpon
public TrackSelectionParameters.Builder buildUpon()
Creates a newTrackSelectionParameters.Builder
, copying the initial values from this instance.
-
toBundle
public Bundle toBundle()
Description copied from interface:Bundleable
Returns aBundle
representing the information stored in this object.- Specified by:
toBundle
in interfaceBundleable
-
-