audio-setSinkId.https.html (1161B)
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 <audio controls id="beat" src="./bear-av1-opus.mp4" loop></audio> 7 <script> 8 9 // The main test page (restriction-audio-setSinkId.https.html) loads the 10 // initiator page, then the initiator page will prerender itself with the 11 // `prerendering` parameter. 12 const params = new URLSearchParams(location.search); 13 const isPrerendering = params.has('prerendering'); 14 15 if (!isPrerendering) { 16 const rule_extras = {'target_hint': getTargetHint()}; 17 loadInitiatorPage(rule_extras); 18 } else { 19 const prerenderEventCollector = new PrerenderEventCollector(); 20 21 const promise = beat.setSinkId( 22 params.get('sinkId') === 'invalid' ? 'fakeId' : ''); 23 // The spec, https://wicg.github.io/nav-speculation/prerendering.html#audio-output-patch, 24 // mentions selectAudioOutput() but this test uses setSinkId() function. 25 prerenderEventCollector.start(promise, 'Audio.setSinkId'); 26 } 27 </script>