TTML style attributes are not read from the region tag
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 955
- Avg merge
- 12d 14h
- Merged PRs (30d)
- 2
Description
Version
Media3 main branch
More version details
No response
Devices that reproduce the issue
Application : https://play.google.com/store/apps/details?id=com.canal.android.canal&hl=fr
Device : Redmi Note 11 Pro 5G (issue not specific to device)
Android : 13 TKQ1.221114.001
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
Play a DASH stream containing TTML subtitles, like the following:
<?xml version="1.0" encoding="utf-8"?>
<tt xmlns="http://www.w3.org/ns/ttml" xmlns:tts="http://www.w3.org/ns/ttml#styling%22 xmlns:ttp="http://www.w3.org/ns/ttml#parameter%22 xml:lang="" ttp:cellResolution="40 24">
<head>
<styling>
<style xml:id="speakerStyleDoubleHeight" tts:fontFamily="proportionalSansSerif" tts:fontSize="166.66%" tts:lineHeight="120.00%" tts:overflow="visible" tts:backgroundColor="transparent" tts:color="white" tts:textOutline="black 2px"/>
</styling>
<layout>
<region xml:id="speaker_1" tts:origin="7.50% 62.50%" tts:extent="50.00% 16.67%" tts:displayAlign="after" tts:textAlign="left" style="speakerStyleDoubleHeight"/>
</layout>
</head>
<body>
<div>
<p begin="82287:47:57.880" end="82287:47:59.360" region="speaker_1">
subtitle text
</p>
</div>
</body>
</tt>
Expected result
The above subtitle is left aligned in the given region; i.e. the tts:textAlign style element has been taken into account.
Actual result
The above subtitle is centered on screen; the tts:textAlign style element has been ignored.
See TTML specification https://www.w3.org/TR/2018/REC-ttml1-20181108/#layout-vocabulary-region:
<region
[begin](https://www.w3.org/TR/2018/REC-ttml1-20181108/#timing-attribute-begin) = [<timeExpression>](https://www.w3.org/TR/2018/REC-ttml1-20181108/#timing-value-timeExpression)
[dur](https://www.w3.org/TR/2018/REC-ttml1-20181108/#timing-attribute-dur) = [<timeExpression>](https://www.w3.org/TR/2018/REC-ttml1-20181108/#timing-value-timeExpression)
[end](https://www.w3.org/TR/2018/REC-ttml1-20181108/#timing-attribute-end) = [<timeExpression>](https://www.w3.org/TR/2018/REC-ttml1-20181108/#timing-value-timeExpression)
[style](https://www.w3.org/TR/2018/REC-ttml1-20181108/#style-attribute-style) = IDREFS
[timeContainer](https://www.w3.org/TR/2018/REC-ttml1-20181108/#timing-attribute-timeContainer) = (par|seq)
[ttm:role](https://www.w3.org/TR/2018/REC-ttml1-20181108/#metadata-attribute-role) = string
[xml:id](https://www.w3.org/TR/2018/REC-ttml1-20181108/#content-attribute-id) = ID
[xml:lang](https://www.w3.org/TR/2018/REC-ttml1-20181108/#content-attribute-lang) = string
[xml:space](https://www.w3.org/TR/2018/REC-ttml1-20181108/#content-attribute-space) = (default|preserve)
{any attribute in TT Style namespace}
{any attribute not in default or any TT namespace}>
Content: [Metadata.class](https://www.w3.org/TR/2018/REC-ttml1-20181108/#element-vocab-group-table)*, [Animation.class](https://www.w3.org/TR/2018/REC-ttml1-20181108/#element-vocab-group-table)*, [style](https://www.w3.org/TR/2018/REC-ttml1-20181108/#styling-vocabulary-style)*
</region>
See function parseRegionAttributes() : https://github.com/androidx/media/blob/release/libraries/extractor/src/main/java/androidx/media3/extractor/text/ttml/TtmlParser.java#L352
Media
<?xml version="1.0" encoding="utf-8"?>
<tt xmlns="http://www.w3.org/ns/ttml" xmlns:tts="http://www.w3.org/ns/ttml#styling%22 xmlns:ttp="http://www.w3.org/ns/ttml#parameter%22 xml:lang="" ttp:cellResolution="40 24">
<head>
<styling>
<style xml:id="speakerStyleDoubleHeight" tts:fontFamily="proportionalSansSerif" tts:fontSize="166.66%" tts:lineHeight="120.00%" tts:overflow="visible" tts:backgroundColor="transparent" tts:color="white" tts:textOutline="black 2px"/>
</styling>
<layout>
<region xml:id="speaker_1" tts:origin="7.50% 62.50%" tts:extent="50.00% 16.67%" tts:displayAlign="after" tts:textAlign="left" style="speakerStyleDoubleHeight"/>
</layout>
</head>
<body>
<div>
<p begin="82287:47:57.880" end="82287:47:59.360" region="speaker_1">
subtitle text
</p>
</div>
</body>
</tt>
Bug Report
- You will email the zip file produced by
adb bugreportto android-media-github@google.com after filing this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.