1 <!-- Used by media_basic_playback to verify basic playback. -->
5 <title>Basic Media Playback Test</title>
9 <video autoplay preload controls></video>
12 <script type="text/javascript" src="utils.js"></script>
13 <script type="text/javascript">
14 var video = document.querySelector('video');
16 // Used to keep track of events.
19 // List of events to log. Events in this list are those which are expected
20 // plus those which are unexpected and will have a negative impact on
23 'abort', 'emptied', 'error', 'playing', 'stalled', 'suspend', 'waiting'];
25 function logEvent(evt) {
26 events.push(evt.type);
29 for(var i = 0; i < eventsToLog.length; i++)
30 video.addEventListener(eventsToLog[i], logEvent, false);
32 video.addEventListener('ended', function(event) {
33 firstEndedEvent = events.indexOf('ended') < 0;
36 // At the end of the first playback, seek near end and replay. 0.8 was
37 // chosen arbitrarily.
38 if (firstEndedEvent) {
39 video.currentTime = 0.8 * video.duration;
41 // Notify PyAuto that we've completed testing. Send test of currentTime
42 // at the same time for efficiency.
43 window.domAutomationController.send(
44 video.currentTime == video.duration);
48 video.addEventListener('seeked', function(event) {
53 function startTest(media) {