| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 <!doctype html> | 
|  | 2 <html> | 
|  | 3   <head> | 
|  | 4     <meta charset=utf-8> | 
|  | 5     <title>Encrypted Media Extensions: persistent-license, retrieve and playback
    , DRM</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   </head> | 
|  | 14   <body> | 
|  | 15     <div id='log'></div> | 
|  | 16 | 
|  | 17     <div id='video'> | 
|  | 18       <video id="videoelement" width="200px"></video> | 
|  | 19     </div> | 
|  | 20 | 
|  | 21     <script> | 
|  | 22     // Wait for a message from the main window with details of our task | 
|  | 23     window.addEventListener( 'message', function( event ) { | 
|  | 24 | 
|  | 25         var config = event.data.config, | 
|  | 26             configuration = {   initDataTypes: [ config.initDataType ], | 
|  | 27                                 audioCapabilities: [ { contentType: config.audio
    Type } ], | 
|  | 28                                 videoCapabilities: [ { contentType: config.video
    Type } ], | 
|  | 29                                 sessionTypes: [ 'persistent-license' ] }, | 
|  | 30             assertions = [ ]; | 
|  | 31 | 
|  | 32         var _mediaKeySession; | 
|  | 33         config.video = document.getElementById('videoelement'); | 
|  | 34 | 
|  | 35         function onComplete() { | 
|  | 36             window.opener.postMessage(assertions, '*'); | 
|  | 37         } | 
|  | 38 | 
|  | 39         function onFailure(error) { | 
|  | 40             assertions.push( { actual: false, expected: true, message: error.toS
    tring() } ); | 
|  | 41             onComplete(); | 
|  | 42         } | 
|  | 43 | 
|  | 44         function onTimeupdate(event) { | 
|  | 45             if ( config.video.currentTime > ( config.duration || 1 ) ) { | 
|  | 46                 config.video.pause(); | 
|  | 47                 _mediaKeySession.close() | 
|  | 48             } | 
|  | 49         } | 
|  | 50 | 
|  | 51         navigator.requestMediaKeySystemAccess(config.keysystem, [ configuration 
    ] ) | 
|  | 52         .then(function(access) { | 
|  | 53             return access.createMediaKeys(); | 
|  | 54         }).then(function(mediaKeys) { | 
|  | 55             config.video.setMediaKeys(mediaKeys); | 
|  | 56             config.video.addEventListener('timeupdate', onTimeupdate, true); | 
|  | 57             _mediaKeySession = mediaKeys.createSession( 'persistent-license' ); | 
|  | 58             _mediaKeySession.closed.then(onComplete); | 
|  | 59             return _mediaKeySession.load(event.data.sessionId); | 
|  | 60         }).then(function( success ) { | 
|  | 61             if ( !success ) throw new DOMException( 'Could not load session' ); | 
|  | 62             return testmediasource(config); | 
|  | 63         }).then(function(source) { | 
|  | 64             config.video.src = URL.createObjectURL(source); | 
|  | 65             config.video.play(); | 
|  | 66         }) | 
|  | 67         .catch(onFailure); | 
|  | 68     } ); | 
|  | 69 | 
|  | 70     </script> | 
|  | 71   </body> | 
|  | 72 </html> | 
| OLD | NEW | 
|---|