shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.19k stars 1.34k forks source link

TTML - styles applied to body are not applied to cues. #3741

Closed avelad closed 2 years ago

avelad commented 3 years ago

Have you read the FAQ and checked for duplicate open issues? Yes

What version of Shaka Player are you using? Master

Can you reproduce the issue with our latest release version? Don't apply

Can you reproduce the issue with the latest code from master? Yes

Are you using the demo app or your own custom app? Demo app

If custom app, can you reproduce the issue using our demo app?

What browser and OS are you using? Any witth MSE support

For embedded devices (smart TVs, etc.), what model and firmware version are you using?

What are the manifest and license server URIs?

https://livesim.dashif.org/dash/vod/testpic_2s/multi_subs.mpd

What configuration are you using? What is the output of player.getConfiguration()?

Default

What did you do?

Load the previous stream and enable ENG subtitles

What did you expect to happen? The subtitle are rendered correctly

What actually happened?

The subtitle aren't rendered correctly The body style is not inherited in the TTML parser an the font-size, text-align, etc are not applied

Shaka Player image

Dash-if image

TTML file

<?xml version="1.0" encoding="UTF-8"?>
<tt ttp:cellResolution="32 15" ttp:timeBase="media" xml:lang="eng" xml:space="default" xmlns="http://www.w3.org/ns/ttml" xmlns:ebuttm="urn:ebu:metadata" xmlns:ebutts="urn:ebu:style" xmlns:ttm="http://www.w3.org/ns/ttml#metadata" xmlns:ttp="http://www.w3.org/ns/ttml#parameter" xmlns:tts="http://www.w3.org/ns/ttml#styling">
  <head>
    <metadata>
      <ttm:title>DASH-IF Live Simulator</ttm:title>
      <ebuttm:documentMetadata>
        <ebuttm:conformsToStandard>urn:ebu:distribution:2014-01</ebuttm:conformsToStandard>
        <ebuttm:authoredFrameRate>30</ebuttm:authoredFrameRate>
      </ebuttm:documentMetadata>
    </metadata>
    <styling>
      <style tts:color="#FFFFFF" tts:fontFamily="sansSerif" tts:fontSize="100%" tts:fontStyle="normal" tts:lineHeight="normal" tts:textAlign="center" tts:wrapOption="noWrap" xml:id="s0"/>
      <style ebutts:linePadding="0.5c" tts:backgroundColor="#000000" tts:color="#00FF00" xml:id="s1"/>
      <style ebutts:linePadding="0.5c" tts:backgroundColor="#000000" tts:color="#ff0000" xml:id="s2"/>
    </styling>
    <layout>
      <region tts:displayAlign="before" tts:extent="70% 20%" tts:origin="15% 80%" tts:overflow="visible" xml:id="r0"/>
      <region tts:displayAlign="before" tts:extent="70% 20%" tts:origin="15% 20%" tts:overflow="visible" xml:id="r1"/>
    </layout>
  </head>
  <body style="s0">
    <div region="r0">
      <p begin="00:00:00.000" end="00:00:01.000" xml:id="sub00000">
        <span style="s1">eng : 00:00:00.000</span>
      </p>
      <p begin="00:00:01.000" end="00:00:02.000" xml:id="sub01000">
        <span style="s1">eng : 00:00:01.000</span>
      </p>
    </div>
  </body>
</tt>
TheModMaker commented 2 years ago

The font size looks correct, but the alignment is wrong. It looks like the region positioning is being applied twice, so the inner cue is being positioned relative to an outer <div>, which is also positioned.