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
VTT Caption Positioning Fixes #3523
Conversation
Do intersect math based on true width of captions Update pct checker to be accurate
let finalPos = bestPosition || specifiedPosition; | ||
// If we detect a best position based on one axis, oftentimes combining with the other axis | ||
// results in a much better position. | ||
// TODO: Make more performant by checking axis permutations above |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is certainly a way to refactor this to be O(n) however the complexity mixed with the amount of time already sunk into this make me believe this option is the best way forward until we want to spend more time on this rendering
Remove margin specific calculations
❗ MULTI Build for commit 1d50fca did not complete (FAILURE). |
1d50fca
to
5f9ccd1
Compare
src/js/polyfills/webvtt.js
Outdated
width: obj.width || width | ||
}; | ||
return ret; | ||
}; | ||
|
||
// Helper function for visualizing box position | ||
// Helpful when debugging | ||
function drawBox(b, container, color) { // eslint-disable-line no-unused-vars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not used by the code so would get shipped with the player however the utility of this function in debugging these captions box positions is worth the extra couple kb of delivery imo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you execute it? Why does it need to be part of the player/this code, vs a snippet in your browser or a global method in one of our test pages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair questions - you would have to call it yourself below. i suppose it's more confusing than anything leaving it in - i just found it extremely helpful. might add as a window global
|
@@ -454,19 +455,22 @@ function CueStyleBox(window, cue) { | |||
// https://w3c.github.io/webvtt/#ref-for-enumdef-positionalignsetting-1 | |||
// The cue.align property is settable and other browsers use it as the offset from which the cue.position | |||
// value is applied. | |||
let transform = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transform ensures that we respect the cue alignment when determining position. now that these are inline-block elements the size is not known at time of instantiation. this new code adds a transform to properly place the cue based on alignment and then removes it when the stylebox is finally moved to prevent it from being applied twice (once during exact px calculations and then after when we go to display)
77cbe1e
to
f472575
Compare
❗ MULTI Build for commit f472575 did not complete (FAILURE). |
f472575
to
e7e512f
Compare
|
❗ MULTI Build for commit a64ae3e did not complete (FAILURE).
|
a64ae3e
to
3a68a92
Compare
❗ MULTI Build for commit 3a68a92 did not complete (FAILURE). There's a lint issue in the commercial test changes:
|
test this please |
Click ❗️to go to the job and then "Rebuild" |
|
This PR will...
Fix positioning in the following ways:
Why is this Pull Request needed?
Using
line
attribute screws with all the above issues and surfaced quite a few bugs in our caption renderingAre there any points in the code the reviewer needs to double check?
All of it - this took a lot of research and trial and error to get right. want to be sure i'm not missing something
Are there any Pull Requests open in other repos which need to be merged with this?
Nope
Addresses Issue(s):
JW8-10682
Checklist