-
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
Adding vtt.js
's exports to window
breaks addCue
in Chrome
#4093
Comments
Yeah, that sounds like an issue. Historically, we haven't needed to handle this because either native tracks or emulated tracks would be used. The current proposed fix, unfortunately, will break emulated caption support, at least with the current version of vttjs that we're using. If it doesn't, let me know I'm wrong! |
@gkatsev I'm minimally versed with emulated captions so please forgive the naive question: why would this break it? Is the shimmed Edit: Added anywhere to the end. |
I believe that there's some extra stuff that's currently happening in there that isn't available natively for the features we support with emulated tracks. I do remember that it wasn't sufficient to use native cues at the time I implemented it. It's possible things have changed and we probably should verify. Maybe we would only want to do this for older browsers or something. Though, I think making vttjs more contained with our emulated tracks functionality sounds like a good move regardless. |
Thanks @gkatsev . |
Thanks for looking into this @justinanastos. |
I took a look today, I think the way everything is set up can be tweaked to fix the issue and also do it as a minor (so we can fix it in 5.x as well). I'll be working on this some more tomorrow. |
Awesome, any way I can help @gkatsev ? |
I'll ping you when I have something ready to test, thanks @justinanastos. |
@justinanastos hey, I have a PR open against our vttjs fork with updates (videojs/vtt.js#7), I also published it as a beta tag on npm |
Just realized that we needed an extra piece here: #4115. Please try out that branch, it's currently including the pre-release of vttjs in the PR. |
Update videojs-vtt.js and don't auto-export its versions of VTTCue globally. When our TextTrack object is given a cue, if it's a native cue, wrap it in our emulated vttjs.VTTCue. Fixes #4093.
Update videojs-vtt.js and don't auto-export its versions of VTTCue globally. When our TextTrack object is given a cue, if it's a native cue, wrap it in our emulated vttjs.VTTCue. Fixes #4093.
The v5.18.0 release of video.js includes a fix for videojs/video.js#4093 with videojs/video.js#4131. This is neccessary for text tracks to work in Chrome.
The v5.18.0 release of video.js includes a fix for videojs/video.js#4093 with videojs/video.js#4131. This is neccessary for text tracks to work in Chrome.
The v5.18.0 release of video.js includes a fix for videojs/video.js#4093 with videojs/video.js#4131. This is neccessary for text tracks to work in Chrome.
The v5.18.0 release of video.js includes a fix for videojs/video.js#4093 with videojs/video.js#4131. This is neccessary for text tracks to work in Chrome.
The v5.18.0 release of video.js includes a fix for videojs/video.js#4093 with videojs/video.js#4131. This is neccessary for text tracks to work in Chrome.
The v5.18.0 release of video.js includes a fix for videojs/video.js#4093 with videojs/video.js#4131. This is neccessary for text tracks to work in Chrome.
The v5.18.0 release of video.js includes a fix for videojs/video.js#4093 with videojs/video.js#4131. This is neccessary for text tracks to work in Chrome.
The v5.18.0 release of video.js includes a fix for videojs/video.js#4093 with videojs/video.js#4131. This is neccessary for text tracks to work in Chrome.
The v5.18.0 release of video.js includes a fix for videojs/video.js#4093 with videojs/video.js#4131. This is neccessary for text tracks to work in Chrome.
* Use dash controlled text tracks As of video.js v5.14, video.js no longer supports native subtitles on anything besides Safari. For Chrome, this means there is *no* subtitle support with mpeg-dash. This will wait for dash.js to load all the text tracks and then add them to video.js if we're using a version that does not attempt to use native subtitles. When the video.js menu is used to change captions, we'll set the corresponding active text track in dash. We *cannot* dynamically add text track cues to video.js beacuse fragmented text tracks are loaded on the fly and there's no event fired when they are loaded. Therefore, we must has dash to natively display captions. * Update README.md to describe `nativeCaptions` usage requirements * Require [email protected] The v5.18.0 release of video.js includes a fix for videojs/video.js#4093 with videojs/video.js#4131. This is neccessary for text tracks to work in Chrome. * fixup! Use dash controlled text tracks - Only set `textTrack.mode` for `captions` and `subtitles. - Don't call the initial `updateActiveDashTextTrack` until after the `textTrack.mode`s have been set.
Description
In
tech.js#addWebVttScript_
, all of the exports fromvtt.js
are blindly added towindow
. This will break the ability to call Chrome's nativeTextTrack.prototype.addCue()
because Chrome expects an instance of it's nativeVTTCue
and not thevtt.js
version.This will effect all use cases of calling
textTrack.addCue()
. I found the issue while trying to restore text track functionality tovideojs-contrib-dash
in videojs/videojs-contrib-dash#135. The details of the error can be seen specifically in this comment videojs/videojs-contrib-dash#135 (comment).Reduced Test Case
http://jsbin.com/tomegu/7/edit?html,js,output
The console will show the error thrown.
Results
Expected
I expect
TextTrack.addCue(new VTTCue( ... ))
to add cues.Actual
Chrome will throw an error, shown below.
Error output
Additional Information
versions
videojs
I haven't checked any versions besides
v5.16
, but the same code exists inmaster
so I assume all of the version.browsers
Chrome
OSes
Only tested on MacOS 10.12.3 (latest as of this writing)
plugins
None
Resolution
I propose that only values that do not exist on
window
are defined when iterating throughvtt.js
's exports.This reduced test case shows a cue being added as expected when using the native
VTTCue
in Chrome.http://jsbin.com/yelizon/5/edit?html,js,output
The text was updated successfully, but these errors were encountered: