test_SplitAppend_mp4.html (1157B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>MSE: append initialization and media segment separately</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <script type="text/javascript" src="mediasource.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 8 </head> 9 <body> 10 <pre id="test"> 11 <script class="testbody" type="text/javascript"> 12 13 SimpleTest.waitForExplicitFinish(); 14 15 runWithMSE(async (ms, v) => { 16 await once(ms, "sourceopen"); 17 const sb = ms.addSourceBuffer("video/mp4"); 18 19 const arrayBuffer = await fetchWithXHR("bipbop/bipbop2s.mp4"); 20 sb.appendBuffer(new Uint8Array(arrayBuffer, 0, 1395)); 21 v.play(); 22 await once(sb, "updateend"); 23 sb.appendBuffer(new Uint8Array(arrayBuffer, 1395)); 24 await once(sb, "updateend"); 25 ms.endOfStream(); 26 27 await once(v, "ended"); 28 // The bipbop video doesn't start at 0. The old MSE code adjust the 29 // timestamps and ignore the audio track. The new one doesn't. 30 isfuzzy(v.duration, 1.696, 0.166, "Video has correct duration"); 31 isfuzzy(v.currentTime, 1.696, 0.166, "Video has played to end"); 32 SimpleTest.finish(); 33 }); 34 35 </script> 36 </pre> 37 </body> 38 </html>