dom/media/mediasource/test/test_ChangeWhileWaitingOnMissingData_mp4.html
author Bryce Van Dyk <bvandyk@mozilla.com>
Mon, 14 May 2018 10:08:59 -0400
changeset 795908 f84d23f114c3767dfeec77438bd5c4b9239ecc2b
parent 499283 22f89dff7a80dbe9eda33d6d8c4e66b80b7d0678
permissions -rw-r--r--
Bug 1461785 - Update dom/media/mediasource/test to abide eslint rules, add .eslintrc.js. r?jya Add .eslintrc.js to configure globals from mediasource.js and to add extra rules to encourage use of let and const over var. Linting changes: - Prefer const and let to var. This provides tighter scoping and avoids reassignment. - Mozilla rules do not allow for shadowing of variables, so several tests have had promise lists renamed to avoid this. - Numerous minor fixes to formatting including using double quotes, spacing, missing semicolons. - Remove some unused variables. - Fix naming of resourcePathSeen in test_MediaSource_memory_reporting.html. MozReview-Commit-ID: 5q6oS7EWLTk

<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
  <title>MSE: resume from waiting even after format change occurred</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="mediasource.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test"><script class="testbody" type="text/javascript">

SimpleTest.waitForExplicitFinish();

runWithMSE(function(ms, el) {
  el.controls = true;
  once(ms, "sourceopen").then(function() {
    ok(true, "Receive a sourceopen event");
    const sb = ms.addSourceBuffer("video/mp4");
    fetchAndLoad(sb, "bipbop/bipbop_480_624kbps-video", ["init"], ".mp4")
    .then(fetchAndLoad.bind(null, sb, "bipbop/bipbop_480_624kbps-video", range(1, 3), ".m4s"))
    .then(function() {
      el.play();
      // let seek to the last audio frame.
      // The seek will complete and then playback will stall.
      el.currentTime = 1.532517;
      return Promise.all([once(el, "seeked"), once(el, "stalled")]);
    })
    .then(function() {
      info("seek completed");
      return fetchAndLoad(sb, "bipbop/bipbop", ["init"], ".mp4");
    })
    .then(fetchAndLoad.bind(null, sb, "bipbop/bipbop", range(1, 4), ".m4s"))
    .then(function() {
      ms.endOfStream();
      return once(el, "ended");
    }).then(function() {
      SimpleTest.finish();
    });
  });
});

</script>
</pre>
</body>
</html>