How can I check if a microphone is plugged into the iPhone?

非 Y 不嫁゛ 提交于 2019-12-01 09:29:11

问题


I'm using AVAudioRecorder in the AVFoundation framework. I'm wondering how I can check for a microphone device being plugged in (on the iPod Touch)?


回答1:


Device Support section of the iPhone Application Programming Guide is your friend

In iPhone OS 3.0 and later, use the AVAudioSession class to determine if audio input is available. This class accounts for many different sources of audio input on iPhone OS–based devices, including built-in microphones, headset jacks, and connected accessories. For more information, see AVAudioSession Class Reference.




回答2:


BOOL inputAvailable = [[AVAudioSession sharedInstance] inputIsAvailable];



来源:https://stackoverflow.com/questions/2282871/how-can-i-check-if-a-microphone-is-plugged-into-the-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!