4 <!-- LayoutTests location is hard-coded to avoid duplication of code. -->
5 <script src=
"http://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/media-file.js"></script>
6 <script src=
"http://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/video-test.js"></script>
9 var expectedRates
= { "defaultPlaybackRate" : 1, "playbackRate" : 1};
10 var playingFromScript
= false;
11 var changedRate
= false;
13 function absoluteUrl(url
)
15 var a
= document
.createElement('a');
23 var playWithControllerButton
= !changedRate
&& !playingFromScript
;
24 testExpected("video.playbackRate", playWithControllerButton
? expectedRates
['defaultPlaybackRate'] : expectedRates
['playbackRate']);
25 testExpected("video.defaultPlaybackRate", expectedRates
['defaultPlaybackRate']);
31 consoleWrite("<br>'playing' event");
32 expectedRates
['playbackRate'] = playingFromScript
? video
.playbackRate
: video
.defaultPlaybackRate
;
34 playingFromScript
= false;
39 consoleWrite("<br>'ratechange' event");
46 video
.addEventListener('ratechange', ratechange
);
47 video
.addEventListener('playing', playing
);
49 // Use the video file from the svn repository to avoid duplicating the file.
50 video
.src
= absoluteUrl(findMediaFile('video', 'http://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/content/test'));
56 playingFromScript
= true;
60 function setRate(which
, rate
)
64 expectedRates
[which
] = rate
;
70 <body onload=
"start()">
72 <video controls
> </video>
74 <li>The current 'playbackRate' and 'defaultPlaybackRate' should be logged every time either changes.
</li>
75 <li>'playbackRate' should be set to 'defaultPlaybackRate' when the Play button in the built-in controls is pressed
</li>
76 <li>'playbackRate' should NOT when play() is called from script.
</li>
79 <button id=
"controls" onclick=
"setRate('defaultPlaybackRate', 2)">defaultPlaybackRate =
2</button>
80 <button id=
"controls" onclick=
"setRate('defaultPlaybackRate', 1)">defaultPlaybackRate =
1</button>
81 <button id=
"controls" onclick=
"setRate('playbackRate', 2)">playbackRate =
2</button>
82 <button id=
"controls" onclick=
"setRate('playbackRate', 1)">playbackRate =
1</button>
85 <button id=
"controls" onclick=
"play()">play()
</button>
86 <button id=
"controls" onclick=
"video.pause()">pause()
</button>