Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/resources/clearkey-retrieve-persistent-license.html

Issue 2546853003: Add W3C encrypted-media tests (Closed)
Patch Set: rebase now that content files landed Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <meta charset=utf-8>
5 <title>Encrypted Media Extensions: persistent-license, retrieve and playback , ClearKey</title>
6 <link rel="help" href="https://w3c.github.io/encrypted-media/">
7
8 <!-- Helper scripts for Encrypted Media Extensions tests -->
9 <script src=/encrypted-media/util/utils.js></script>
10 <script src=/encrypted-media/util/fetch.js></script>
11 <script src=/encrypted-media/util/utf8.js></script>
12 <script src=/encrypted-media/util/testmediasource.js></script>
13
14 </head>
15 <body>
16 <div id='log'></div>
17
18 <div id='video'>
19 <video id="videoelement" width="200px"></video>
20 </div>
21
22 <script>
23 // Wait for a message from the main window with details of our task
24 window.addEventListener( 'message', function( event ) {
25
26 var config = event.data.config,
27 configuration = { initDataTypes: [ config.initDataType ],
28 audioCapabilities: [ { contentType: config.audio Type } ],
29 videoCapabilities: [ { contentType: config.video Type } ],
30 sessionTypes: [ 'persistent-license' ] },
31 assertions = [ ];
32
33 var _mediaKeySession;
34
35 config.video = document.getElementById('videoelement');
36
37 function onComplete() {
38 window.opener.postMessage(assertions, '*');
39 }
40
41 function onFailure(error) {
42 assertions.push( { actual: false, expected: true, message: error.toS tring() } );
43 onComplete();
44 }
45
46 function onTimeupdate(event) {
47 if ( config.video.currentTime > ( config.duration || 1 ) ) {
48 config.video.pause();
49 _mediaKeySession.close()
50 }
51 }
52
53 navigator.requestMediaKeySystemAccess(config.keysystem, [ configuration ] )
54 .then(function(access) {
55 return access.createMediaKeys();
56 }).then(function(mediaKeys) {
57 config.video.setMediaKeys(mediaKeys);
58 config.video.addEventListener('timeupdate', onTimeupdate, true);
59 _mediaKeySession = mediaKeys.createSession( 'persistent-license' );
60 _mediaKeySession.closed.then(onComplete);
61 return _mediaKeySession.load(event.data.sessionId);
62 }).then(function( success ) {
63 if ( !success ) throw new DOMException( 'Could not load session' );
64 return testmediasource(config);
65 }).then(function(source) {
66 config.video.src = URL.createObjectURL(source);
67 config.video.play();
68 })
69 .catch(onFailure);
70 } );
71
72 </script>
73 </body>
74 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698