-
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: allow captions in devices that use old chrome to be shown #8826
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8826 +/- ##
==========================================
+ Coverage 83.12% 84.46% +1.33%
==========================================
Files 120 120
Lines 8052 9492 +1440
Branches 1931 2477 +546
==========================================
+ Hits 6693 8017 +1324
- Misses 1359 1475 +116 ☔ View full report in Codecov by Sentry. |
Would it work to put the changes to video.js/src/js/tracks/text-track-display.js Lines 343 to 345 in 5192a67
|
Co-authored-by: Walter Seymour <[email protected]>
src/js/tracks/text-track-display.js
Outdated
@@ -319,6 +320,23 @@ class TextTrackDisplay extends Component { | |||
} | |||
this.updateForTrack(descriptionsTrack); | |||
} | |||
|
|||
if (browser.IS_SMART_TV && !window.CSS.supports('inset', '10px')) { |
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.
Should this be any browser doesn't support inset
, and not just smart TVs? Smart TVs are the only real reason to be using such old browser versions, but it's not inconceivable that people might test things destined for a smart TV on an old browser on desktop/browserstack etc.
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.
Yeah, should be a feature test only, unless there's a good reason to only target TVs?
Below should be updated to match as well
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.
Updated the PR to support this changes on any browser, I got to move the update of the styles of textTrackDisplay to add support when user switches to full screen, can this be re-reviewed?
src/js/tracks/text-track-display.js
Outdated
textTrackDisplay.style.position = 'relative'; | ||
textTrackDisplay.style.height = textTrackDisplayHeight + 'px'; | ||
textTrackDisplay.style.top = 'unset'; | ||
textTrackDisplay.style.bottom = '0px'; |
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.
textTrackDisplay.style.position = 'relative'; | |
textTrackDisplay.style.height = textTrackDisplayHeight + 'px'; | |
textTrackDisplay.style.top = 'unset'; | |
textTrackDisplay.style.bottom = '0px'; | |
tryUpdateStyle(textTrackDisplay, 'position', 'relative'); | |
tryUpdateStyle(textTrackDisplay, 'height', textTrackDisplayHeight + 'px'); | |
tryUpdateStyle(textTrackDisplay, 'top', 'unset'); | |
tryUpdateStyle(textTrackDisplay, 'bottom', '0px'); |
this updates to use tryUpdateStyle for consistency with the rest of the code, but maybe that isn't really neccessary as the comment for tryUpdateStyle metions IE8 🤔
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.
added this change in the last commit, can this be re-reviewed?
src/css/components/_text-track.scss
Outdated
@@ -46,3 +46,11 @@ video::-webkit-media-text-track-display { | |||
text-align: center !important; | |||
width: 80% !important; | |||
} | |||
|
|||
.video-js .vjs-text-track-display > div { |
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.
What does the div
here represent? Do we want this CSS set always? Or maybe we could add a class name to this div
in the scenario we want so we know it is SMART TV related..
I just want to be sure this does not have any unexpected side effects..
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 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.
But I updated the PR to add those styles only when required, can this be re-reviewed?
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.
Cool, I would maybe make that name more descriptive "vjs-text-track-display-inset" or something like that. Otherwise, nice work!
src/js/tracks/text-track-display.js
Outdated
// Add custom class to textTrackDisplay div child for not inset support styles | ||
textTrackDisplay.firstChild.classList.add('vjs-text-track-display-inset'); |
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.
an alternative to adding this class is using css @supports
. Then, this line won't be necessary and it could all be done in css.
// Add custom class to textTrackDisplay div child for not inset support styles | |
textTrackDisplay.firstChild.classList.add('vjs-text-track-display-inset'); |
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.
updated this in the last commit, can this be re-reviewed?
Co-authored-by: Gary Katsevman <[email protected]>
Description
In the specific case of using an old chrome version this minor changes will allow the captions to be shown.
Specific Changes proposed
Small fix when using videojs in an old browser that does not support the css 'inset' property.
Requirements Checklist
npm run docs:api
to error