test_getUserMedia_gumWithinGum.html (1293B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script type="application/javascript" src="mediaStreamPlayback.js"></script> 5 </head> 6 <body> 7 <pre id="test"> 8 <script type="application/javascript"> 9 createHTML({title: "getUserMedia within getUserMedia", bug: "822109" }); 10 /** 11 * Run a test that we can complete a playback cycle for a video, 12 * then upon completion, do a playback cycle with audio, such that 13 * the audio gum call happens within the video gum call. 14 */ 15 runTest(function () { 16 return getUserMedia({video: true}) 17 .then(videoStream => { 18 var testVideo = createMediaElement('video', 'testVideo'); 19 var videoPlayback = new MediaStreamPlayback(testVideo, 20 videoStream); 21 22 return videoPlayback.playMediaWithoutStoppingTracks(false) 23 .then(() => getUserMedia({audio: true})) 24 .then(audioStream => { 25 var testAudio = createMediaElement('audio', 'testAudio'); 26 var audioPlayback = new MediaStreamPlayback(testAudio, 27 audioStream); 28 29 return audioPlayback.playMedia(false); 30 }) 31 .then(() => videoStream.getTracks().forEach(t => t.stop())); 32 }); 33 }); 34 35 </script> 36 </pre> 37 </body> 38 </html>