2009-11-27 Daniel Bates <dbates@webkit.org>
[webkit:qtwebkit.git] / LayoutTests / http / tests / media / video-play-stall-seek.html
1 <video controls></video>
2 <p>Test that playback can be resumed by seeking backwards after load stalls.</p>
3 <script src=../../../media/video-test.js></script>
4 <script>
5
6     var waitingCount = 0;
7
8     video.addEventListener('waiting', function () {
9
10         // Skip the first 'waiting' event because it is fired when we call play() 
11         // and there isn't enough media to begin playback immediately.
12         if (++waitingCount == 1)
13             return;
14
15         consoleWrite("EVENT(waiting)");
16
17         // now that playback has paused to wait for data, seek back and verify that we
18         // get a 'canplay' event
19         waitForEvent('canplay' , function () {
20             testExpected("video.readyState", HTMLMediaElement.HAVE_CURRENT_DATA, ">=");
21             testExpected("video.networkState", HTMLMediaElement.NETWORK_LOADING);
22             endTest();
23         } );
24         testExpected("video.readyState", HTMLMediaElement.HAVE_CURRENT_DATA);
25         
26         run("video.currentTime = 0.1");
27     } );
28
29     video.src = "http://127.0.0.1:8000/media/video-load-and-stall.cgi?name=../../../media/content/test.mp4&stallAt=100000";
30     run("video.play()");
31 </script>