Skip to content

Filter out forced subtitle tracks from StyledPlayerControlView text track selector #9432

Description

@J6ey

I 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions