title: JavaScript detecting play/pause keyboard (virtual) key
body: <p>By accident, I just pressed the play/pause (<kbd>▶/❚❚</kbd>) button on my keyboard (the button just above <kbd>Num Lock</kbd> on <a href="https://www.windowscentral.com/lenovo-ideapad-330-review" rel="noreferrer"><img src="https://i.stack.imgur.com/lYaeG.jpg" alt="Lenovo keyboard"></a>, while playing a YouTube video in a tab that was not focused. To my massive surprise, the YouTube video paused immediately.</p>
  
  <p>Now, I tried looking up how this works, but I was not able to find anything on the internet explaining how a keypress can be detected for keys like this. I tried running <code>onkeydown = function(e) {console.log(e)}</code> in my console, but pressing the play/pause button did not trigger any event. Also, <a href="https://keycode.info/" rel="noreferrer">https://keycode.info/</a> did not give me any help with this either. I did find <a href="http://www.kbdedit.com/manual/low_level_vk_list.html" rel="noreferrer">http://www.kbdedit.com/manual/low_level_vk_list.html</a> which lists a whole lot of 'virtual key codes', which does include <code>VK_MEDIA_PLAY_PAUSE</code>, which is probably the key I am pressing, but I did not find any way to trigger an event in JS with this.</p>
  
  <p>Now I do want to specify that this functionality does not seem to work in Firefox, only in Chrome (as far as I've tested). It might be something that's still experimental, but I am really interested to hear what system YouTube uses to capture this event, even when the tab is currently not opened (Chrome wasn't even focused at the moment)</p>
  
  <p>PS: I experienced this on Ubuntu 18.04; I'm not sure if this will work on Windows, for example.</p>