gizmo.mp4.seek.html (1255B)
1 <!DOCTYPE HTML> 2 <html class="reftest-wait"> 3 <!--This testing should match the 55th frame of gizmo.mp4. The 4 55th frame's time is 1.8s, so seek to a time which is a little 5 greater than 1.8s, the display frame should be the 55th frame. 6 --> 7 <head> 8 <script type="text/javascript"> 9 function doTest() { 10 var video = document.getElementById("v1"); 11 video.src = "../gizmo.mp4"; 12 video.preload = "metadata"; 13 14 video.currentTime = 1.801; 15 16 video.addEventListener("seeked", function() { 17 // Since the our media pipeline send the frame to imageBridge, then fire 18 // seeked event, the target frame may not be shown on the screen. 19 // So using canvas to access the target frame in the imageContainer in 20 // videoElement. 21 var canvas = document.getElementById("canvas"); 22 canvas.width = video.videoWidth; 23 canvas.height = video.videoHeight; 24 var ctx = canvas.getContext("2d"); 25 ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight); 26 document.documentElement.removeAttribute('class'); 27 }); 28 } 29 window.addEventListener("MozReftestInvalidate", doTest); 30 </script> 31 </head> 32 <body> 33 <video id="v1" style="position:absolute; left:0; top:0"></video> 34 <canvas id="canvas" style="position:absolute; left:0; top:0"></video> 35 </body> 36 </html>