forked from TwigWorld/videojs-analytics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
91 lines (89 loc) · 2.29 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>videojs-analytics Demo</title>
<link href="/node_modules/video.js/dist/video-js.css" rel="stylesheet">
</head>
<body>
<video id="videojs-analytics-player" class="video-js vjs-default-skin" controls>
<source src="//vjs.zencdn.net/v/oceans.mp4" type='video/mp4'>
<source src="//vjs.zencdn.net/v/oceans.webm" type='video/webm'>
</video>
<ul>
<li><a href="/test/">Run unit tests in browser.</a></li>
</ul>
<script src="/node_modules/video.js/dist/video.js"></script>
<script src="/dist/videojs-analytics.js"></script>
<script>
(function(window, videojs) {
window.ga = function(send, event, event, category, label) {
console.log({
send: send,
event: event,
category: category,
label: label,
})
return true;
}
var player = window.player = videojs('videojs-analytics-player');
player.analytics({
events: [
{
name: 'play',
label: 'video play',
action: 'play',
},
{
name: 'pause',
label: 'video pause',
action: 'pause',
},
{
name: 'ended',
label: 'video ended',
action: 'ended',
},
{
name: 'fullscreenchange',
label: {
open: 'video fullscreen open',
exit: 'video fullscreen exit'
},
action: 'fullscreen change',
},
{
name: 'volumechange',
label: 'volume changed',
action: 'volume changed',
},
{
name: 'resize',
label: 'resize',
action: 'resize',
},
{
name: 'error',
label: 'error',
action: 'error',
},
{
name: 'resize',
label: 'resize',
action: 'resize',
},
{
name: 'resolutionchange',
action: 'resolution change',
},
{
name: 'timeupdate',
action: 'time updated',
}
],
assetName: 'Seagulls video'
});
}(window, window.videojs));
</script>
</body>
</html>