-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Uncaught TypeError: videojs is not a function error in 5.0, autoSetup #2386
Comments
This one should be fixed in the latest 5.0 RC. Let me know if you find differently. |
Hi, I get this message with the current 5.0.0 in Firefox (https://github.com/videojs/video.js/releases/tag/v5.0.0). // Check if data-setup attr exists.
// We only auto-setup if they've added the data-setup attr.
if (options !== null) {
// Create new video.js instance.
var player = videojs(mediaEl);
} Video plays and everything seems to work fine. However as we log client side js errors to our server through an API ( we want to notice if things are not working well ) this generates a whole lot of error messages. |
My personal workaround, in the video.js file, remove: // l. 11283
var videojs = undefined; // remove this line and // l. 11344
var autoSetupTimeout = function autoSetupTimeout(wait, vjs) {
videojs = vjs; // remove this line
setTimeout(autoSetup, wait);
}; Since |
my workaround: change
|
Does it still happen with the latest videojs release (5.0.2 or next release 5.1.0)? |
I have just upgraded to 5.1.0 from 4.12.5 and the problem showed up. |
I upgraded from 4.11.2 to 5.2.0 and and the problem showed up. |
Reopening since @WebDevRN is still seeing this issue. Would you have to have a reduced test case? |
Hi everyone! I suspect that this has to do with jQuery. On my page, when I load video.js and then jQuery, I get the same error. When I FIRST load jQuery and THEN video.js, everything works fine. So this is the setup that generates the problem: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link href="http://vjs.zencdn.net/5.2.1/video-js.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/5.2.1/video.js"></script>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.11.3.js'></script>
</head>
<body>
<video id="example_video_1" class="video-js vjs-default-skin"
controls preload="auto" width="640" height="320"
poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup='{ "autoplay": true, "controlBar": {"fullscreenToggle": false, "progressControl": true}}'>
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />
</video>
</body>
</html> Unfortunately, when I use the hosted jQuery, I can't reproduce the error consistently. When I load over the cache (CTRL + F5) I can only reproduce the error about 1 in 10 times. If I use the script hosted in my development site, I get it 4 out of 5 times. For the next 2 weeks or so you can test with my page: <script type='text/javascript' src='http://46.101.144.93/wp-includes/js/jquery/jquery.js?ver=1.11.3'></script> After that, I will shutdown this VM but I hope you can reproduce it yourself. Best regards, |
Please check setup.js. In function autoSetupTimeout, videojs is initialized before autoSetup is called. |
I think you can use setTimeout to wait the videojs is initialized. Or delete attribute data-setup of video tag in html. and initiate the video player in js. |
script defer="defer" src="http://vjs.zencdn.net/ie8/1.1.1/videojs-ie8.min.js this worked for me |
Consistently getting the same error on iPhone with just updated version 5.8.7. Surprisingly iPad and desktop browsers works fine... |
My bug report seems to be the same issue but I only experience it on IE8 when I use data-setup="{}" (doesn't have to be empty) rather than javascript initialization and if I have the meta charset="utf-8" tag in my document. I tested on IE11, Firefox 45, and iPhone 9.3 and they work as expected. Start by first clearing your cache whenever you visit the page to test. When you visit it in IE8 you get the error message. If you refresh the page, usually once but sometimes it takes 2 refreshes, you'll get the play button but missing the play triangle (utf8 issue) but if you mouse over the play button it appears correctly. The video will then play fine too. It does seem to be a timing issue but the utf8 part must be part of it somehow. Here's my minimal test case: http://ivcmiami.com/test/ |
@sethborg thanks for the example. Definitely not showing video-js on iPhone 6 Plus. I can see a native media player, but also there is no error. |
Pretty sure you're never going to see videojs controls on iPhone. I don't see them on videojs.com. I just included the test cause someone mentioned it not playing videos on iPhone for them. |
* upstream/stable: (77 commits) v5.9.2 @gkatsev grouped text track errors in the console, if we can. closes videojs#3259 v5.9.1 @gkatsev fixed text track tests for older IEs. closes videojs#3269 revert 75116d4 adding chrome to travis (videojs#3254) @forbesjo added back the background color to the poster. closes videojs#3267 @gkatsev fixed removeRemoteTextTracks not working with return value from addRemoteTextTracks. closes videojs#3253 @gkatsev made the first emulated text track enabled by default. closes videojs#3248 @mister-ben blacklisted Chrome for Android for playback rate support. closes videojs#3246 @benjipott updated IS_CHROME to not be true on MS Edge. closes videojs#3232 v5.9.0 @andyearnshaw updated document event handlers to use el.ownerDocument. closes videojs#3230 @chrisauclair added ARIA region and label to player element. closes videojs#3227 @MCGallaspy added vttjs to the self-hosting guide. closes videojs#3229 @forbesjo added chrome for PR tests. closes videojs#3235 @OwenEdwards improved handling of deprecated use of Button component. closes videojs#3236 v5.8.8 @seescode fixed dragging on mute toggle changing the volume. Fixes videojs#3036. Closes videojs#3228 @seescode fixed css failing on IE8 due to incorrect ie8 hack. Fixes videojs#3140. Closes videojs#3226. @vtytar fixed auto-setup failing if taking too long to load. Fixes videojs#2386. Closes videojs#3233. ...
@grebett solution works |
I continue to get this message - I am using rc_2, 5.0.
It does not seem to affect anything - people I have shown it to believe it is a timing issue.
In chrome browser, clicking on the error in output window takes one to line 9407 --, which is 👍
var player = videojs(mediaEl);
From the code:
The text was updated successfully, but these errors were encountered: