OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Test behavior when seeking to the duration and the playback rate
equals 0.</title> |
| 5 <script src="media-file.js"></script> |
| 6 <script src="video-test.js"></script> |
| 7 |
| 8 <script> |
| 9 function onLoad() |
| 10 { |
| 11 findMediaElement(); |
| 12 video.src = findMediaFile("video", "content/test"); |
| 13 video.load(); |
| 14 waitForEvent("seeking"); |
| 15 |
| 16 waitForEventOnce("loadedmetadata", function() |
| 17 { |
| 18 consoleWrite("Seeking to duration"); |
| 19 video.currentTime = video.duration; |
| 20 video.playbackRate = 0; |
| 21 waitForEventOnce("seeked"); |
| 22 waitForEventOnce("ended", firstEnded); |
| 23 }); |
| 24 |
| 25 function firstEnded() |
| 26 { |
| 27 testExpected("video.currentTime == video.duration", true); |
| 28 consoleWrite("Seeking to the middle of the video"); |
| 29 video.currentTime = video.duration / 2; |
| 30 waitForEventOnce("seeked", seekToMiddleDone); |
| 31 } |
| 32 |
| 33 function seekToMiddleDone() |
| 34 { |
| 35 consoleWrite("Setting loop to true and seeking to duration."); |
| 36 video.loop = true; |
| 37 video.currentTime = video.duration; |
| 38 waitForEventOnce("seeked", seekToDurationComplete); |
| 39 } |
| 40 |
| 41 function seekToDurationComplete() |
| 42 { |
| 43 consoleWrite("Seek to duration completed. Waiting for a seek t
o the beginning."); |
| 44 waitForEventOnce("seeked", seekToBeginningComplete); |
| 45 } |
| 46 |
| 47 function seekToBeginningComplete() |
| 48 { |
| 49 testExpected("video.currentTime", 0); |
| 50 endTest(); |
| 51 } |
| 52 } |
| 53 </script> |
| 54 </head> |
| 55 <body onload="onLoad()"> |
| 56 <video id="v" preload="metadata"></video> |
| 57 </body> |
| 58 </html> |
OLD | NEW |