Whichever platform you are using, follow the instructions in this tutorial and you will be enjoying the captioned videos in no time. You can use Chrome or any other browser to adjust the subtitle preferences through YouTube. Points to remember about Chrome and subtitles
Here’s how to customize captions on an Android device.
On the reading page, toggle the player controls.
If you want to manage the subtitles from your Google / YouTube account on a TV or game console, the YouTube settings page is your best solution. You can also make changes to the captions from this menu.
Your class will need to implement TextRenderer.Output and override the onCues() method.On a computer, you can turn closed captions on and off in two ways. You can use a SubtitleView to position the captions within your layout. tSelectionOverride(TRACK_TEXT, textGroups, override) įor more implementation details (e.g., initializing the trackSelector and fixedFactory), check out the ExoPlayer 2 Demo. New MappingTrackSelector.SelectionOverride(fixedFactory, groupIndex, 0) MappingTrackSelector.SelectionOverride override =
Int groupIndex = 1 // index of desired caption track within the textGroups array TrackGroupArray textGroups = mappedTrackInfo.getTrackGroups(TRACK_TEXT) // list of captions MappingTrackSelector.MappedTrackInfo mappedTrackInfo = trackSelector.getCurrentMappedTrackInfo() Before you can do this, you need to get the TrackGroupArray of the currently mapped text tracks from your DefaultTrackSelector. To enable the tracks again, you need to enable the renderer for text tracks, and then set up a new SelectionOverride for your desired text track. I believe that SelectionOverrides are just programmatically specified track selections. TRACK_TEXT is a local static variable I created representing the index of the text tracks (2), in relation to video/audio tracks. To turn captions off, you need to disable the renderer for the text tracks and clear the selection overrides.
The code below was modified based on the ExoPlayer 2 Demo's TrackSelectionHelper class, which should be referenced for more implementation details. I was able to control caption selection in ExoPlayer 2 using a DefaultTrackSelector.