blob: a43c53da55cc6dbe99f634730c68682e880ad57c [file] [log] [blame]
eric.carlson@apple.com9bd9d872010-01-25 06:21:09 +00001<!DOCTYPE HTML>
2
3<html>
4 <head>
5 <title>local video</title>
6
mihaip@chromium.org9d9ccc12011-02-24 23:10:46 +00007 <script src=media-file.js></script>
8 <script src=video-test.js></script>
eric.carlson@apple.com9bd9d872010-01-25 06:21:09 +00009
10 <script>
11
12 var startedPlayback = 0;
13 var duration = 0;
14
15 function canplaythrough()
16 {
17 // Cache the duration, seek to 0.2 seconds
18 duration = video.duration;
19 testExpected("video.duration", 0, '>');
20 testExpected("video.currentTime", 0);
21 run("video.currentTime = 0.3");
22 consoleWrite("");
23 }
24
25 function seeked()
26 {
27 // Play backwards
28 testExpected("video.currentTime.toFixed(1)", 0.3);
29 run("video.play()");
30 run("video.playbackRate = -1");
31 startedPlayback = true;
32 consoleWrite("");
33 }
34
35 function timeupdate()
36 {
37 if (startedPlayback && video.currentTime == 0) {
38 // Make sure the duration is still valid
39 testExpected("video.duration", 0, '>');
40 endTest();
41 }
42 }
43
44 function start()
45 {
46 findMediaElement();
47
48 waitForEvent("error");
49 waitForEvent('canplaythrough', canplaythrough);
50 waitForEvent('seeked', seeked);
51 video.addEventListener("timeupdate", timeupdate);
52
53 video.src = findMediaFile("video", "content/test");
54 consoleWrite("");
55 }
56
57 </script>
58 </head>
59 <body>
60 <video controls autobuffer></video>
61 <p>Tests that duration is not set to zero when playing in reverse to the origin.</p>
62 <script>start()</script>
63 </body>
64</html>
65
66