TTML caption file not working in all browsers

1.3k Views Asked by At

I am integrating closed captions in my video element

 <div style="text-align:center;">
        <video width="720" height="360" controls>
            <source src="Files/testvideo_1.mp4" type="video/mp4">
            <track label="English" kind="subtitles" srclang="en" src="Files/testvideo_CC.xml" default >
            Your browser does not support the video tag.
        </video>
    </div>

The caption file used here is of ttml type.According to this link below both ttml and webvtt type caption files will work on html5 video.

http://www.html5labs.com/prototypes/video-captioning/video-captioning/info

But in internet explorer ttml format is working and webvtt is not. In the case of firefox and chrome only webvtt file is working and ttml is not.See the link below

http://www.html5labs.com/prototypes/video-captioning/video-captioning/info

I have only ttml type caption files with me and in most of the tutorials in web they are using webvtt files, so is there any way to use this in all browsers

2

There are 2 best solutions below

0
On

Both TTML and WebVTT are standardised by the W3C's Timed Text Working Group (TTWG), whose charter lists both. To get to Recommendation they both have to be Web friendly. TTML has been a recommendation since 2010, WebVTT is on the track, currently at first public working draft.

Today, more browsers support WebVTT to some extent out of the box; although IE has historically supported TTML natively, typical implementations such as the BBC's iPlayer use Javascript to parse the TTML and present it. That approach is also workable for WebVTT. By the way, Google Chromecast also plays TTML natively, and there's some code in Exoplayer for playing back TTML on Android. There are lots of other examples of player code on github for example.

TTML (or profiles of TTML) is also widely used in implementations not primarily seen as browsers for example in connected TV specifications like YouView, CFF, HbbTV, DVB DASH, ARIB etc.

0
On

TTML and WebVTT were competing standards for captioning a few years ago when the spec was emerging, but since then WebVTT has largely won out. You shouldn't need to use TTML.

Check the HTML5 track spec discussing the use of WebVTT and the caniuse for WebVTT. Neither lists TTML as an alternative.