Is there a way to detect if something is plugged into the headphone jack of a Mac using c or objective-c?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Should you still want to dive in and mess with this deep magic I was able to construct something together form the code I found here:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/54013-hardware-volume-change-listener-callback.html
You want to register a listen to the AudioProperties and catch any messages about ‘kAudioSessionProperty_AudioRouteChange’. Using the ‘reason’ and the ‘name’ you can parse togather what happened. You can also read more about that here:
http://developer.apple.com/library/ios/#DOCUMENTATION/AudioToolbox/Reference/AudioSessionServicesReference/Reference/reference.html
Callback: