I have one application which makes VOIP calls. I m using following code to route audio to bluetooth
if (err) {
LOGE(@"Unable to change audio mode because : %@", err.localizedDescription);
err = nil;
}
[audioSession setActive:TRUE error:&err];
if (err) {
LOGE(@"Unable to active session because : %@", err.localizedDescription);
err = nil;
}
}
This code works fine if i select Bluetooth headset from iPhone settings (Accessibility->Touch-> Call Audio Routing). but after you change setting to automatic and again change it to bluetooth , it does not redirect audio to bluetooth headset without restarting application. Is it mandatory to restart application once call audio routing is changed from device settings?. How can i achieve that without restarting app. I am calling above code before each call.
Thanks in Advance.
(void)configAudioSession:(AVAudioSession *)audioSession
Code Block NSLog(@"config audio session"); NSError *err = nil; [audioSession setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionAllowBluetoothA2DP | AVAudioSessionCategoryOptionMixWithOthers error:&err]; if (err) { LOGE(@"Unable to change audio category because : %@", err.localizedDescription); err = nil; } [audioSession setMode:AVAudioSessionModeVoiceChat error:&err]; [[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideNone error:nil];
if (err) {
LOGE(@"Unable to change audio mode because : %@", err.localizedDescription);
err = nil;
}
[audioSession setActive:TRUE error:&err];
if (err) {
LOGE(@"Unable to active session because : %@", err.localizedDescription);
err = nil;
}
}
This code works fine if i select Bluetooth headset from iPhone settings (Accessibility->Touch-> Call Audio Routing). but after you change setting to automatic and again change it to bluetooth , it does not redirect audio to bluetooth headset without restarting application. Is it mandatory to restart application once call audio routing is changed from device settings?. How can i achieve that without restarting app. I am calling above code before each call.
Thanks in Advance.