4 <title>test playbackRate and defaultPlaybackRate
</title>
5 <script src=media-file.js
></script>
6 <script src=video-test.js
></script>
8 var rateChangeCount
= 0;
12 consoleWrite("*** checking rates after event");
13 switch (++rateChangeCount
)
16 testExpected("video.playbackRate", 1);
17 testExpected("video.defaultPlaybackRate", 2);
19 consoleWrite("<br>*** setting playbackRate");
20 run("video.playbackRate = 2");
21 testExpected("video.playbackRate", 2);
22 testExpected("video.defaultPlaybackRate", 2);
26 testExpected("video.playbackRate", 2);
27 testExpected("video.defaultPlaybackRate", 2);
29 consoleWrite("<br>*** beginning playback");
30 video
.currentTime
= video
.duration
- 0.2;
31 run("video.playbackRate = 1");
32 testExpected("video.playbackRate", 1);
33 testExpected("video.defaultPlaybackRate", 2);
38 testExpected("video.playbackRate", 1);
39 testExpected("video.defaultPlaybackRate", 2);
47 function canplaythrough()
49 consoleWrite("<br>*** checking defaults");
50 testExpected("video.playbackRate", 1);
51 testExpected("video.defaultPlaybackRate", 1);
53 consoleWrite("<br>*** setting defaultPlaybackRate");
54 run("video.defaultPlaybackRate = 2");
55 testExpected("video.playbackRate", 1);
56 testExpected("video.defaultPlaybackRate", 2);
62 testExpected("video.playbackRate", 1);
63 testExpected("video.defaultPlaybackRate", 2);
66 consoleWrite("Test extreme playback rates");
67 run("video.defaultPlaybackRate = Number.MIN_VALUE");
68 testExpected("video.defaultPlaybackRate", Number
.MIN_VALUE
);
71 run("video.defaultPlaybackRate = Number.MAX_VALUE");
72 testExpected("video.defaultPlaybackRate", Number
.MAX_VALUE
);
75 run("video.playbackRate = Number.MIN_VALUE");
76 testExpected("video.playbackRate", Number
.MIN_VALUE
);
79 run("video.playbackRate = Number.MAX_VALUE");
80 testExpected("video.playbackRate", Number
.MAX_VALUE
);
83 consoleWrite("Test non-finite playback rates");
84 testException("video.defaultPlaybackRate = -Infinity", '"TypeError: Failed to set the \'defaultPlaybackRate\' property on \'HTMLMediaElement\': The provided double value is non-finite."');
85 testException("video.defaultPlaybackRate = Infinity", '"TypeError: Failed to set the \'defaultPlaybackRate\' property on \'HTMLMediaElement\': The provided double value is non-finite."');
86 testException("video.defaultPlaybackRate = NaN", '"TypeError: Failed to set the \'defaultPlaybackRate\' property on \'HTMLMediaElement\': The provided double value is non-finite."');
89 testException("video.playbackRate = -Infinity", '"TypeError: Failed to set the \'playbackRate\' property on \'HTMLMediaElement\': The provided double value is non-finite."');
90 testException("video.playbackRate = Infinity", '"TypeError: Failed to set the \'playbackRate\' property on \'HTMLMediaElement\': The provided double value is non-finite."');
91 testException("video.playbackRate = NaN", '"TypeError: Failed to set the \'playbackRate\' property on \'HTMLMediaElement\': The provided double value is non-finite."');
100 waitForEventOnce('canplaythrough', canplaythrough
);
101 waitForEvent('ended', ended
);
102 waitForEvent('ratechange', ratechange
);
104 consoleWrite("*** setting src");
105 setSrcByTagName("video", findMediaFile("video", "content/test"));
111 <body onload=
"start()">
113 <video controls
> </video>
115 <li>'playbackRate' should not change when play() is called.
</li>
116 <li>'playbackRate' and 'defaultPlaybackRate' should always return the last value set.
</li>