Package com.brightcove.player.render
Class TrackSelectorHelper
java.lang.Object
com.brightcove.player.render.TrackSelectorHelper
Helper class to do several operations with the
MappingTrackSelector selector.-
Constructor Summary
ConstructorsConstructorDescriptionTrackSelectorHelper(com.google.android.exoplayer2.ExoPlayer player, com.google.android.exoplayer2.trackselection.DefaultTrackSelector trackSelector) Instantiates a new Track selector helper. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplySelectionOverride(int renderType, SelectionOverrideCreator selectionOverrideCreator) Deprecated.voidapplyTrackSelectionOverrides(int renderType, TrackSelectionOverrideCreator trackSelectionOverrideCreator) Creates a {#TrackSelectionOverrides} with theTrackSelectionOverrideCreatorand the render type.voiddisableTrack(int trackType) Disables the Renderer track.voidenableTrack(int trackType) Enables the Renderer track.List<com.google.android.exoplayer2.Format>findOfflineFormatList(android.content.Context context, List<com.google.android.exoplayer2.Format> formatList) Filter the Format list parameter returning only those stored in the device.getAudioTracksIndexMap(android.content.Context context, DeliveryType deliveryType, boolean offline) Creates a map from the Renderer of typeExoPlayerVideoDisplayComponent.TYPE_AUDIOwith the track index and the language code.List<com.google.android.exoplayer2.Format>getAvailableFormatList(int trackType) Gets the availableFormatlist by type.intgetRendererIndex(int renderType) Gets the renderer index.Gets the selected audio language if any.voidselectAudio(String language) Selects the audio language in theMappingTrackSelectorif available.voidselectCaption(BrightcoveCaptionFormat captions) Selects the Brightcove caption in the @MappingTrackSelectorif available.voidupdateTracksGroupInfos(com.google.common.collect.ImmutableList<com.google.android.exoplayer2.TracksInfo.TrackGroupInfo> trackGroupInfos) Updates the Track Group array.voidupdateTracksSelectionArray(com.google.android.exoplayer2.trackselection.TrackSelectionArray trackSelections) Deprecated.UseupdateTracksGroupInfos(ImmutableList)instead.
-
Constructor Details
-
TrackSelectorHelper
public TrackSelectorHelper(@NonNull com.google.android.exoplayer2.ExoPlayer player, @NonNull com.google.android.exoplayer2.trackselection.DefaultTrackSelector trackSelector) Instantiates a new Track selector helper.- Parameters:
player- the playertrackSelector- the track selector
-
-
Method Details
-
getAvailableFormatList
Gets the availableFormatlist by type.- Parameters:
trackType- the track type- Returns:
- the available format list
-
selectCaption
Selects the Brightcove caption in the @MappingTrackSelectorif available.- Parameters:
captions- the captions
-
selectAudio
Selects the audio language in theMappingTrackSelectorif available.- Parameters:
language- the language
-
applySelectionOverride
@Deprecated public void applySelectionOverride(int renderType, @NonNull SelectionOverrideCreator selectionOverrideCreator) Deprecated. -
applyTrackSelectionOverrides
public void applyTrackSelectionOverrides(int renderType, @NonNull TrackSelectionOverrideCreator trackSelectionOverrideCreator) Creates a {#TrackSelectionOverrides} with the
IfTrackSelectionOverrideCreatorand the render type. Such Track Selection Override will be set to the {#TrackSelector}.TrackSelectionOverrideCreatorreturnsTrackSelectionOverrideCreator.EMPTY_TRACK_SELECTION_OVERRIDES, the Track Selection Override will be ignored.- Parameters:
renderType- theExoPlayerVideoDisplayComponent.TrackTypetrackSelectionOverrideCreator- the selection override creator
-
getSelectedAudioLanguage
Gets the selected audio language if any.- Returns:
- the selected audio language
-
updateTracksSelectionArray
@Deprecated public void updateTracksSelectionArray(@Nullable com.google.android.exoplayer2.trackselection.TrackSelectionArray trackSelections) Deprecated.UseupdateTracksGroupInfos(ImmutableList)instead.Updates the Track Selection array.- Parameters:
trackSelections- the track selection array
-
updateTracksGroupInfos
public void updateTracksGroupInfos(@Nullable com.google.common.collect.ImmutableList<com.google.android.exoplayer2.TracksInfo.TrackGroupInfo> trackGroupInfos) Updates the Track Group array.- Parameters:
trackGroupInfos- the track selection array
-
enableTrack
public void enableTrack(int trackType) Enables the Renderer track.- Parameters:
trackType- the track type
-
disableTrack
public void disableTrack(int trackType) Disables the Renderer track.- Parameters:
trackType- the track type
-
getAudioTracksIndexMap
@NonNull public Map<Integer,String> getAudioTracksIndexMap(android.content.Context context, DeliveryType deliveryType, boolean offline) Creates a map from the Renderer of typeExoPlayerVideoDisplayComponent.TYPE_AUDIOwith the track index and the language code.- Parameters:
deliveryType- the delivery type- Returns:
- the audio tracks index map
-
getRendererIndex
public int getRendererIndex(int renderType) Gets the renderer index.- Parameters:
renderType- the render type- Returns:
- the renderer index
-
findOfflineFormatList
@NonNull public List<com.google.android.exoplayer2.Format> findOfflineFormatList(@NonNull android.content.Context context, @NonNull List<com.google.android.exoplayer2.Format> formatList) Filter the Format list parameter returning only those stored in the device.- Parameters:
context- reference to the host application context.formatList- the format list- Returns:
- the list of Offline Formats
-
applyTrackSelectionOverrides(int, TrackSelectionOverrideCreator)} instead