This project consists in a server application which reports the key press of the Media Keys on the keyboard through a standard HTML5 Web-Socket. The application works under Linux and OSX (if you are a Windows developer and want to contribute to this project, let me know).
Once installed, use the command line to launch mediakeysserver executable.
For both Linux and OSX, use Python's CheeseShop:
Alternatively for OSX: there is the .zip file attached to this page.