test_getUserMedia_basicWindowshare.html (1019B)
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({ 10 title: "getUserMedia Basic Windowshare Test", 11 bug: "1038926" 12 }); 13 /** 14 * Run a test to verify that we can complete a start and stop media playback 15 * cycle for an screenshare MediaStream on a video HTMLMediaElement. 16 */ 17 runTest(async function () { 18 const testVideo = createMediaElement('video', 'testVideo'); 19 const constraints = { 20 video: { mediaSource: "window" }, 21 }; 22 23 try { 24 await getUserMedia(constraints); 25 ok(false, "Should require user gesture"); 26 } catch (e) { 27 is(e.name, "InvalidStateError"); 28 } 29 30 SpecialPowers.wrap(document).notifyUserGestureActivation(); 31 const stream = await getUserMedia(constraints); 32 const playback = new MediaStreamPlayback(testVideo, stream); 33 return playback.playMedia(false); 34 }); 35 36 </script> 37 </pre> 38 </body> 39 </html>