tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

event_play_noautoplay.html (1410B)


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