-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
executable file
·72 lines (66 loc) · 2.56 KB
/
index.html
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!doctype html>
<html>
<head data-cast-api-enabled="true">
<meta charset="utf-8">
<title>videojs-externals Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<link href="node_modules/video.js/dist/video-js.css" rel="stylesheet">
<script src="node_modules/video.js/dist/video.js"></script>
<script src="dist/videojs-externals.js"></script>
</head>
<body>
<div id="video-container">
<!--<video id="player"-->
<!--class="video-js vjs-fluid vjs-default-skin"-->
<!--controls-->
<!--autoplay>-->
<!--</video>-->
</div>
<script>
var container = document.getElementById('video-container');
var player;
var self = this;
function initPlayer () {
if (container.firstChild) {
container.removeChild(container.firstChild);
}
if (player) {
player.one('dispose', function () {
setTimeout(function () {
self.createInstance();
}, 10)
});
return player.dispose();
}
self.createInstance();
}
function createInstance () {
// container = document.createElement('div');
// container.id = 'video-container';
// document.body.appendChild(container);
var video = document.createElement('video');
video.id = 'player';
video.className = 'video-js vjs-fluid vjs-default-skin';
video.crossOrigin = true;
video.setAttribute('crossorigin', true);
container.appendChild(video);
player = videojs('player', {
controls: true,
autoplay: 0,
width: 250,
techOrder: ['youtube', 'soundcloud', 'dailymotion', 'vimeo', 'spotify', 'deezer', 'html5'],
// sources: [{"type": "video/mp4", "src": "http://vjs.zencdn.net/v/oceans.mp4"}],
// sources: [{"type": "video/soundcloud", "src": "https://soundcloud.com/yozzie-b/rhiana-where-have-u-been-ukg"}],
// sources: [{"type": "video/youtube", "src": "https://www.youtube.com/watch?v=kOkQ4T5WO9E"}],
// sources: [{"type": "video/vimeo", "src": "https://vimeo.com/153979733"}],
// sources: [{"type": "video/spotify", "src": "spotify:track:2zKoA5gp5Xaw3mrp45XIrR"}],
// sources: [{"type": "audio/deezer", "src": "http://www.deezer.com/track/1167893"}],
sources: [{"type": "video/dailymotion", "src": "http://www.dailymotion.com/video/x56imdz_une-pluie-d-hommages-pour-le-chanteur-george-michael-sur-les-reseaux-sociaux_news"}],
}).on('loadedmetadata', function (e) {
// alert(e.message);
});
}
</script>
<button onclick="initPlayer()">load</button>
</body>
</html>