There's some information about the media keys at
the Rogue Amoeba blog, but the method spoken about in the blog requires VLC to have focus. The event tap found in the comments is where the real solution lies:
So I gave it a try, and sure enough it works: You can tap media key events by doing something along the lines of:
Code: Select all
CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, options, CGEventMaskBit(NX_SYSDEFINED), tapSystemDefinedEvent, NULL);
This requires universal access (via its system prefpane) being enabled, which isn't entirely unreasonable to ask; a lot of applications require it for shortcut access these days.
It would be phenomenal for VLC to have the media keys working; if the source wasn't such a daunting task I'd probably give it a shot.
If you're looking for working example code of the NSApplication subclassing method, I wrote a
small patch for NicePlayer which accomplishes it; it's a pretty simple method, but it requires application being keyed to receive the actions.