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
|
<!DOCTYPE html>
<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
<html>
<head>
<title>setMediaKeys() again after resetting src</title>
<script src="encrypted-media-utils.js"></script>
<!--
Test has been migrated to the root directory and is being disabled here.
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-->
</head>
<body>
<video id="testVideo"></video>
<div id="log"></div>
<script>
promise_test(function(test)
{
var video = document.getElementById('testVideo');
var keyId = stringToUint8Array('0123456789012345');
var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
var content = 'webm/test-encrypted.webm';
var duration = 0.2;
return createMediaKeys(keyId, rawKey).then(function(mediaKeys) {
return video.setMediaKeys(mediaKeys);
}).then(function() {
return playVideoAndWaitForTimeupdate(video, content, duration);
}).then(function() {
// Now create a second MediaKeys and repeat.
return createMediaKeys(keyId, rawKey);
}).then(function(mediaKeys) {
// MediaKeys is use by previous video, so clear .src
// so that MediaKeys can be assigned.
video.src = '';
return video.setMediaKeys(mediaKeys);
}).then(function() {
return playVideoAndWaitForTimeupdate(video, content, duration);
});
}, 'setMediaKeys() again after resetting src');
</script>
</body>
</html>
|