0
votes

I'm working on a personal project that involves iOS and Bluetooth headset, and I ran into some issues. What I'm trying to achieve is some kind of an intercom app that use Bluetooth. I want to be able connect to the bluetooth headset, and play the audio coming from it's microphone using the Built-in Speaker.

I've managed to connect to the headset using bluetooth, but I can't re-direct the audio to the device's speakers. Whenever I'm connected and the AudioSession preferredInput is set to the bluetooth headset the audio is playing through the headset and not through the speaker.

If someone could point me in the right direction or even give me some example code that'll be great.

P.S: I'm very happy with the simplicity and plotting capabilities I'm getting by using EZAudio framework. If there's a way to achieve my goal using EZAudio it'll be great.

1

1 Answers

-1
votes

Try This

NSError *sessionError = nil;
[[AVAudioSession sharedInstance] setDelegate:self];
[[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&sessionError];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error: &sessionError];