google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.74k stars 6.03k forks source link

MimeTypes.isText(mimeType) == false for "application/ttml+xml" #3753

Closed tonihuotari closed 6 years ago

tonihuotari commented 6 years ago

Issue description

After parsing of text-tracks for simulcast DASH streams we get text-tracks with mimeType == 'application/ttml+xml' which is according to DASH standards. Check page 141 for timed text mimeType table: http://dashif.org/wp-content/uploads/2017/09/DASH-IF-IOP-v4.1-clean.pdf

This might be more of a question than a bug: Can MimeTypes.isText() be used for checking validity of text tracks?

Reproduction steps

Start stream: http://irtdashreference-i.akamaihd.net/dash/live/901161/bfs/manifestARD.mpd

Or alternatively add this to stream manifest:

<AdaptationSet group="2" mimeType="application/mp4" contentType="text" segmentAlignment="true" startWithSAP="1" lang="nor">
   <SegmentTemplate timescale="90000" initialization="$RepresentationID$-init?version_hash=3db971877" media="$RepresentationID$-$Time$?version_hash=3db971877">
    <SegmentTimeline>
     <S d="900000" t="8711681400000"/>
     <S d="900000" r="1078"/>
    </SegmentTimeline>
   </SegmentTemplate>
   <Representation id="1816898287" bandwidth="100" codecs="stpp"/>
  </AdaptationSet>

After ExoPlayer has parsed the text-track the mimeType is application/ttml+xml

--> MimeTypes.isText(application/ttml+xml) == false

Link to test content

http://irtdashreference-i.akamaihd.net/dash/live/901161/bfs/manifestARD.mpd

Version of ExoPlayer being used

ExoPlayer 2.6.0

Device(s) and version(s) of Android being used

Not relevant

A full bug report captured from the device

Not relevant

ojw28 commented 6 years ago

I'm not sure I follow the question. The method is documented as "Whether the top-level type of mimeType is text.", which is not true for application/ttml+xml, whose top-level type is application.

What is it that you're actually trying to do? What does it mean to "check validity" of a text track?

tonihuotari commented 6 years ago

That basically answers the question; MimeType.isText alone is not enough to determine if a track can be used as a subtitle.

ojw28 commented 6 years ago

You probably want MimeTypes.getTrackType(mimeType) == C.TRACK_TYPE_TEXT.