Revision 65e0628ee53f311f25f50990f4e7b35ba67b06a0 authored by Henrik Skupin on 28 April 2018, 19:36:03 UTC, committed by moz-wptsync-bot on 28 April 2018, 19:48:02 UTC
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1457089 gecko-commit: 9d124f189e612ef45f466456934ccc1b1a4ff824 gecko-integration-branch: central gecko-reviewers: jgraham
1 parent 0027df2
mediasource-play.html
<!DOCTYPE html>
<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
<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)
{
mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
mediaElement.addEventListener('ended', test.step_func_done());
test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer');
test.expectEvent(sourceBuffer, 'update', 'sourceBuffer');
test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
assert_false(sourceBuffer.updating, "sourceBuffer.updating");
sourceBuffer.appendBuffer(mediaData);
assert_true(sourceBuffer.updating, "sourceBuffer.updating");
test.waitForExpectedEvents(function()
{
assert_false(sourceBuffer.updating, "sourceBuffer.updating");
// Truncate the buffered media to about 1 second duration.
sourceBuffer.remove(1, +Infinity);
assert_true(sourceBuffer.updating, "sourceBuffer.updating");
test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer');
test.expectEvent(sourceBuffer, 'update', 'sourceBuffer');
test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
});
test.waitForExpectedEvents(function()
{
assert_false(sourceBuffer.updating, "updating");
assert_greater_than(mediaSource.duration, 1, "duration");
// Complete truncation of duration to 1 second.
mediaSource.duration = 1;
test.expectEvent(mediaElement, "durationchange");
});
test.waitForExpectedEvents(function()
{
mediaSource.endOfStream();
mediaElement.play();
});
}, "Test normal playback case with MediaSource API");
</script>
</body>
</html>
Computing file changes ...