3

I read this article and successfully make my app respond to media key: Make my Cocoa app respond to the keyboard play/pause key?

However, when I pressed play/pause key, the iTunes started to launch, is there any method to prevent iTunes launching when I press play/pause key in my app?

Community
  • 1
  • 1
sum
  • 33
  • 2

1 Answers1

1

Your best bet is to use this SPMediaKeyTap code, it works OK, but it can be flaky since your app's bundle ID isn't included in other's code, and the developer is not responsive to requests for new bundle IDs.

SPMediaKeyTap

Francis McGrew
  • 7,264
  • 1
  • 33
  • 30
  • 2
    I tried study SPMediaKeyTap yesterday but it still launch iTunes. I remember VLC did the work good, so I go download the src to have a look. I found that VLC also using SPMediaKeyTap, but it return YES at once in +(BOOL)usesGlobalMediaKeyTap, it works like a charm! – sum Sep 20 '11 at 04:27
  • That method returns NO when being debugged, because if your app crashes under GDB, half the time it will completely hang the system, requiring a hard restart. – Francis McGrew Sep 20 '11 at 10:28
  • oh, so I better keep return NO under development/debug environment. – sum Sep 20 '11 at 15:45