mediakeys

Cross-platform library to listen for media keys (play/next/back).

mediakeys

Detect "play", "next", and "prev" keys globally in Node.js.

npm install mediakeys

then

var mediakeys = require('mediakeys').listen();
mediakeys.on('play', function () {
    console.log('play');
})
mediakeys.on('next', function () {
    console.log('next');
})
mediakeys.on('back', function () {
    console.log('back');
})

That easy! To test globally on any platform:

$ npm install -g mediakeys
$ mediakeys
connected
play
next
back
...

Code for this library is sourced from a few locations:

http://www.codeguru.com/cpp/w-p/system/keyboard/article.php/c5655/Using-Multimedia-Keyboard-Keys-in-Your-Own-Program.htm (?? licensed)

https://github.com/msfeldstein/MediaKeyHosts (?? licensed)

https://github.com/Shouqun/node-dbus (MIT licensed)

All original code licensed under MIT.