Is it possible to record sound with the phone but force the playing through a bluetooth headset?
This is how I set my AVAudioSession category
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, with:[AVAudioSessionCategoryOptions.mixWithOthers])
The record is forced to use the phone mic. However, when playing the sound, it comes out from the phone too. I want the sound to be played only through the bluetooth headset.
I tried overriding the output audio port
try AVAudioSession.sharedInstance().overrideOutputAudioPort(AVAudioSessionPortOverride.none)
but still didn't work.
The problem has been solve. I just added the allowBluetoothA2DP option then it works.
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, with:[AVAudioSessionCategoryOptions.allowBluetoothA2DP, AVAudioSessionCategoryOptions.mixWithOthers])