Jack/earpiece detection in iphone
Anyone could tell me how to detect when a jack of an earpiece is plugged-i开发者_JS百科n into an ipad or iphone?
Thanks
I believe you can call AudioSessionGetProperty and then get the value "kAudioSessionProperty_AudioInputAvailable" to detect whether an audio jack has been plugged in.
I.e.
AudioSessionInitilize(NULL, NULL, NULL, NULL);
UInt32 propertySize, micConnected;
AudioSessionGetProperty(kAudioSessionProperty_AudioInputAvailable, &propertySize, &micConnected);
精彩评论