-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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 captions sticking to bottom for webkit browsers. #2702
Conversation
Thanks for the PR and the detailed description! |
I believe this is the case with modifying the container with bottom. I will thoroughly test tomorrow.
|
Safari has a double repaint issue with modifying the position of the
Safari does have a intermittent issue initializing/disposing captions, where the font-size quadruples* and the caption balloons, not sure how this can be overcome. Safari: |
@@ -24,3 +24,7 @@ | |||
.vjs-subtitles { color: #fff /* Subtitles are white */; } | |||
.vjs-captions { color: #fc6 /* Captions are yellow */; } | |||
.vjs-tt-cue { display: block; } | |||
|
|||
video::-webkit-media-text-track-display { | |||
@include transform(translateY(-45px)); |
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 should probably be 4em
rather than 45px
. 4.5em
is a bit much, I think.
Also, can we add this value as a variable that defaults to 4em
to the vars file? That way, a user could more easily change where the captions are if they have a custom control bar and are including the sass files.
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.
Also, we should make this align with where we stick the emulated captions.
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.
Will do. I'll retest em
, but expect to have the captions bleed into the video depending on the font-size
set by the browser width.
Also, should the captions work like native -webkit
, where they adjust for the control bar, or should they stay at a fixed (relative) position.
Also, we should make this align with where we stick the emulated captions.
Don't follow.
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.
We should make the emulated captions and native captions work as close to each other as possible. The emulated captions already are aligned to leave room for the control bar, so, we should make sure that the native captions are similar. If the emulated captions go up/down with the control bar, we should do the same for the native captions as well.
I tried using em
locally and it didn't actually change. But that is kind of what we want because the control bar resizes itself based on the font size :)
Also, thanks for this PR. Glad you were able to figure out how to get safari to behave (which I also verified). It looks good to me, but had a comment. |
I initially didn't follow the whole emulated notion, but I figured it out ><. Added some comments to make it more explicit. So its closer, but won't be perfect. Emulated tracks modify the font size of the Native tracks have their positioning and font-size tied to the same element, so the positioning is much more noticeable and, of course, varies depending on the width of the viewport. Control bar (Chrome 3em/1.5em, FF 3em/1em): No control bar (Chrome 3em/1.5em, FF 3em/1em):
|
Awesome. I'll try it out tomorrow and probably merge it in. |
LGTM |
Awesome! Thanks again, @chemoish! |
This PR is to start a conversation about addressing #2193.
Native (Chrome):
Resources:
Browsers:
Compatibility:
Evaluations:
px
,rem
,em
?bottom
,top
,translateY
?-webkit-media-text-track-container
,-webkit-media-text-track-display
?1. px
px
must be used to keep interface consistency. However, this doesn't follow the em standard that is currently used in the player.The problem with using
em
is that the browser? will dynamically modify thefont-size
on the-webkit-media-text-track-container
, based on player's width. The larger the width, the larger thefont-size
, the larger thebottom
offset will be.As mentioned #2193 (comment).
2. & 3. translateY
bottom
can only be used on the-webkit-media-text-track-container
since it conflicts with styles found in-webkit-media-text-track-display
[WebVTT implementation ofline
(WebVTT) modifiestop
(css)]. However, this will cause placement issues if you want to utilizeline
(WebVTT), as they both will stack/conflict.translateY
seems to be the best option.translateY
gives the most predictable offset and it doesn't conflict with any other embedded styles.The best part about it is that, IF,
line
(WebVTT) is configured, it will override anytranslateY
styles set on-webkit-media-text-track-display
.This will allow users to benefit from both.
Other stuff:
@mixin
can be removed ifnpm i compass-mixins
was favored.