ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Filter out unwanted text tracks returned from MappedTrackInfo

Open jonhan opened this issue 9 years ago • 2 comments

Hi, I'm wondering if there's a way to filter out tracks based on their mimeType so that they don't show up when I call MappedTrackInfo.getTrackGroups(..). To be more specific we have a DASH stream that provides both VTT and TTML subtitles for each language, but I only want get the ones for TTML so that it's more feasible to render available tracks in the UI.

Also, when it comes to selecting language for a text or audio track during playback, is it ok to use the DefaultTrackSelector.setParameters(..) approach? I´ve seen indication on this in other issues here but just want to verify this.

In Exoplayer 1.x this filtering was possible by injecting an instance of TtmlParser() into the TextRenderer, is there some equivalent in 2.x? I'm Currently using 2.4.1

Thanks

jonhan avatar Jun 13 '17 19:06 jonhan

I'm wondering if there's a way to filter out tracks based on their mimeType so that they don't show up when I call MappedTrackInfo.getTrackGroups(..).

If this is just to prevent the selector from selecting the VTT streams, I don't think this is the best way. I can think of two ways of easily achieving this:

  • (Best way I can think of) Subclass DefaultTrackSelector and override selectTextTrack so that it prefers TTML over VTT.
  • Pass a SubtitleDecoderFactory that does not report support for WebVTT. This would be the answer to what you ask about specifically, I think.

is it ok to use the DefaultTrackSelector.setParameters(..) approach

Yes. It's the way to parametrize the default track selector. The other way is setting overrides (you can look into the demo app for more info on this).

Out of curiosity, could you elaborate on why you prefer TTML subtitles? Please close the issue if this answers your question.

AquilesCanta avatar Jun 14 '17 09:06 AquilesCanta

Thanks for the answer! yes what I want to achieve is basically that TrackSelector never reports the VTT subtitles when I list available subtitles. I guess it could also be of interest to subclass DefaultTrackSelector to make sure that it selects the TTML subtitle if I select language using setParameters().

Regarding our choice of TTML subtitles, I have just gotten instructions from our transcoding guy that one reason we should prefer them is that they have support for dynamic timing.

jonhan avatar Jun 14 '17 19:06 jonhan