test_hls_player_independency.html (1473B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test playback of 2 HLS video at the same page </title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 7 <script type="text/javascript" src="manifest.js"></script> 8 </head> 9 <body> 10 <div id='player1'> 11 <video id='player4x3' controls autoplay> 12 </video> 13 </div> 14 <p> 4x3 basic stream<span> 15 <span> 16 <div height = 10> 17 <span> 18 <div id='player2'> 19 <video id='player16x9' controls autoplay> 20 </video> 21 </div> 22 <p> 16x9 basic stream<span> 23 24 <script class="testbody" type="text/javascript"> 25 26 add_task(async () => { 27 await SpecialPowers.pushPrefEnv({ set: [["media.hls.enabled", true]] }); 28 29 var v4x3 = document.getElementById('player4x3'); 30 var v16x9 = document.getElementById('player16x9'); 31 32 var p1 = once(v4x3, 'ended', function onended() { 33 is(v4x3.videoWidth, 400, "4x3 content, the width should be 400."); 34 is(v4x3.videoHeight, 300, "4x3 content, the height should be 300."); 35 }); 36 37 var p2 = once(v16x9, 'ended', function onended() { 38 is(v16x9.videoWidth, 416, "16x9 content, the width should be 416."); 39 is(v16x9.videoHeight, 234, "16x9 content, the height should be 234."); 40 }); 41 42 v4x3.src = serverUrl + "/bipbop_4x3_single.m3u8"; 43 v16x9.src = serverUrl + "/bipbop_16x9_single.m3u8"; 44 await Promise.all([p1, p2]); 45 ok(true, `HLS played`); 46 }); 47 48 </script> 49 </pre> 50 </body> 51 </html>