OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Test effective playback rate with a MediaController.</title> | 4 <title>Test effective playback rate with a MediaController.</title> |
5 <script src="media-file.js"></script> | 5 <script src="media-file.js"></script> |
6 <script src="video-test.js"></script> | 6 <script src="video-test.js"></script> |
7 <script> | 7 <script> |
8 var start = function() | 8 var start = function() |
9 { | 9 { |
10 findMediaElement(); | 10 findMediaElement(); |
11 video.src = findMediaFile("video", "content/test"); | 11 video.src = findMediaFile("video", "content/test"); |
12 | 12 |
13 // Set the rate on the media element so playback won't move forw
ard. | 13 // Set the rate on the media element so playback won't move forw
ard. |
14 video.playbackRate = 0; | 14 video.playbackRate = 0; |
15 | 15 |
16 waitForEvent("canplay",canplay); | 16 waitForEventOnce("canplay",canplay); |
17 }; | 17 }; |
18 | 18 |
19 var canplay = function() | 19 var canplay = function() |
20 { | 20 { |
21 video.controller = new MediaController(); | 21 video.controller = new MediaController(); |
22 | 22 |
23 // Verify the controller playback rate is 1. This | 23 // Verify the controller playback rate is 1. This |
24 // means the "effective playback rate" is 1 even though | 24 // means the "effective playback rate" is 1 even though |
25 // the HTMLMediaElement's playbackRate attribute is 0. | 25 // the HTMLMediaElement's playbackRate attribute is 0. |
26 testExpected("video.controller.playbackRate", 1); | 26 testExpected("video.controller.playbackRate", 1); |
27 testExpected("video.playbackRate", 0); | 27 testExpected("video.playbackRate", 0); |
28 | 28 |
29 // Wait for the seek initiated by the "bringing up to speed" | 29 // Wait for the seek initiated by the "bringing up to speed" |
30 // step to complete. | 30 // step to complete. |
31 waitForEventOnce('seeked', seeked); | 31 waitForEventOnce('seeked', seeked); |
32 }; | 32 }; |
33 | 33 |
34 var seeked = function() | 34 var seeked = function() |
35 { | 35 { |
36 // Initiate playback and verify that time moves forward. | 36 // Initiate playback and verify that time moves forward. |
37 run("video.play()"); | 37 run("video.play()"); |
38 waitForEventOnce("play", play); | 38 waitForEventOnce("playing", playing); |
39 }; | 39 }; |
40 | 40 |
41 var play = function() | 41 var playing = function() |
42 { | 42 { |
43 waitForEventOnce("timeupdate", timeupdate); | 43 waitForEventOnce("timeupdate", timeupdate); |
44 }; | 44 }; |
45 | 45 |
46 var timeupdate = function() { | 46 var timeupdate = function() |
| 47 { |
47 testExpected("video.currentTime", 0, "!="); | 48 testExpected("video.currentTime", 0, "!="); |
48 endTest(); | 49 endTest(); |
49 }; | 50 }; |
50 </script> | 51 </script> |
51 </head> | 52 </head> |
52 <body onload="start()"> | 53 <body onload="start()"> |
53 <video></video> | 54 <video></video> |
54 </body> | 55 </body> |
55 </html> | 56 </html> |
OLD | NEW |