| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>setMediaKeys() again after resetting src</title> |
| <script src="encrypted-media-utils.js"></script> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <video></video> |
| <script> |
| promise_test(function(test) |
| { |
| var video = document.querySelector('video'); |
| 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 = '../content/test-encrypted.webm'; |
| var duration = 0.2; |
| |
| return createClearKeyMediaKeysAndInitializeWithOneKey(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 createClearKeyMediaKeysAndInitializeWithOneKey(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> |