4 <script src=
"/w3c/resources/testharness.js"></script>
5 <script src=
"/w3c/resources/testharnessreport.js"></script>
6 <script src=
"mediasource-util.js"></script>
7 <link rel=
"stylesheet" href=
"/w3c/resources/testharness.css">
13 mediasource_testafterdataloaded(function(test
, mediaElement
, mediaSource
, segmentInfo
, sourceBuffer
, mediaData
)
17 // Append all the segments
18 test
.expectEvent(sourceBuffer
, 'updateend', 'sourceBuffer');
19 test
.expectEvent(mediaElement
, 'playing', 'Playing triggered');
20 sourceBuffer
.appendBuffer(mediaData
);
22 function confirmPlayThenEnd()
24 test
.waitForCurrentTimeChange(mediaElement
, function ()
26 assert_false(mediaElement
.seeking
, 'mediaElement is no longer seeking');
27 test
.waitForCurrentTimeChange(mediaElement
, function() { test
.done(); });
31 function delayedPlayHandler()
33 assert_greater_than(mediaElement
.currentTime
, 0.0, 'Playback has started.');
34 test
.expectEvent(mediaElement
, 'seeking', 'mediaElement');
35 test
.expectEvent(mediaElement
, 'seeked', 'mediaElement finished seek');
36 mediaElement
.currentTime
= 0.0;
37 assert_true(mediaElement
.seeking
, 'mediaElement is seeking');
38 assert_equals(mediaElement
.currentTime
, 0.0, 'Current time is 0.0');
40 test
.waitForExpectedEvents(confirmPlayThenEnd
);
43 test
.waitForExpectedEvents(function()
45 test
.waitForCurrentTimeChange(mediaElement
, delayedPlayHandler
);
48 }, 'Test playing then seeking back.');