I was able to control the selection of titles in ExoPlayer 2 with DefaultTrackSelector. The code below has been modified based on the ExoPlayer 2 Demo class , which should be referenced for more information about the implementation. TrackSelectionHelper
To disable signatures, you must disable the renderer for text tracks and clear the selection overrides.
trackSelector.setRendererDisabled(TRACK_TEXT, true);
trackSelector.clearSelectionOverrides();
TRACK_TEXTis the local static variable that I created, which represents the index of text tracks (2) with respect to video / audio tracks. I believe that SelectionOverrides is just a software-defined selection of tracks.
, , SelectionOverride . , TrackGroupArray DefaultTrackSelector.
MappingTrackSelector.MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo();
TrackGroupArray textGroups = mappedTrackInfo.getTrackGroups(TRACK_TEXT);
int groupIndex = 1;
trackSelector.setRendererDisabled(TRACK_TEXT, false);
MappingTrackSelector.SelectionOverride override =
new MappingTrackSelector.SelectionOverride(fixedFactory, groupIndex, 0);
trackSelector.setSelectionOverride(TRACK_TEXT, textGroups, override);
(, trackSelector fixedFactory) ExoPlayer 2.
SubtitleView . TextRenderer.Output onCues().
@Override
public void onCues(List<Cue> cues) {
if (subtitleView != null) {
subtitleView.onCues(cues);
}
}