question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Filter out forced subtitle tracks from StyledPlayerControlView text track selector

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ojw28commented, Dec 21, 2021

Do we want to show the name even if it’s a ‘forced’ track? It seems perhaps a user shouldn’t even ‘know’ that a forced track is selected, since it’s assumed to be required to understand the content of a given audio track.

That sounds right. I think the UI should show CC as “off” or “none”, but the forced track should still be selected.

1reaction
icbakercommented, Dec 20, 2021

@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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

RELEASENOTES.md - google/ExoPlayer - Sourcegraph
Don't show forced text tracks in the `PlayerView` track selector, and. keep a suitable forced text track selected if "None" is selected.
Read more >
Source Code for StyledPlayerControlView.java - AndroidX Tech
<p>The layout files in your {@code res/layout*} will override the one provided by the library, * and will be inflated for use by...
Read more >
RELEASENOTES.md · master · Lahlouh, Ishak / RFC_Player
Allow forcing offload for gapless content even if gapless playback is not supported. Allow fall back from DTS-HD to DTS when playing via ......
Read more >
Index (ExoPlayer library)
Convenience method to add selections of tracks for all specified text languages. ... Attempts to exclude the track at the specified index in...
Read more >
RELEASENOTES.md · Gitee 极速下载/ExoPlayer - Gitee.com
Fix track selection in StyledPlayerControlView when using ForwardingPlayer . Fix FlagSet#equals on API levels below 24. Fix NullPointerException being thrown ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found