ios8avfoundationcore-audioavaudioplayeravaudiosession

iOS8 AVAudioEngine how do I route microphone input to the (bottom) speaker output?


I've been able to connect AVAudioInputNode (which takes microphone input data) and connect it to the AVAudioEngine. I can hear the output from the (upper) speaker if I put my phone close enough to my ear. How can I route the audio output to the (bottom) speaker instead ? (Think of it as a loudspeaker..)


Solution

  • Get the sharedInstance of your AVAudioSession. Then call setCategory:withOptions:error passing in the parameters below:

    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error:Nil];