shaka-project / shaka-player

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

Support of fontSize cellResolution units in TTML subtitles #2403

Closed glhvta closed 4 years ago

glhvta commented 4 years ago

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

What version of Shaka Player are you using? v2.5.9

Please ask your question Hi,

According to the TTML spec fontSize https://www.w3.org/TR/ttml1/#style-attribute-fontSize fontSize value can be percentage or scalar in the next units
https://www.w3.org/TR/ttml1/#style-value-length

We have ttml subs with the next styles

<styling>
   <style xml:id="s0" tts:color="rgba(255,255,255,255)" tts:fontSize="0.80c"  />
</styling>

tts:fontSize="0.80c" is in cellResolution units

We are using the default shaka.text.TtmlTextParser And seems like fontSize will not be provided to the text displayer in this case, as now default TtmlTextParser does not support cellResolution units for the font size.

https://github.com/google/shaka-player/blob/697a6ff785046dff3b7dea1d44fc8fc87cee925b/lib/text/ttml_text_parser.js#L531-L535

https://github.com/google/shaka-player/blob/697a6ff785046dff3b7dea1d44fc8fc87cee925b/lib/text/ttml_text_parser.js#L971-L977

Is it possible to add the support of fontSize cellResolution units to TtmlTextParser?

Thanks!

joeyparrish commented 4 years ago

Sounds reasonable. Do you have any sample TTML we could use for testing and development?

glhvta commented 4 years ago

yes, in this archive, you can find samples TTML with fontSize attribute in percentages and in cellResolution unit.

ttml-captions.zip

joeyparrish commented 4 years ago

Perfect. Thanks!