short.mp4.lastframe.html (977B)
1 <!DOCTYPE HTML> 2 <html class="reftest-wait"> 3 <head> 4 <script type="text/javascript"> 5 function doTest() { 6 var video = document.getElementById("v1"); 7 video.src = "../short.mp4"; 8 video.preload = "metadata"; 9 video.seenEnded = false; 10 // Seek to the end 11 video.addEventListener("loadeddata", function() { 12 video.currentTime = video.duration; 13 video.onseeked = () => { 14 video.onseeked = null; 15 callSeekToNextFrame(); 16 }; 17 }); 18 19 function callSeekToNextFrame() { 20 video.seekToNextFrame().then( 21 () => { 22 if (!video.seenEnded) 23 callSeekToNextFrame(); 24 }, 25 () => { 26 // Reach the end, do nothing. 27 } 28 ); 29 } 30 31 video.addEventListener("ended", function() { 32 video.seenEnded = true; 33 document.documentElement.removeAttribute('class'); 34 }); 35 } 36 window.addEventListener("MozReftestInvalidate", doTest); 37 </script> 38 </head> 39 <body> 40 <video id="v1" style="position:absolute; left:0; top:0"></video> 41 </body> 42 </html>