Search code examples
androidchromecastwebvtt

Does ChromeCast support formatting subtitle text in WebVTT subtitle streams?


I'm sending video with subtitles to a Chromecast devices. Subtitles are in a separate WebVTT stream. The WebVTT data is created by transcribing .srt files. I have a partial translation of SRT subtitle formatting to VTT formatting. (Other formats also transcribed, but let's stick to SRT)

The problem: I'm using <i>...</i> to format italic text in WebVTT subtitles, which is -- as I read the WebVTT spec -- the correct way to format italic text. But ChromeCast doesn't seem to parse the tags. <i> and </i> appear in the subtitle text on screen. Which seems to suggest that ChromeCast doesn't even support rudimentary formatting of subtitle text.

Are there circumstances in which ChromeCast should be respecting format codes? Do I need CSS stylesheets in the VTT file? Or class codes (e.g. , with corresponding css)?

I'm willing to go the extra mile if there is a way to format text in a subtitle. But it's a lot of work, and it's just not that terrible to remove all formatting. :-/ Tell me it can be done please (and give me a hint), and I shall make it happen.

Application is an Android application, using Android chromecast SDK. I already push WebVTT subtitles successfully.

Example:

WEBVTT

1
00:00:05.000 --> 00:00:11.000
<i>In the previous episode...</i>

Solution

  • WebVTT support is partial.

    Supported:

    • <i></i>, and <b></b>

    • Positioning and alignment attributes such as 00:06.790 --> 00:07.830 position:10%,line-left align:left size:35% (perhaps a subset)

    • &lt;&gt;&amp; entities

    Not supported:

    • CSS of any kind.
    • <c></c> in any variant (e.g. not <c.red>)
      • <ruby
    • <v>

    And probably not chapters, since I can't imagine what they would be used for if they were implement.

    The presence of a Byte-Order Mark on the first line causes the entire file to be rejected. (That's probably not incorrect. But it is perilous for Windows developers).

    All linefeeds and "\n" are hard line-breaks.