~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to ManualTests/video-waiting-seeking.html

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
    <head>
 
3
        <script src="../../../LayoutTests/media/video-test.js"></script>
 
4
        <script>
 
5
 
 
6
            var seekedCount = 0;
 
7
            var counter = 0;
 
8
 
 
9
            function trySeek(seekTo)
 
10
            {
 
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.");
 
14
                    }
 
15
                    run("video.currentTime = " + seekTo);
 
16
                } else {
 
17
                    failTest("Cannot seek to " + seekTo + ". Does engine support seeking into unbuffered region?");
 
18
                }
 
19
            }
 
20
 
 
21
            function seeked()
 
22
            { 
 
23
                ++seekedCount; 
 
24
                consoleWrite("");
 
25
            }
 
26
 
 
27
            function scheduleSeek() {
 
28
                setTimeout(someTimeLater, 200);
 
29
            }
 
30
 
 
31
            function someTimeLater()
 
32
            {
 
33
                consoleWrite("Running scheduled seek");
 
34
                testExpected("seekedCount", counter);
 
35
                testExpected("video.currentTime", counter, ">=");
 
36
 
 
37
                if (counter == 3)
 
38
                {
 
39
                    consoleWrite("");
 
40
                    return;
 
41
                    endTest();
 
42
                }
 
43
 
 
44
                ++counter;
 
45
 
 
46
                scheduleSeek();
 
47
                trySeek(counter);
 
48
                consoleWrite("");
 
49
            }
 
50
 
 
51
            function start()
 
52
            {
 
53
                findMediaElement();
 
54
 
 
55
                waitForEvent('waiting');
 
56
                waitForEvent('seeking');
 
57
                waitForEvent('seeked', seeked);
 
58
                waitForEvent('play', someTimeLater);
 
59
 
 
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();
 
64
            }
 
65
        </script>
 
66
    </head>
 
67
    <body onload="start()">
 
68
        <video controls></video>
 
69
 
 
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>