开发者

Jack/earpiece detection in iphone

开发者 https://www.devze.com 2023-01-11 14:15 出处:网络
Anyone could tell me how to detect when a jack of an earpiece is plugged-i开发者_JS百科n into an ipad or 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);
0

精彩评论

暂无评论...
验证码 换一张
取 消