Two part question:
- Is there a way to capture (react to the pressing of) the media playback control keys on a Mac keyboard (previous, play/pause, next) in a Google Chrome extension using strictly JavaScript?
if (answerToQuestion1 === "no")is there a way to do it using some sort of native plugin (C/C++)?
I know that this should be possible, as Unity Music Media Keys does it (albeit I know that they’re using a native plugin).
What I’ve looked at so far is this plugin, which claims to do it, but actually requires FunctionFlip to make the keys act as function keys, and reacts to the pressing of F7, F8, and F8.
1 – nope =[
2 – Whoa – holy crap. I hadn’t seen this extension before, so thank you for that. I dug into it a bit, and it seems that they install a .plugin on osx and a dll for windows support.
The decompiled plugin is only a couple hundred lines – https://gist.github.com/3849247.
They are using https://github.com/nevyn/SPMediaKeyTap as a way to plug in directly to the media keys (on os x). They are relaying that through a local socket.io server running on port 12345 to the browser, and the plugin is listening for events fired on it.
supppper neat.
EDIT:
This is now natively supported in chrome