blob: fb7cd7f3066b6f7dee4dac712939ac418e6df807 [file] [log] [blame]
<video></video>
<p>Test that stalled, timeupdate and waiting events are sent when media load stalls in the middle.</p>
<script src=../../media-resources/media-file.js></script>
<script src=../../media-resources/video-test.js></script>
<script>
var timeupdateCount = 0;
var waitingCount = 0;
waitForEvent('durationchange');
waitForEvent('loadedmetadata');
waitForEvent('loadeddata');
waitForEvent('canplaythrough');
waitForEvent('canplay', function () {
mediaElement.addEventListener('timeupdate', function () {
// timeupdate events are fired as playback progresses so only verify that at least one
// event is fired
++timeupdateCount;
if (timeupdateCount == 1)
consoleWrite("EVENT(timeupdate)");
} );
waitForEvent('waiting', function () {
++waitingCount;
if (waitingCount > 1)
failTest("too many 'waiting' events fired.");
waitForEvent('timeupdate');
} );
waitForEventAndEnd('stalled');
} );
// Find a supported media file.
var mediaFile = findMediaFile("video", "content/test");
var mimeType = mimeTypeForFile(mediaFile);
video.src = "http://127.0.0.1:8000/resources/load-and-stall.cgi?name=../../../media/" + mediaFile + "&mimeType=" + mimeType + "&stallAt=100000&stallFor=6";
run("video.play()");
</script>