1

It seems that we can catch the event MediaPlayPause

keyCode: 179
keyIdentifier: "MediaPlayPause"

This is a good news, but actually, I didn't manage to find a way to stop the initial event that do not depend of the browser, but the OS. Did someone find a way to cheat?

EDIT 04/2015:

I guess that's not possible to access the OS from a browser while doing JS.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
romuleald
  • 1,406
  • 16
  • 31
  • What are you trying to achieve? – xpereta Jun 17 '13 at 13:09
  • Binding on a HTML5 sound player (using soundmanager) to play/pause the music with the MediaPlayPause button. – romuleald Jun 17 '13 at 13:31
  • Please provide the source code that you are using, or if it is too big to fit here a smaller equivalent example. – xpereta Jun 17 '13 at 14:00
  • 1
    This kind of stuff, but I don't get why this is necessary to understand what I'm trying to reach. `document.addEventListener('keydown', function(e){ if(e.keyCode === '179'){ e.preventDefault() } })` – romuleald Jun 17 '13 at 14:13
  • If you provide enough information and show that you have researched your question it's more easily understood and it's more likely that someone will spend time answering it. – xpereta Jun 17 '13 at 14:50

1 Answers1

1

You should return false from your event handler, or call both e.preventDefault and e.stopPropagation.

See this other question for the full details: event.preventDefault() vs. return false

Community
  • 1
  • 1
xpereta
  • 692
  • 9
  • 21