encrypted-media.https.html (1308B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/speculation-rules/prerender/resources/utils.js"></script> 5 <script src="/speculation-rules/prerender/resources/deferred-promise-utils.js"></script> 6 <script> 7 const params = new URLSearchParams(location.search); 8 9 // The main test page (restriction-encrypted-media*.https.html) loads the 10 // initiator page, then the initiator page will prerender itself with the 11 // `prerendering` parameter. 12 const isPrerendering = params.has('prerendering'); 13 14 if (!isPrerendering) { 15 loadInitiatorPage(); 16 } else { 17 const prerenderEventCollector = new PrerenderEventCollector(); 18 19 const config = [{ 20 initDataTypes: ['keyids', 'webm' ,'cenc'], 21 audioCapabilities: [ 22 {contentType: 'audio/mp4; codecs="mp4a.40.2"'}, 23 {contentType: 'audio/webm; codecs="opus"'} 24 ] 25 }]; 26 27 const fakeConfig = [{ 28 initDataTypes: ['fakeidt'], 29 audioCapabilities: [{contentType: 'audio/fake; codecs="mp4a.40.2"'}] 30 }]; 31 32 const promise = 33 navigator.requestMediaKeySystemAccess('org.w3.clearkey', 34 params.get('config') === 'support' ? config : fakeConfig); 35 prerenderEventCollector.start( 36 promise, 'navigator.requestMediaKeySystemAccess'); 37 } 38 39 </script>