event_timeupdate_noautoplay.html (1348B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>{audio,video} events - timeupdate</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/common/media.js"></script> 8 </head> 9 <body> 10 <p><a href="https://html.spec.whatwg.org/multipage/#mediaevents">spec reference</a></p> 11 <audio id="a" controls> 12 </audio> 13 <video id="v" controls> 14 </video> 15 <div id="log"></div> 16 <script> 17 test(function() { 18 var t = async_test("calling play() on a sufficiently long audio should trigger timeupdate event"); 19 var a = document.getElementById("a"); 20 a.addEventListener("error", t.unreached_func()); 21 a.addEventListener("timeupdate", t.step_func(function() { 22 t.done(); 23 a.pause(); 24 }), false); 25 a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random(); 26 a.play(); 27 }, "audio events - timeupdate"); 28 29 test(function() { 30 var t = async_test("calling play() on a sufficiently long video should trigger timeupdate event"); 31 var v = document.getElementById("v"); 32 v.addEventListener("error", t.unreached_func()); 33 v.addEventListener("timeupdate", t.step_func(function() { 34 t.done(); 35 v.pause(); 36 }), false); 37 v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random(); 38 v.play(); 39 }, "video events - timeupdate"); 40 </script> 41 </body> 42 </html>