Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitespace in TTML subtitles is rendered literally although xml:space="default" #665

Closed
TobbeEdgeware opened this issue Jan 26, 2017 · 4 comments
Assignees
Labels
flag: good first issue This might be a relatively easy issue; good for new contributors status: archived Archived and locked; will not be updated type: enhancement New feature or request

Comments

@TobbeEdgeware
Copy link
Contributor

One of the standard assets for testing subtitles on dash.js is
http://vm2.dashif.org/dash/vod/testpic_2s/xml_subs.mpd

It uses white-space surrounding <span> elements in <p> elements and this white-space is rendered literally in shaka-player, although it should not, since the xml:space="default" is specified.

The TTML 1.0 spec Section 7.2.3 says that for xml:space="default", white-space should be treated like

suppress-at-line-break="auto"
linefeed-treatment="treat-as-space"
white-space-collapse="true"
white-space-treatment="ignore-if-surrounding-linefeed"

I made an alternative version of the stream above with suppressed white-space
http://vm2.dashif.org/dash/vod/testpic_2s/xml_subs_no_ws.mpd
which shows how it should look like in Shaka-player.

There are also colors and EBU-TT padding in this example, which dash.js can render, but Shaka-player ignores. That is an acceptable behavior, since no hiccup occurs.

It may be too much work to implement both xml:space="default" and xml:space="preserve", but at least the default mode should be implemented. Currently, the rendering rather follows xml:space="preserve".

I made a small fix for empty subtitles #646 in PR #650, but should have taken a bigger grip to get white space ignored generally as the default.

I may give a shot at a PR, but in that case only for xml:space="default". What is the best way forward?

Environment

  • What version of Shaka Player are you using?
    2.04

    • Can you reproduce the issue with our latest release version?
      Yes

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

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

  • What browser and OS are you using?
    Chrome on Mac OS Sierra

@joeyparrish
Copy link
Member

Shaka Player does not render text cues at all. That is left up to the browser. So I'm tempted to say that whitespace rendering behavior should be specified as part of the VTTCue interface and that Shaka Player should provide the correct setting to the browser.

However, since adding features to the VTTCue spec and waiting for implementation may take a long time, I am open to having Shaka Player's TTML parser handle this in the mean time.

@TobbeEdgeware
Copy link
Contributor Author

TobbeEdgeware commented Jan 26, 2017

I think this is mainly an issue when translating from TTML to WebVTT (VTTCue). WebVTT does not have different white-space modes, and since it is line-based, it is natural to start the text at the beginning of every line. It is thus not likely that the VTTCue API will ever have a white-space API.

I therefore think that your willingness to let this be implemented in the TTML parsing in Shaka Player is the correct choice.

@ismena
Copy link
Contributor

ismena commented Jan 27, 2017

@TobbeEdgeware you're very welcome to make a PR if you'd like, otherwise we'll do it when we have a chance.

@TobbeEdgeware
Copy link
Contributor Author

@ismena Sounds good. I let you know, if I start working on it.

@joeyparrish joeyparrish added flag: good first issue This might be a relatively easy issue; good for new contributors type: enhancement New feature or request labels Jan 30, 2017
joeyparrish pushed a commit that referenced this issue Feb 10, 2017
Previously, we did not properly handle indentation in Ttml files, which
could result in the indentation of the XML elements showing up as part
of the subtitles. This adds support for xml:space settings, to
allow the maker of the manifest to enable or disable this behavior.

Closes #665

Change-Id: Iafee92a536ce6eb2d73c32186500715adb52e26b
@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
flag: good first issue This might be a relatively easy issue; good for new contributors status: archived Archived and locked; will not be updated type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants