https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 34b90dfea76b0d36ae3b4bb7cf7fe7a3824bd8b9 authored by Ms2ger on 15 January 2015, 09:47:51 UTC
Follow current guidelines for manual tests.
Tip revision: 34b90df
mediasource-play.html
<!DOCTYPE html>
<html>
    <head>
        <title>Simple MediaSource playback test case.</title>
        <script src="/resources/testharness.js"></script>
        <script src="/resources/testharnessreport.js"></script>
        <script src="mediasource-util.js"></script>
    </head>
    <body>
        <div id="log"></div>
        <script>
          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
          {
              test.failOnEvent(mediaElement, 'error');
              test.endOnEvent(mediaElement, 'ended');

              test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer');
              test.expectEvent(sourceBuffer, 'update', 'sourceBuffer');
              test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');

              sourceBuffer.appendBuffer(mediaData);

              test.waitForExpectedEvents(function()
              {
                  assert_false(sourceBuffer.updating, "updating");
                  assert_greater_than(mediaSource.duration, 1, "duration");

                  mediaSource.duration = 1;

                  assert_true(sourceBuffer.updating, "updating");
                  test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer');
                  test.expectEvent(sourceBuffer, 'update', 'sourceBuffer');
                  test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
              });

              test.waitForExpectedEvents(function()
              {
                  mediaSource.endOfStream();
                  mediaElement.play();
              });
          }, "Test normal playback case with MediaSource API", {timeout: 5000});
        </script>
    </body>
</html>
back to top