-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvideo-js-load.js
More file actions
30 lines (24 loc) · 810 Bytes
/
video-js-load.js
File metadata and controls
30 lines (24 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//Functions to run after the script tag has loaded
var videojsLoadCallback = function(){
_V_.options.flash.swf = "//vjs.zencdn.net/4.11/video-js.swf";
};
//If the script doesn't load
var videojsErrorCallback = function(error){
if(typeof console !== undefined) {
console.log(error);
}
};
var head = document.getElementsByTagName('head')[0];
//Generate a style tag
var style = document.createElement('link');
style.type = 'text/css';
style.rel = "stylesheet";
style.href = '//vjs.zencdn.net/4.11/video-js.css';
head.appendChild(style);
//Generate a script tag
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = '//vjs.zencdn.net/4.11/video.js';
script.onload = videojsLoadCallback;
script.onerror = videojsErrorCallback;
head.appendChild(script);