tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_AppendPartialInitSegment.html (1217B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>MSE: split init segment and append them 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/webm");
     18 
     19  const arrayBuffer = await fetchWithXHR("seek.webm");
     20  // init segment is total 236 bytes.
     21  info("- append partial init segment -");
     22  sb.appendBuffer(new Uint8Array(arrayBuffer, 0, 100));
     23 
     24  info("- wait for updateend -");
     25  await once(sb, "updateend");
     26 
     27  info("- append remaining init segment -");
     28  sb.appendBuffer(new Uint8Array(arrayBuffer, 100, 136));
     29 
     30  info("- wait for metadata -");
     31  await once(v, "loadedmetadata");
     32  is(v.videoWidth, 320, "videoWidth has correct initial value");
     33  is(v.videoHeight, 240, "videoHeight has correct initial value");
     34 
     35  info("- wait for updateend -");
     36  await once(sb, "updateend");
     37  SimpleTest.finish();
     38 });
     39 
     40 </script>
     41 </pre>
     42 </body>
     43 </html>