dom/media/mediasource/test/test_BufferedSeek_mp4.html
author Jean-Yves Avenard <jyavenard@mozilla.com>
Fri, 28 Apr 2017 16:18:36 +0200
changeset 361278 bc1e56d5cb9ba2d563981973573cf3b10fc0abdb
parent 361277 c89c6c8630f132296b2e2edbba4239a8ad7a1075
child 418719 abc9351a9c159afb31d58fc29beda855ad4f832b
permissions -rw-r--r--
Bug 1362165: P3. Remove unecessary code. r=gerald We have no need to call endOfStream here as we don't rely on the ended event being fired. Also, there's no need to track how many update count we will get when we only use appendBuffer once. Adding extra test to help identify where the actual failure of the test could occur. MozReview-Commit-ID: HIu1XQpHark

<!DOCTYPE HTML>
<html>
<head>
  <title>MSE: seeking in buffered range</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, v) {
  ms.addEventListener("sourceopen", function () {
    var sb = ms.addSourceBuffer("video/mp4");

    fetchWithXHR("bipbop/bipbop2s.mp4", function (arrayBuffer) {
      sb.appendBuffer(new Uint8Array(arrayBuffer));
    });

    var target = 1.3;

    v.addEventListener("loadedmetadata", function () {
      ok(true, "received loadedmetadata");
      v.currentTime = target;
    });

    var wasSeeking = false;

    v.addEventListener("seeking", function () {
      wasSeeking = true;
      is(v.currentTime, target, "Video currentTime at target");
    });

    v.addEventListener("seeked", function () {
      ok(wasSeeking, "Received expected seeking and seeked events");
      is(v.currentTime, target, "Video currentTime at target");
      SimpleTest.finish();
    });
  });
});

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