public class TrackSelectorHelper
extends java.lang.Object
MappingTrackSelector selector.| Constructor and Description |
|---|
TrackSelectorHelper(com.google.android.exoplayer2.ExoPlayer player,
com.google.android.exoplayer2.trackselection.DefaultTrackSelector trackSelector)
Instantiates a new Track selector helper.
|
| Modifier and Type | Method and Description |
|---|---|
void |
applySelectionOverride(int renderType,
SelectionOverrideCreator selectionOverrideCreator)
Creates a
DefaultTrackSelector.SelectionOverride with the
SelectionOverrideCreator and the render type. |
void |
disableTrack(int trackType)
Disables the Renderer track.
|
void |
enableTrack(int trackType)
Enables the Renderer track.
|
java.util.List<com.google.android.exoplayer2.Format> |
findOfflineFormatList(android.content.Context context,
java.util.List<com.google.android.exoplayer2.Format> formatList)
Filter the Format list parameter returning only those stored in the device.
|
java.util.Map<java.lang.Integer,java.lang.String> |
getAudioTracksIndexMap(android.content.Context context,
DeliveryType deliveryType,
boolean offline)
Creates a map from the Renderer of type
ExoPlayerVideoDisplayComponent.TYPE_AUDIO
with the track index and the language code. |
java.util.List<com.google.android.exoplayer2.Format> |
getAvailableFormatList(int trackType)
Gets the available
Format list by type. |
int |
getRendererIndex(int renderType)
Gets the renderer index.
|
java.lang.String |
getSelectedAudioLanguage()
Gets the selected audio language if any.
|
void |
selectAudio(java.lang.String language)
Selects the audio language in the
MappingTrackSelector if available. |
void |
selectCaption(BrightcoveCaptionFormat captions)
Selects the Brightcove caption in the @
MappingTrackSelector if available. |
void |
updateTracksSelectionArray(com.google.android.exoplayer2.trackselection.TrackSelectionArray trackSelections)
Updates the Track Selection array.
|
public TrackSelectorHelper(@NonNull
com.google.android.exoplayer2.ExoPlayer player,
@NonNull
com.google.android.exoplayer2.trackselection.DefaultTrackSelector trackSelector)
player - the playertrackSelector - the track selector@NonNull public java.util.List<com.google.android.exoplayer2.Format> getAvailableFormatList(int trackType)
Format list by type.trackType - the track typepublic void selectCaption(@NonNull
BrightcoveCaptionFormat captions)
MappingTrackSelector if available.captions - the captionspublic void selectAudio(@NonNull
java.lang.String language)
MappingTrackSelector if available.language - the languagepublic void applySelectionOverride(int renderType,
@NonNull
SelectionOverrideCreator selectionOverrideCreator)
Creates a DefaultTrackSelector.SelectionOverride with the
SelectionOverrideCreator and the render type. Such Selection Override will be set to the
TrackSelector.
If SelectionOverrideCreator returns SelectionOverrideCreator.EMPTY_SELECTION_OVERRIDE, the Selection Override
will be ignored.
renderType - the ExoPlayerVideoDisplayComponent.TrackTypeselectionOverrideCreator - the selection override creatorpublic java.lang.String getSelectedAudioLanguage()
public void updateTracksSelectionArray(@Nullable
com.google.android.exoplayer2.trackselection.TrackSelectionArray trackSelections)
trackSelections - the track selection arraypublic void enableTrack(int trackType)
trackType - the track typepublic void disableTrack(int trackType)
trackType - the track type@NonNull
public java.util.Map<java.lang.Integer,java.lang.String> getAudioTracksIndexMap(android.content.Context context,
DeliveryType deliveryType,
boolean offline)
ExoPlayerVideoDisplayComponent.TYPE_AUDIO
with the track index and the language code.deliveryType - the delivery typepublic int getRendererIndex(int renderType)
renderType - the render type@NonNull
public java.util.List<com.google.android.exoplayer2.Format> findOfflineFormatList(@NonNull
android.content.Context context,
@NonNull
java.util.List<com.google.android.exoplayer2.Format> formatList)
context - reference to the host application context.formatList - the format list