MediaRecorder-peerconnection-no-sink.https.html (1709B)
1 <!doctype html> 2 <html> 3 <meta name="timeout" content="long"> 4 5 <head> 6 <title>MediaRecorder peer connection</title> 7 <link rel="help" 8 href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#dom-mediarecorder-mimeType"> 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 <script src="/resources/testdriver.js"></script> 12 <script src="/resources/testdriver-vendor.js"></script> 13 <script src="../mediacapture-streams/permission-helper.js"></script> 14 <script src="utils/peerconnection.js"></script> 15 </head> 16 17 <body> 18 <script> 19 20 promise_setup(async () => { 21 const t = {add_cleanup: add_completion_callback}; 22 const [, pc, stream] = await startConnection(t, true, true); 23 const [audio] = stream.getAudioTracks(); 24 const [video] = stream.getVideoTracks(); 25 26 for (const kinds of [{ audio }, { video }, { audio, video }]) { 27 const tag = `${JSON.stringify(kinds)}`; 28 const stream = new MediaStream([kinds.audio, kinds.video].filter(n => n)); 29 30 promise_test(async t => { 31 const recorder = new MediaRecorder(stream); 32 recorder.start(200); 33 let combinedSize = 0; 34 // Wait for a small amount of data to appear. Kept small for mobile tests 35 while (combinedSize < 2000) { 36 const event = await Promise.race([ 37 new Promise(r => recorder.ondataavailable = r), 38 new Promise(r => t.step_timeout(r, 5000)) 39 ]); 40 assert_not_equals(event, undefined, 'ondataavailable should have fired'); 41 combinedSize += event.data.size; 42 } 43 recorder.stop(); 44 }, `MediaRecorder records from PeerConnection without sinks, ${tag}`); 45 } 46 }); 47 48 </script> 49 </body> 50 51 </html>