forked from alexandrebrg/go-clearkey-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
54 lines (48 loc) · 1.62 KB
/
test.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test file with DASH.JS</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.1.0/dash.all.min.js" integrity="sha512-CwVbN65cljprTCtPLHc2EenIIJlvKDGOu8boC2+NCVnPeee7sZFNF0dnYJRYf06dpesy/euX2Om8wGY3wR/qOg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>
<body>
<div>
<video id="videoPlayer" controls></video>
</div>
</body>
<script>
function init() {
const protData = {
"org.w3.clearkey": {
// "clearkeys": {
// "EhoPyg8bR1uJECl_qOCgfg": "EhoPyg8bR1uJECl_qOCgfg",
// },
"serverURL": "http://localhost:8080/license"
}
};
var video,
player,
url = "http://127.0.0.1:9000/drmtest/stream.mpd";
video = document.querySelector("video");
player = dashjs.MediaPlayer().create();
const callback = (payload) => {
console.log(payload)
return new Promise((resolve, reject) => {
let test = JSON.stringify(payload.data)
payload.data = test
resolve(payload)
})
}
const callbackResponse = (payload) => {
console.log(payload)
return new Promise((resolve,reject) => {
resolve(payload)
})
}
player.initialize(video, url, true);
player.registerLicenseRequestFilter(callback)
player.registerLicenseResponseFilter(callbackResponse)
player.setProtectionData(protData);
}
init()
</script>