OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Waiting for a key.</title> | 4 <title>Waiting for a key.</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> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 function onTimeUpdate(event) | 84 function onTimeUpdate(event) |
85 { | 85 { |
86 if (event.target.currentTime < 0.5 || !sessionReadyReceived) | 86 if (event.target.currentTime < 0.5 || !sessionReadyReceived) |
87 return; | 87 return; |
88 | 88 |
89 test.done(); | 89 test.done(); |
90 } | 90 } |
91 | 91 |
| 92 waitForEventAndRunStep('needkey', video, onNeedKey, test); |
| 93 waitForEventAndRunStep('playing', video, onPlaying, test); |
| 94 video.src = '../content/test-encrypted.webm'; |
| 95 |
92 MediaKeys.create('org.w3.clearkey').then(function(mediaKeys) { | 96 MediaKeys.create('org.w3.clearkey').then(function(mediaKeys) { |
93 waitForEventAndRunStep('needkey', video, onNeedKey, test); | 97 return video.setMediaKeys(mediaKeys); |
94 waitForEventAndRunStep('playing', video, onPlaying, test); | 98 }).then(function(result) { |
95 | |
96 video.setMediaKeys(mediaKeys); | |
97 video.src = '../content/test-encrypted.webm'; | |
98 video.play(); | 99 video.play(); |
99 }).catch(function(error) { | 100 }).catch(function(error) { |
100 forceTestFailureFromPromise(test, error); | 101 forceTestFailureFromPromise(test, error); |
101 }); | 102 }); |
102 }, 'Waiting for a key.'); | 103 }, 'Waiting for a key.'); |
103 </script> | 104 </script> |
104 </body> | 105 </body> |
105 </html> | 106 </html> |
OLD | NEW |