tor-browser

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

file_media_session.html (621B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>Media Session and non-autoplay media</title>
      5 </head>
      6 <body>
      7 <video id="testVideo" src="gizmo.mp4" loop></video>
      8 <h1 id="result"></h1>
      9 <script type="text/javascript">
     10 
     11 const MediaSessionActions = [
     12  "play",
     13  "pause",
     14  "seekbackward",
     15  "seekforward",
     16  "previoustrack",
     17  "nexttrack",
     18  "stop",
     19 ];
     20 
     21 for (const action of MediaSessionActions) {
     22  navigator.mediaSession.setActionHandler(action, () => {
     23    document.getElementById("result").innerHTML = action;
     24    document.getElementById("result").dispatchEvent(new CustomEvent("actionChanged"));
     25  });
     26 }
     27 
     28 </script>
     29 </body>
     30 </html>