ReferenceError: videojs not defined

I use video.js (in CDN mode) and everything works fine (with Firefox 26.0). Video is embedded and works great. But when I want to access the video object, I get a console error: ReferenceError: videojs is not defined in the code line where I want to access the object:

var myPlayer = videojs('example_video_1'); 

Googling arround could not solve my problem. I saw implementations in which users used: V as a constructor instead of videojs , but this did not solve my problem).

This is my script where I want to access the object:

 <script type="text/javascript"> $("#button1").on("click", function(){ console.log( "You clicked a paragraph!" ); var myPlayer = videojs('example_video_1'); }); </script> 

This is my headline

 <link href="http://vjs.zencdn.net/4.5/video-js.css" rel="stylesheet"> <script src="http://vjs.zencdn.net/4.5/video.js"></script> <script language="javascript" type="text/javascript" src="js/jquery.js"></script> 

And this is my video declaration

 <video id="example_video_1" class="video-js vjs-default-skin" controls preload="auto" width="1270" height="720" poster="videos/search.png" data-setup="{}"> <source src="videos/search.webm" type='video/webm'> <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p> </video> 

I would be happy for any support.

+6
source share
1 answer

After a year and a half, this problem arose for me. I just installed it through npm install --save video.js and moved the file from the dist folder to the open script folder, and it worked.

+1
source

Source: https://habr.com/ru/post/969518/


All Articles