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

Fix for TTML alignment (non-centered) in Firefox #588

Merged
merged 4 commits into from
Nov 16, 2016

Conversation

birme
Copy link
Contributor

@birme birme commented Nov 15, 2016

It was discovered that TTML alignments that is not centered (e.g. left) was shown incorrectly in Firefox. The reason I discovered was that the cue.positionAlign was not set and defaulted to "center". This caused the subtitles to be positioned on the left (when tts:textAlign=left) but with the text center aligned.

Note that for Firefox v48 or lower the implementation of cue.positionAlign did not fully follow the spec and was corrected in v49 and above.

… defaults to centered position which causes problem when TTML alignment is left-adjusted for example
@joeyparrish joeyparrish self-assigned this Nov 15, 2016
@shaka-bot
Copy link
Collaborator

Testing in progress...

@shaka-bot
Copy link
Collaborator

All tests passed!

@joeyparrish
Copy link
Member

@ismena, this looks reasonable to me, but you have more experience here. Any objections?

@@ -332,12 +343,15 @@ shaka.media.TtmlTextParser.addStyle_ = function(
cueElement, region, styles, 'tts:textAlign');
if (align) {
cue.align = align;
if (align == 'center' && cue.align != 'center') {
// Workaround for a Chrome bug http://crbug.com/663797
// Chrome does not support align = 'center'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little lost here. Did something change in terms of logic on lines 335-351?

I suspect you might be working off an older version of the file (we refactored it a bit since your last commit). If that's the case, let's stick to the newer version.

Looks good otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was actually an intentional change as setting the cue.position to auto when textAlign is center is not because of a bug in Chrome but rather due to the differences between TTML and VTT. It should not impose any logical change from previous commit but make it more clear that it is not related to the Chrome bug so it will risk to be removed when that cue.align bug is fixed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. In that case we are good to go.

@ismena ismena merged commit b147e1a into shaka-project:master Nov 16, 2016
joeyparrish pushed a commit that referenced this pull request Nov 30, 2016
This commit fixes non-centered TTML alignment issues in Firefox which defaults to centered position which causes problem when TTML alignment is left-adjusted for example.
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Jul 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants