OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Clear Key Playback</title> | 4 <title>Clear Key Playback</title> |
5 <script src="encrypted-media-utils.js"></script> | 5 <script src="encrypted-media-utils.js"></script> |
6 <script src="../../resources/testharness.js"></script> | 6 <script src="../../resources/testharness.js"></script> |
7 <script src="../../resources/testharnessreport.js"></script> | 7 <script src="../../resources/testharnessreport.js"></script> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <video id="testVideo"></video> | 10 <video id="testVideo"></video> |
11 <div id="log"></div> | 11 <div id="log"></div> |
12 <script> | 12 <script> |
13 async_test(function(test) | 13 async_test(function(test) |
14 { | 14 { |
15 var video = document.getElementById('testVideo'); | 15 var video = document.getElementById('testVideo'); |
| 16 var content = '../content/test-encrypted.webm'; |
16 var isUpdatePromiseResolved = false; | 17 var isUpdatePromiseResolved = false; |
17 var encryptedEventCount = 0; | 18 var encryptedEventCount = 0; |
18 | 19 |
19 var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14,
0xd2, 0x7b, | 20 var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14,
0xd2, 0x7b, |
20 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4,
0xae, 0x3c]); | 21 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4,
0xae, 0x3c]); |
21 | 22 |
22 function onEncrypted(event) | 23 function onEncrypted(event) |
23 { | 24 { |
24 assert_equals(event.target, video); | 25 assert_equals(event.target, video); |
25 assert_true(event instanceof window.MediaEncryptedEvent); | 26 assert_true(event instanceof window.MediaEncryptedEvent); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 65 } |
65 | 66 |
66 function onTimeUpdate(event) | 67 function onTimeUpdate(event) |
67 { | 68 { |
68 if (event.target.currentTime < 0.2 || !isUpdatePromiseResolv
ed) | 69 if (event.target.currentTime < 0.2 || !isUpdatePromiseResolv
ed) |
69 return; | 70 return; |
70 | 71 |
71 test.done(); | 72 test.done(); |
72 } | 73 } |
73 | 74 |
74 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).t
hen(function(access) { | 75 navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConf
igurationForFile(content)).then(function(access) { |
75 return access.createMediaKeys(); | 76 return access.createMediaKeys(); |
76 }).then(function(mediaKeys) { | 77 }).then(function(mediaKeys) { |
77 | 78 |
78 waitForEventAndRunStep('encrypted', video, onEncrypted, test
); | 79 waitForEventAndRunStep('encrypted', video, onEncrypted, test
); |
79 waitForEventAndRunStep('playing', video, onPlaying, test); | 80 waitForEventAndRunStep('playing', video, onPlaying, test); |
80 | 81 |
81 return video.setMediaKeys(mediaKeys); | 82 return video.setMediaKeys(mediaKeys); |
82 }).then(function(result) { | 83 }).then(function(result) { |
83 video.src = '../content/test-encrypted.webm'; | 84 video.src = content; |
84 video.play(); | 85 video.play(); |
85 }).catch(function(error) { | 86 }).catch(function(error) { |
86 forceTestFailureFromPromise(test, error); | 87 forceTestFailureFromPromise(test, error); |
87 }); | 88 }); |
88 }, 'Playback using Clear Key key system, calling setMediaKeys() befo
re setting src attribute.'); | 89 }, 'Playback using Clear Key key system, calling setMediaKeys() befo
re setting src attribute.'); |
89 </script> | 90 </script> |
90 </body> | 91 </body> |
91 </html> | 92 </html> |
OLD | NEW |