4 <title>Change MediaKeys after play
</title>
5 <script src=
"encrypted-media-utils.js"></script>
6 <script src=
"../../resources/testharness.js"></script>
7 <script src=
"../../resources/testharnessreport.js"></script>
10 <video id=
"testVideo"></video>
13 promise_test(function(test
)
15 var video
= document
.getElementById('testVideo');
16 var keyId
= stringToUint8Array('0123456789012345');
17 var rawKey
= new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
18 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
19 var content
= '../content/test-encrypted.webm';
22 return createMediaKeys(keyId
, rawKey
).then(function(mediaKeys
) {
23 return video
.setMediaKeys(mediaKeys
);
25 return playVideoAndWaitForTimeupdate(video
, content
, duration
);
27 // Now create a second MediaKeys.
28 return createMediaKeys(keyId
, rawKey
);
29 }).then(function(mediaKeys
) {
30 // video is currently playing, so should not be able to
31 // change MediaKeys now.
32 assert_false(video
.ended
);
33 return video
.setMediaKeys(mediaKeys
);
35 assert_unreached('Able to change MediaKeys while playing.');
38 assert_equals(error
.name
, 'InvalidStateError');
39 return Promise
.resolve('success');
41 }, 'Change MediaKeys after play');