OLD | NEW |
(Empty) | |
| 1 <!-- Used by media_basic_playback to verify basic playback. --> |
| 2 <!DOCTYPE html> |
| 3 <html lang="en-US"> |
| 4 <head> |
| 5 <title>Basic Media Playback Test</title> |
| 6 </head> |
| 7 |
| 8 <body> |
| 9 <video autoplay preload controls></video> |
| 10 </body> |
| 11 |
| 12 <script type="text/javascript" src="utils.js"></script> |
| 13 <script type="text/javascript"> |
| 14 var video = document.querySelector('video'); |
| 15 |
| 16 // Used to keep track of events. |
| 17 var events = []; |
| 18 |
| 19 function logEvent(evt) { |
| 20 events.push(evt.type); |
| 21 } |
| 22 |
| 23 video.addEventListener('ended', function(event) { |
| 24 firstEndedEvent = events.indexOf('ended') < 0; |
| 25 logEvent(event); |
| 26 |
| 27 // At the end of the first playback, seek near end and replay. |
| 28 if (firstEndedEvent) { |
| 29 video.currentTime = 0.8 * video.duration; |
| 30 video.play(); |
| 31 } else { |
| 32 // PyAuto has trouble with arrays, so convert to string. |
| 33 events = events.join(','); |
| 34 |
| 35 // Notify PyAuto that we've completed testing. Send test of currentTime |
| 36 // at the same time for efficiency. |
| 37 window.domAutomationController.send( |
| 38 video.currentTime == video.duration); |
| 39 } |
| 40 }, false); |
| 41 |
| 42 video.addEventListener('playing', logEvent, false); |
| 43 video.addEventListener('error', logEvent, false); |
| 44 video.addEventListener('abort', logEvent, false); |
| 45 video.addEventListener('seeked', logEvent, false); |
| 46 |
| 47 // Retrieve video file name from URL query parameters. See utils.js. |
| 48 video.src = '../' + QueryString.media; |
| 49 video.play(); |
| 50 </script> |
| 51 </html> |
OLD | NEW |