In the existing version of my app, GuitarParrot, it was necessary to use '.defaultToSpeaker' to get the sounds to play from the Speaker, not the Receiver. Now this same setting is disabling the microphone.
This problem doesn't occur on iPads, but I have confirmed the issue on an iPhone7S and an iPhoneXR.
I am in the process of updating my app to be compliant with iOS 15 and Xcode 13. The use of '.defaultToSpeaker' is killing the mic input. If I remove this setting, then the mic input works as desired, but sound is sent to the Receiver speaker. I have hunted down dozens of audio code, yet I am not finding anyone doing this differently than myself. Here is the statement I'm using to initialize the session. What am I doing wrong?
let audioSession: AVAudioSession = AVAudioSession.sharedInstance() try audioSession.setCategory(AVAudioSession.Category.playAndRecord, mode: AVAudioSession.Mode.gameChat, options: [.defaultToSpeaker, .mixWithOthers]) try audioSession.setActive(true)
I have tried many variations (different modes, adding bluetooth). The only method that allows the mic to work is to remove '.defaultToSpeaker' from the options.
Any help is greatly appreciated.
Extra detail: My app is written using Flutter. All of the AVAudioSession initialization is done using a Swift plugin. I also downloaded the newly-released demo from AudioKit and it also defaults sound to the receiver speaker when the demo is run on an iPhone.