| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>setMediaKeys() again after resetting src</title> | 4 <title>setMediaKeys() again after resetting src</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 promise_test(function(test) | 13 promise_test(function(test) |
| 14 { | 14 { |
| 15 var video = document.getElementById('testVideo'); | 15 var video = document.getElementById('testVideo'); |
| 16 var keyId = stringToUint8Array('0123456789012345'); | 16 var keyId = stringToUint8Array('0123456789012345'); |
| 17 var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14,
0xd2, 0x7b, | 17 var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14,
0xd2, 0x7b, |
| 18 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4,
0xae, 0x3c]); | 18 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4,
0xae, 0x3c]); |
| 19 var content = '../content/test-encrypted.webm'; | 19 var content = '../content/test-encrypted.webm'; |
| 20 var duration = 0.2; | 20 var duration = 0.2; |
| 21 | 21 |
| 22 return createMediaKeys(keyId, rawKey).then(function(mediaKeys) { | 22 return createClearKeyMediaKeysAndInitializeWithOneKey(keyId, raw
Key).then(function(mediaKeys) { |
| 23 return video.setMediaKeys(mediaKeys); | 23 return video.setMediaKeys(mediaKeys); |
| 24 }).then(function() { | 24 }).then(function() { |
| 25 return playVideoAndWaitForTimeupdate(video, content, duratio
n); | 25 return playVideoAndWaitForTimeupdate(video, content, duratio
n); |
| 26 }).then(function() { | 26 }).then(function() { |
| 27 // Now create a second MediaKeys and repeat. | 27 // Now create a second MediaKeys and repeat. |
| 28 return createMediaKeys(keyId, rawKey); | 28 return createClearKeyMediaKeysAndInitializeWithOneKey(keyId,
rawKey); |
| 29 }).then(function(mediaKeys) { | 29 }).then(function(mediaKeys) { |
| 30 // MediaKeys is use by previous video, so clear .src | 30 // MediaKeys is use by previous video, so clear .src |
| 31 // so that MediaKeys can be assigned. | 31 // so that MediaKeys can be assigned. |
| 32 video.src = ''; | 32 video.src = ''; |
| 33 return video.setMediaKeys(mediaKeys); | 33 return video.setMediaKeys(mediaKeys); |
| 34 }).then(function() { | 34 }).then(function() { |
| 35 return playVideoAndWaitForTimeupdate(video, content, duratio
n); | 35 return playVideoAndWaitForTimeupdate(video, content, duratio
n); |
| 36 }); | 36 }); |
| 37 }, 'setMediaKeys() again after resetting src'); | 37 }, 'setMediaKeys() again after resetting src'); |
| 38 </script> | 38 </script> |
| 39 </body> | 39 </body> |
| 40 </html> | 40 </html> |
| OLD | NEW |