tor-browser

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

mediasource-replay.html (1513B)


      1 <!DOCTYPE html>
      2 <!-- Copyright © 2019 Igalia S.L -->
      3 <html>
      4 <head>
      5    <title>MediaSource replay test case.</title>
      6    <meta name="timeout" content="long">
      7    <meta charset="utf-8">
      8    <link rel="author" title="Alicia Boya García" href="mailto:aboya@igalia.com">
      9    <script src="/resources/testharness.js"></script>
     10    <script src="/resources/testharnessreport.js"></script>
     11    <script src="mediasource-util.js"></script>
     12 </head>
     13 <body>
     14 <div id="log"></div>
     15 <script>
     16    mediasource_testafterdataloaded(function (test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) {
     17        mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
     18 
     19        test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
     20 
     21        sourceBuffer.appendBuffer(mediaData);
     22 
     23        test.waitForExpectedEvents(function () {
     24            mediaSource.endOfStream();
     25 
     26            // Start playing near the end.
     27            mediaElement.currentTime = 6.2;
     28            mediaElement.play();
     29            test.expectEvent(mediaElement, 'ended', 'mediaElement');
     30        });
     31 
     32        test.waitForExpectedEvents(function () {
     33            mediaElement.play();
     34            assert_equals(mediaElement.currentTime, 0, "currentTime");
     35            // If currentTime is able to advance, the player did not get stuck and it's a pass.
     36            test.waitForCurrentTimeChange(mediaElement, test.step_func_done());
     37        });
     38    }, "Test replaying video after 'ended'");
     39 </script>
     40 </body>
     41 </html>