diff --git a/utils/audioSession.ts b/utils/audioSession.ts index 6da3ba0..48101f2 100644 --- a/utils/audioSession.ts +++ b/utils/audioSession.ts @@ -54,9 +54,11 @@ export async function configureAudioForVoiceCall(): Promise { console.log('[AudioSession] Step 1: Setting Apple audio config...'); await AudioSession.setAppleAudioConfiguration({ audioCategory: 'playAndRecord', + // Note: removed 'allowBluetoothA2DP' - it's incompatible with playAndRecord + // on some iOS versions and causes "status -50" error. + // 'allowBluetooth' (HFP profile) is sufficient for voice calls. audioCategoryOptions: [ 'allowBluetooth', - 'allowBluetoothA2DP', 'defaultToSpeaker', 'mixWithOthers', ], @@ -155,9 +157,11 @@ export async function reconfigureAudioForPlayback(): Promise { // Just reconfigure the same settings - this "refreshes" the audio routing await AudioSession.setAppleAudioConfiguration({ audioCategory: 'playAndRecord', + // Note: removed 'allowBluetoothA2DP' - it's incompatible with playAndRecord + // on some iOS versions and causes "status -50" error. + // 'allowBluetooth' (HFP profile) is sufficient for voice calls. audioCategoryOptions: [ 'allowBluetooth', - 'allowBluetoothA2DP', 'defaultToSpeaker', 'mixWithOthers', ], @@ -213,11 +217,12 @@ export async function setAudioOutput(useSpeaker: boolean): Promise { }); // Also update the full configuration to ensure it takes effect + // Note: removed 'allowBluetoothA2DP' - causes "status -50" error await AudioSession.setAppleAudioConfiguration({ audioCategory: 'playAndRecord', audioCategoryOptions: useSpeaker - ? ['allowBluetooth', 'allowBluetoothA2DP', 'defaultToSpeaker', 'mixWithOthers'] - : ['allowBluetooth', 'allowBluetoothA2DP', 'mixWithOthers'], + ? ['allowBluetooth', 'defaultToSpeaker', 'mixWithOthers'] + : ['allowBluetooth', 'mixWithOthers'], audioMode: 'voiceChat', }); } else if (Platform.OS === 'android') {