-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
71 lines (65 loc) · 2.54 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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>videojs-cmcd Demo</title>
<link href="node_modules/video.js/dist/video-js.css" rel="stylesheet">
<link rel="shortcut icon" href="#">
</head>
<body>
<video id="videojs-cmcd-player" class="video-js vjs-default-skin" controls></video>
<select id="video-selector">
<option value= "0" >Big Buck Bunny (HLS) </option>
<option value= "1" >Dolby VOD (HLS) </option>
<option value= "2" >Live Akamai (HLS) </option>
<option value= "3" >Big Buck Bunny (Dash) </option>
</select>
<ul>
<li><a href="/test/debug.html">Run unit tests in browser.</a></li>
<li><a href="docs/api/">Read generated docs.</a></li>
</ul>
<script src='https://cdn.jsdelivr.net/npm/@montevideo-tech/cmcd-validator@latest/dist/cmcd-validator.min.js'></script>
<script src="node_modules/video.js/dist/video.js"></script>
<script src="dist/videojs-cmcd.js"></script>
<script>
(function(window, videojs) {
// Init player and plguin
var player = window.player = videojs('videojs-cmcd-player');
var cmcd = window.cmcd = player.cmcd({sid: 'SesssionID'});
// Add CMCDValidator (open the browser console to see the logs)
player.on('loadstart', function() {
var obr = player.tech().vhs.xhr.beforeRequest
player.tech().vhs.xhr.beforeRequest = function(options) {
if (obr) obr(options)
console.log(window.CMCDValidator.CMCDQueryValidator(options.uri))
return options;
};
})
const videoSelector = window.document.getElementById('video-selector');
videoSelector.addEventListener('change', (event) => {
const list = [
{
src: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
type: 'application/x-mpegURL'
},
{
src: 'http://d3rlna7iyyu8wu.cloudfront.net/skip_armstrong/skip_armstrong_stereo_subs.m3u8',
type: 'application/x-mpegURL'
},
{
src: 'https://moctobpltc-i.akamaihd.net/hls/live/571329/eight/playlist.m3u8',
type: 'application/x-mpegURL'
},
{
src: 'https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd',
type: 'application/dash+xml'
}
];
const selectedValue = event.target.value;
player.src(list[selectedValue]);
player.cmcd().setId({cid: list[selectedValue].src});
});
}(window, window.videojs));
</script>
</body>
</html>