0

The Chromecast developer docs say both WebVTT and TTML are Supported Media Types: https://developers.google.com/cast/supported_media_types


I see captions when using a WebVTT file in a "track" tag within a video element:

<video id="vid" src="http://myurl">
    <track kind="captions" src="http://10.16.236.23/test.vtt" srclang="en" label="English" default>
</video>

But when I try to do the same using a valid TTML file, I don't see captions:

<video id="vid" src="http://myurl">
    <track kind="captions" src="test.ttml" srclang="en" label="English" default>
</video>


When I inspect the video element in the debugger console, for the WebVTT example I can see

document.getElementById('vid').textTracks[0].cues.length;

16

but for TTML:

document.getElementById('vid').textTracks[0].cues.length;

0


I am on the right track with this or is TTML supported in a different way? Maybe my TTML syntax is not supported by Chromecast?

JAL
  • 41,701
  • 23
  • 172
  • 300
Rob
  • 231
  • 1
  • 2
  • 9

2 Answers2

1

Unlike webVTT, TTML is not natively supported. If you need to support that in your app, you can simply write a Javascript parser to parse the file and add the cues to your video element in javascript using methods such as addTextTrack(), etc.

Ali Naddaf
  • 16,951
  • 2
  • 21
  • 28
1

According to the Cast Player API, Chromecast now supports WebVTT, TTML1, and CEA-608 (Line 21 Captions) caption formats. Just pass in the CaptionsType enum for your caption format into the player's enableCaptions() method.

JAL
  • 41,701
  • 23
  • 172
  • 300