tags:

views:

31

answers:

1

If the device has a microphone, I would create audio device as "play and record". If the microphone is not available, only "play" audio device can work.

A: 

answered already?

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

DJ Bouche
Thanks! I think I got the answer. NSError *error; AVAudioSession *audioSession = [AVAudioSession sharedInstance]; if (![audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error: } // mix audio with others, such as iPod etc. UInt32 doSetProperty = 1; AudioSessionSetProperty (kAudioSessionProperty_OtherMixableAudioShouldDuck, sizeof(doSetProperty), if (![audioSession setActive:YES error: } return audioSession.inputIsAvailable;
MQ Gu
Sorry, the code is a little bit mess. You can copy it to Xcode and indent it.
MQ Gu