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/> | |
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 video.addEventListener('ended', function(event) { | |
20 // At the end of the first playback, seek near end and replay. | |
21 if (events.indexOf('ended') < 0) { | |
22 video.currentTime = 0.8 * video.duration; | |
23 video.play(); | |
24 logEvent(event); | |
Ami GONE FROM CHROMIUM
2012/01/25 17:58:48
Log the event *first*, which both removes doubts a
DaleCurtis
2012/01/25 23:59:25
Done.
| |
25 } else { | |
26 logEvent(event); | |
27 | |
28 // PyAuto has trouble with arrays, so convert to string. | |
29 events = events.join(','); | |
shadi
2012/01/25 19:30:04
How would PyAuto read "events" if some error occur
DaleCurtis
2012/01/25 23:59:25
It will time out and fail.
| |
30 | |
31 // Notify PyAuto that we've completed testing. Send test of currenTime | |
Ami GONE FROM CHROMIUM
2012/01/25 17:58:48
s/nT/ntT/
DaleCurtis
2012/01/25 23:59:25
Done.
| |
32 // at the same time for efficiency. | |
33 window.domAutomationController.send( | |
34 video.currentTime == video.duration); | |
Ami GONE FROM CHROMIUM
2012/01/25 17:58:48
What happens if this fails?
DaleCurtis
2012/01/25 23:59:25
You mean the equality statement? The PyAuto portio
| |
35 } | |
36 }, false); | |
37 | |
38 video.addEventListener('playing', logEvent, false); | |
39 video.addEventListener('error', logEvent, false); | |
40 video.addEventListener('abort', logEvent, false); | |
41 video.addEventListener('seeked', logEvent, false); | |
42 | |
43 function logEvent(evt) { | |
Ami GONE FROM CHROMIUM
2012/01/25 17:58:48
Move this above the text that uses it.
DaleCurtis
2012/01/25 23:59:25
Done.
| |
44 events.push(evt.type) | |
45 } | |
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 |