Filter out forced subtitle tracks from StyledPlayerControlView text track selector
See original GitHub issueI have DASH video files containing closed captions links within the mpd file, so I’m not manually adding subtitles. Some video assets have Forced language captions that I don’t want to show in the player (which is showing up twice). For example, French, German, and Spanish forced should be excluded in options user can select:
French (Parisian) (Forced) German (Germany) (Forced) Spanish (Castilian) (Forced)
French (Parisian) (Full) German (Germany) (Full) Spanish (Castilian) (Full) Marathi (Full) Norwegian (Full) Danish (Full) Turkish (Full)
I’m using the default StyledPlayerView, and have tried something along the lines of
DefaultTrackSelector.Parameters parameters = trackSelector
.buildUponParameters()
.setDisabledTextTrackSelectionFlags(C.SELECTION_FLAG_FORCED)
.build();
trackSelector.setParameters(parameters);
but with no success. I’m able to see the list of subtitles available with this:
int trackLength = trackSelector.getCurrentMappedTrackInfo().getTrackGroups(2).length;
for (int i = 0; i < trackLength; i++) {
Utils.log(trackSelector.getCurrentMappedTrackInfo().getTrackGroups(2).get(i).getFormat(0).label);
}
Not sure if changes should or can be made here to remove the unwanted captions. Any help is appreciated, thank you.
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (8 by maintainers)
Top GitHub Comments
That sounds right. I think the UI should show CC as “off” or “none”, but the forced track should still be selected.
@SaurabhOfficial Please file a new issue with the info requested in the template (media we can use to reproduce the issue, and a bug report taken after reproducing in the demo app).