title: How does the play/pause button on the keyboard work?
body: <p>My computer keyboard, like many modern ones, has a button to play/pause music. It works with many applications, like the Spotify native player, Google Music web player, ITunes, etc. Some of these are native, and some are in a browser. The button works even when the program (or browser tab) is not in focus. How do these programs hook into this functionality?</p>
  
  <p>I expect that it works somewhat as follows, but this is just a guess:</p>
  
  <ol>
  <li>Web app registers a sound channel with the browser, providing some callbacks for pause/play/stop, etc.</li>
  <li>Browser registers its sound channel with the OS, providing some callback functions</li>
  <li>Pause button is pressed on keyboard</li>
  <li>OS calls a callback for the registered sound channel</li>
  <li>Browser's native callback calls the web app's Javascript callback function, which executes the pause</li>
  </ol>
  
  <p>(And for native applications, the indirection through the browser would be skipped)</p>