chromecastgoogle-castcustom-receiverttmlcaf-receiver-sdk

CAF Receiver: Positioning of subtitles


I've created a custom CAF receiver for playing back MPEG-DASH content which is encrypted using Widewine. My content also has TTML subtitles embedded in the manifest which can be changed dynamically.

Playing my encrypted content works like a charm - even better than on the V2 receiver. I can even select between my different subtitles.

However, the positioning of the subtitles is way off. They aren't centered in they player and sometimes they're cut off in the middle of a cue (see my attached image).

I can tell that the CAF Receiver uses the shaka-player which, from what I can tell, handles parsing of subtitles itself - https://github.com/google/shaka-player/tree/master/lib/text

As far as I can tell from the CAF receiver documentation, there's no way of manipulating the positioning of the subtitles on the receiver. They aren't added to the DOM or anything, so you can't hack it with css. Only thing you can do is set a TextTrackStyle on the TextTracksManager, which only allows setting colors and the like. You have no option to do textAlignor similar.

My questions:

Any help is greatly appreciated!

Example 1

Cut off subtitles

ttml example:

    <tt xmlns="http://www.w3.org/ns/ttml" 
    xmlns:tt="http://www.w3.org/ns/ttml" 
    xmlns:ttm="http://www.w3.org/ns/ttml#metadata" 
    xmlns:tts="http://www.w3.org/ns/ttml#styling" 
    xmlns:ttp="http://www.w3.org/ns/ttml#parameter" 
    xmlns:ebutts="urn:ebu:tt:style" xmlns:ebuttm="urn:ebu:tt:metadata" 
    xml:lang="" ttp:timeBase="media">
    <head>
    <metadata>
      <ebuttm:documentMetadata>
        <ebuttm:conformsToStandard>urn:ebu:tt:distribution:2014-01</ebuttm:conformsToStandard>
      </ebuttm:documentMetadata>
    </metadata>
    <styling>
      <style xml:id="Style0_0" tts:fontFamily="proportionalSansSerif" tts:backgroundColor="#00000099" tts:color="#FFFF00" tts:fontSize="100%" tts:lineHeight="normal" ebutts:linePadding="0.5c" />
      <style xml:id="textAlignment_0" tts:textAlign="center" />
    </styling>
    <layout>
      <region xml:id="Region" tts:origin="10% 10%" tts:extent="80% 80%" tts:displayAlign="after" />
    </layout>
  </head>
  <body>
    <div>
      <p region="Region" style="textAlignment_0" begin="114:24:22.120" end="114:24:24.120" xml:id="sub_0">
        <span style="Style0_0">Das hat sich im Grunde</span>
        <br />
        <span style="Style0_0">aus dem Spiel des Seins so ergeben.</span>
      </p>
    </div>
  </body>
</tt>

Solution

  • Turns out this is a bug related to the usage of VTTRegion in the shaka-player on Chrome, which has been fixed in v2.2.9 and v2.3.0. The CAF receiver currently loads v2.2.1.

    https://github.com/google/shaka-player/issues/1188

    Until Google updates the CAF receiver to use a newer version of the player, you'll either have to live with the misplaced subtitles or do a hack to override what version of the player is loaded on the receiver.