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: Properly size region anchor from LINE units #5941

Merged
merged 7 commits into from
Nov 29, 2023

Conversation

gkatsev
Copy link
Contributor

@gkatsev gkatsev commented Nov 27, 2023

CEA708 captions may set windows in LINE units, this needs to be converted to percentages to be properly displayed. In addition, adjust by the region anchor.

With shaka-project#5924, 708 windows were exposed as Cue regions. Since the region ID
was getting set now, the UITextDisplayer was trying to position the
regions but it doesn't properly support LINES units.

This PR skips positioning the region if the values are in LINES units
until that can be properly implemented.
@shaka-bot
Copy link
Collaborator

shaka-bot commented Nov 28, 2023

Incremental code coverage: 54.05%

if (region.heightUnits === linesUnit && region.widthUnits === linesUnit) {
// from https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#caption-window-size
regionElement.style.height = region.height * 5.33 + '%';
regionElement.style.width = region.width * 1.9 + '%';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, assuming the video's aspect ratio is 16:9. 708 captions only know about 4:3 and 16:9 video. Happy to do a check here to figure out the correct multiple here but need a pointer to how to figure it out.

Copy link
Member

Choose a reason for hiding this comment

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

I have added a commit to this PR to calculate the aspect ratio, you just have to use the variable this.aspectRatio_

@avelad avelad changed the title fix: properly size region anchor from LINE units fix: Properly size region anchor from LINE units Nov 28, 2023
@avelad avelad added type: bug Something isn't working correctly component: captions/subtitles The issue involves captions or subtitles priority: P1 Big impact or workaround impractical; resolve before feature release labels Nov 28, 2023
@avelad avelad added this to the v5.0 milestone Nov 28, 2023
@gkatsev
Copy link
Contributor Author

gkatsev commented Nov 28, 2023

Provides more improvements to #2583

@avelad
Copy link
Member

avelad commented Nov 28, 2023

Provides more improvements to #2583

What would be missing to have #2583 complete?

@gkatsev
Copy link
Contributor Author

gkatsev commented Nov 28, 2023

This does implement region anchors, but the issue talks about WebVTT and IMSC/TTML, and I was mostly focused on 708. It's possible that this also solves the WebVTT portion fully, but I'm not sure about the IMSC/TTML portion.

@avelad avelad merged commit 8b6602e into shaka-project:main Nov 29, 2023
@gkatsev gkatsev deleted the region-anchor-display branch November 29, 2023 13:57
avelad added a commit that referenced this pull request Nov 30, 2023
CEA708 captions may set windows in LINE units, this needs to be
converted to percentages to be properly displayed. In addition, adjust
by the region anchor.

---------

Co-authored-by: Álvaro Velad Galván <[email protected]>
Robloche pushed a commit to Robloche/shaka-player that referenced this pull request Nov 30, 2023
CEA708 captions may set windows in LINE units, this needs to be
converted to percentages to be properly displayed. In addition, adjust
by the region anchor.

---------

Co-authored-by: Álvaro Velad Galván <[email protected]>
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Jan 28, 2024
@shaka-project shaka-project locked as resolved and limited conversation to collaborators Jan 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: captions/subtitles The issue involves captions or subtitles priority: P1 Big impact or workaround impractical; resolve before feature release status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants