-
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
tries to load node_modules/vtt.js/dist/vtt.js over network #2135
Comments
It should only do that if there's no VTT object on the WebVTT object on the window. video.js/src/js/tracks/text-track.js Line 248 in 7bbbf99
Are you not using the main version that includes VTT.js? Or can you put up a live demo or jsbin of what you're doing? |
I am using the novtt version. |
Are you using tracks or not? If you are using tracks you need to include your own copy of VTT.js in the page before video.js. If you're not using tracks, then this might be considered a bug. |
I don't think it should try to load a node module in any case in a web browser. |
I'm not sure if this was meant for debugging and accidentally left in, but here's why you're seeing this. Is this intentional, @gkatsev? |
Yes. It was intentional. It probably needs to be reworked a bit, especially to not load it if tracks aren't being used. |
Ok cool, just making sure it wasn't an artifact from development. It seems really weird to try and request something out of the |
Is there a difference between the Each of those fails on trying to load from |
|
I think this had to do with the way I was requiring it from webpack |
Is it something others might do too or your unique to your setup? |
I'm also seeing this requiring the full video.js using webpack. but only when a file needs to use the flash (video-js.swf) player. error breaks on this line as pointed out in an earlier comment. I'm not using tracks. Is there a way to forcefully turn off tracks completely? |
I'm not using tracks at all and got things working by using
|
Fixed in #2741, I believe. |
I'm still getting this error in the current build, compiling with webpack using If I try to import the dist instead |
@baseten Timing. I just encountered this too, with webpack. Easy fix:
Then where you start your VideoJS or create it's config: import vttJsPath from 'file-loader?name=vtt.js.[hash].[ext]!videojs-vtt.js/dist/vtt.min.js';
...
const videoJSConfig = {
'vtt.js': vttJsPath,
...
}; It ain't pretty but it works here on 5.12.6. |
Seeing this problem as well but only in FireFox, even though I'm not using tracks. As far as I can tell, this return statement is never hit, even when there are no tracks: https://github.com/videojs/video.js/blob/master/src/js/tech/tech.js#L472 ...because it's just checking if an object is falsey, and even though Problem goes away if I use the CDN version too though, just annoying not to be able to bundle with the rest of my JS via Webpack. |
Just checked the latest pre-release, this now happens in Chrome as well, not just FireFox. |
Also seeing this in Chrome with Webpack - not using tracks. |
Seeing this issue as well... |
A simple workaround seems to be to add this to webpack config:
|
If you're using webpack then the current method to add WebVTT support is broken. The simplest workaround is to add the npm module videojs-vtt.js to your window, i.e.
videojs-vtt.js is already a requirement of video.js however it doesn't attach it to your window unless it sees your browser needs it (although as pointed out below this fails - hence the errors). The method at fault is: https://github.com/videojs/video.js/blob/master/src/js/tech/tech.js#L525 It is currently trying to set a scripts src to:
The alternative It seems to me that the module Alternatively if the user is utilising tracks then we warn them that they need to manually include |
I was going to point out that we're fixing it (or trying to: #3794) but then I realized that this only solves it for people loading in the dist file or browserify. I'm going to make sure our solution ends up being bundler agnostic. |
Thanks @theGC! That seems to solve the issue temporarily for me. |
Just merged #3919, it should fix the issue for webpack and browserify users. |
Thanks, guys! Just curious, when is this slated for release? |
It's been released as 5.16.0 which is currently |
Thanks, @gkatsev! Really appreciate it. |
I just updated my video.js npm package to v5.16.0, re-bundled my app with Webpack, and ran a small set of video player smoke tests. Confirming the problem is fixed for me. I'm no longer seeing the errors in the console. THANKS, AGAIN! |
@natorojr thanks for verifying! |
"NetworkError: 404 Not Found - http://localhost/node_modules/vtt.js/dist/vtt.js"
I think this is not meant to be ran client side.
The text was updated successfully, but these errors were encountered: