-
Notifications
You must be signed in to change notification settings - Fork 14
/
mp4.html
85 lines (75 loc) · 2.25 KB
/
mp4.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
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html, body {
height: 100%;
margin: 0;
padding: 0;
margin-bottom: 0;
overflow: hidden;
background-color: black;
height: 100%;
}
#player {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<video id="player">
<source id="player-mp4src" type="video/mp4">
</video>
<script type="text/javascript" src="medialib.js"></script>
<script src="http://vjs.zencdn.net/5.10.4/video.js"></script>
<script type="text/javascript">
medialibDelegate = medialib.createEventDelegate({
play: function() {
this.play();
},
pause: function() {
this.pause();
},
seek: function(obj) {
this.currentTime(obj.time);
},
setVolume: function(obj) {
this.volume(obj.vol);
}
});
var params = medialib.getParams();
var id = decodeURIComponent(params.id || params.vid);
var el = document.getElementById("vid");
document.getElementById("player-mp4src").setAttribute("src", id);
videojs("player", {"controls": false, "preload": "auto"}, function() {
this.load();
}).ready(function() {
this.on("play", function(e) {
medialib.emitEvent("stateChange", {state: "playing", time: this.currentTime()});
});
this.on("pause", function(e) {
medialib.emitEvent("stateChange", {state: "paused", time: this.currentTime()});
});
this.on("ended", function(e) {
medialib.emitEvent("stateChange", {state: "ended", time: this.currentTime()});
});
this.on("seeking", function(e) {
medialib.emitEvent("stateChange", {state: "buffering", time: this.currentTime()});
});
this.on("seeked", function(e) {
medialib.emitEvent("stateChange", {state: "playing", time: this.currentTime()});
});
medialibDelegate.playerLoaded(this);
});
</script>
<script>
(function(m,e,d,i,a,l,b){m['GoogleAnalyticsObject']=a;m[a]=m[a]||function(){
(m[a].q=m[a].q||[]).push(arguments)},m[a].l=1*new Date();l=e.createElement(d),
b=e.getElementsByTagName(d)[0];l.async=1;l.src=i;b.parentNode.insertBefore(l,b)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-43467815-2', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>