-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
86 lines (75 loc) · 2.43 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
<!DOCTYPE html>
<html>
<head>
<!-- Shaka Player compiled library: -->
<script src="https://ajax.googleapis.com/ajax/libs/shaka-player/4.4.1/shaka-player.compiled.js"></script>
<style>
html,
body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
border: 0;
}
</style>
</head>
<body>
<script>
var manifestUri =
"https://media.axprod.net/TestVectors/v7-MultiDRM-SingleKey/Manifest_1080p_ClearKey.mpd";
function initApp() {
// Install built-in polyfills to patch browser incompatibilities.
shaka.polyfill.installAll();
// Check to see if the browser supports the basic APIs Shaka needs.
if (shaka.Player.isBrowserSupported()) {
// Everything looks good!
initPlayer();
} else {
// This browser does not have the minimum set of APIs we need.
console.error("Browser not supported!");
}
}
function initPlayer() {
// Create a Player instance.
var video = document.getElementById("video");
var player = new shaka.Player(video);
player.configure({
drm: {
clearKeys: {
// 'key-id-in-hex': 'key-in-hex',
nrQFDeRLSAKTLifXUIPiZg: "FmY0xnWCPCNaSpRG-tUuTQ",
},
},
});
console.log(player.getConfiguration());
// Attach player to the window to make it easy to access in the JS console.
window.player = player;
// Listen for error events.
player.addEventListener("error", onErrorEvent);
// Try to load a manifest.
// This is an asynchronous process.
player
.load(manifestUri)
.then(function () {
// This runs if the asynchronous load is successful.
console.log("The video has now been loaded!");
})
.catch(function () {
// onError is executed if the asynchronous load fails.
onError(e);
});
}
function onErrorEvent(event) {
// Extract the shaka.util.Error object from the event.
onError(event.detail);
}
function onError(error) {
// Log the error.
console.error("Error code", error.code, "object", error);
}
document.addEventListener("DOMContentLoaded", initApp);
</script>
<video id="video" controls autoplay></video>
</body>
</html>