| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>test playbackRate and defaultPlaybackRate</title> |
| <script src=media-file.js></script> |
| <script src=video-test.js></script> |
| <script> |
| var wallClockAtFirstTimeUpdate; |
| var mediaTimeAtFirstTimeUpdate; |
| var effectivePlaybackRate; |
| |
| function start() |
| { |
| findMediaElement(); |
| waitForEvent('canplaythrough', canplaythrough); |
| run('video.defaultPlaybackRate = 0.5'); |
| setSrcByTagName('video', findMediaFile('video', 'content/test')); |
| } |
| |
| function canplaythrough() |
| { |
| testExpected('video.playbackRate', 0.5); |
| testExpected('video.defaultPlaybackRate', 0.5); |
| |
| waitForEvent('timeupdate', timeupdate); |
| video.play(); |
| } |
| |
| function timeupdate() |
| { |
| var now = Date.now() / 1000; |
| if (!wallClockAtFirstTimeUpdate) { |
| wallClockAtFirstTimeUpdate = now; |
| mediaTimeAtFirstTimeUpdate = video.currentTime; |
| return; |
| } |
| |
| if (wallClockAtFirstTimeUpdate == now) |
| return; |
| |
| var wallClockDelta = wallClockAtFirstTimeUpdate - now; |
| var mediaTimeDelta = mediaTimeAtFirstTimeUpdate - video.currentTime; |
| effectivePlaybackRate = mediaTimeDelta / wallClockDelta; |
| |
| testExpected('effectivePlaybackRate', .75, '<'); |
| endTest(); |
| } |
| |
| </script> |
| </head> |
| |
| <body onload="start()"> |
| <video controls></video> |
| </body> |
| </html> |