Previous/Pause-Play/Forward keys

macOS specific usage questions
wubrgamer
New Cone
New Cone
Posts: 5
Joined: 28 Nov 2008 19:44

Previous/Pause-Play/Forward keys

Postby wubrgamer » 28 Nov 2008 19:48

Do these keys (f7/f8/f9) work on Mac OS X ?

Or did Apple lock them down for their own applications (iTunes) only? I prefer VLC to be honest, but I'd like to use these keys as well, is this possible?

wubrgamer
New Cone
New Cone
Posts: 5
Joined: 28 Nov 2008 19:44

Re: Previous/Pause-Play/Forward keys

Postby wubrgamer » 21 Dec 2008 21:20

It was mentioned in IRC that these keys work under Ubuntu. So it is possible for Mac OS X as well, is there just no interest in implementing this feature?

zacwest
New Cone
New Cone
Posts: 6
Joined: 24 Dec 2008 02:26

Re: Previous/Pause-Play/Forward keys

Postby zacwest » 24 Dec 2008 02:30

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.


Return to “VLC media player for macOS Troubleshooting”

Who is online

Users browsing this forum: No registered users and 31 guests