Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / ManualTests / video-waiting-seeking.html
blob7509cf64e9fe427e0b29081a7278e9a94aeb9c00
1 <html>
2 <head>
3 <script src="../../../LayoutTests/media/video-test.js"></script>
4 <script>
6 var seekedCount = 0;
7 var counter = 0;
9 function trySeek(seekTo)
11 if (isInTimeRanges(video.seekable, seekTo)) {
12 if (isInTimeRanges(video.buffered, seekTo)) {
13 consoleWrite("Warining: Seeking into buffered region. May not generate waiting or seeking events.");
15 run("video.currentTime = " + seekTo);
16 } else {
17 failTest("Cannot seek to " + seekTo + ". Does engine support seeking into unbuffered region?");
21 function seeked()
23 ++seekedCount;
24 consoleWrite("");
27 function scheduleSeek() {
28 setTimeout(someTimeLater, 200);
31 function someTimeLater()
33 consoleWrite("Running scheduled seek");
34 testExpected("seekedCount", counter);
35 testExpected("video.currentTime", counter, ">=");
37 if (counter == 3)
39 consoleWrite("");
40 return;
41 endTest();
44 ++counter;
46 scheduleSeek();
47 trySeek(counter);
48 consoleWrite("");
51 function start()
53 findMediaElement();
55 waitForEvent('waiting');
56 waitForEvent('seeking');
57 waitForEvent('seeked', seeked);
58 waitForEvent('play', someTimeLater);
60 consoleWrite("Start Load");
61 video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=../../../media/content/test.mp4&throttle=25";
62 video.load();
63 video.play();
65 </script>
66 </head>
67 <body onload="start()">
68 <video controls></video>
70 <p>Attempt to seek out of the buffered range. If supported, this
71 should cause a waiting and seeking event to be fired for each seek.
72 This test makes assumptions on the size of the input file, the bitrate
73 of delivery, and the duration of the file.
74 </p>
75 <p>
76 Source is assumed to be about 188k with a uniform bitrate, &gt; 4
77 seconds in length, and served at 25kb/s. This should make seeking one
78 second ahead every 200ms always leave the buffered region.
79 </p>
80 </body>
81 </html>