tor-browser

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

test_DrainOnMissingData_mp4.html (1802B)


      1 <!DOCTYPE html>
      2 <html><head>
      3 <meta http-equiv="content-type" content="text/html; charset=windows-1252">
      4  <title>MSE: |waiting| event when source data is missing</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"><script class="testbody" type="text/javascript">
     11 
     12 SimpleTest.waitForExplicitFinish();
     13 
     14 runWithMSE(async (ms, el) => {
     15  el.controls = true;
     16  await once(ms, "sourceopen");
     17  ok(true, "Receive a sourceopen event");
     18  const videosb = ms.addSourceBuffer("video/mp4");
     19  await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
     20  // Set appendWindowEnd to ensure we only have about 6 frames worth.
     21  // We must feed at least 6 frames to pass the MDSM pre-roll.
     22  videosb.appendWindowEnd = .4;
     23  await fetchAndLoad(videosb, "bipbop/bipbop_video", ["1"], ".m4s");
     24  info("Invoking play()");
     25  const p = once(el, "playing");
     26  await el.play();
     27  await p;
     28  info("got playing");
     29  await once(el, "waiting");
     30  info("got waiting");
     31  info("Loading more data");
     32  // Waiting will be fired on the last frame +- 40ms.
     33  isfuzzy(el.currentTime, videosb.buffered.end(0) - 1 / 30,
     34          0.04, `Got a waiting event at ${el.currentTime}`);
     35  videosb.appendWindowEnd = 1;
     36  await fetchAndLoad(videosb, "bipbop/bipbop_video", [1], ".m4s");
     37  ms.endOfStream();
     38  await once(el, "ended");
     39  // These fuzz factors are bigger than they should be. We should investigate
     40  // and fix them in bug 1137574.
     41  is(el.duration, 0.801666, "Video has correct duration: " + el.duration);
     42  is(el.currentTime, el.duration, "Video has correct currentTime.");
     43  SimpleTest.finish();
     44 });
     45 
     46 </script>
     47 </pre>
     48 </body>
     49 </html>