event_playing_noautoplay.html (1145B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>{audio,video} events - playing</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 audio should trigger playing event"); 19 var a = document.getElementById("a"); 20 a.addEventListener("playing", function() { 21 t.done(); 22 a.pause(); 23 }); 24 a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random(); 25 a.play(); 26 }, "audio events - playing"); 27 28 test(function() { 29 var t = async_test("calling play() on video should trigger playing event"); 30 var v = document.getElementById("v"); 31 v.addEventListener("playing", function() { 32 t.done(); 33 v.pause(); 34 }); 35 v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random(); 36 v.play(); 37 }, "video events - playing"); 38 </script> 39 </body> 40 </html>