Fix iOS audio session "status -50" error

Remove allowBluetoothA2DP from audioCategoryOptions. This option is
incompatible with playAndRecord category on some iOS versions.
The allowBluetooth (HFP profile) is sufficient for voice calls.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Sergei 2026-01-20 09:41:14 -08:00
parent e3192ead12
commit 0d872a09b7

View File

@ -54,9 +54,11 @@ export async function configureAudioForVoiceCall(): Promise<void> {
console.log('[AudioSession] Step 1: Setting Apple audio config...'); console.log('[AudioSession] Step 1: Setting Apple audio config...');
await AudioSession.setAppleAudioConfiguration({ await AudioSession.setAppleAudioConfiguration({
audioCategory: 'playAndRecord', 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: [ audioCategoryOptions: [
'allowBluetooth', 'allowBluetooth',
'allowBluetoothA2DP',
'defaultToSpeaker', 'defaultToSpeaker',
'mixWithOthers', 'mixWithOthers',
], ],
@ -155,9 +157,11 @@ export async function reconfigureAudioForPlayback(): Promise<void> {
// Just reconfigure the same settings - this "refreshes" the audio routing // Just reconfigure the same settings - this "refreshes" the audio routing
await AudioSession.setAppleAudioConfiguration({ await AudioSession.setAppleAudioConfiguration({
audioCategory: 'playAndRecord', 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: [ audioCategoryOptions: [
'allowBluetooth', 'allowBluetooth',
'allowBluetoothA2DP',
'defaultToSpeaker', 'defaultToSpeaker',
'mixWithOthers', 'mixWithOthers',
], ],
@ -213,11 +217,12 @@ export async function setAudioOutput(useSpeaker: boolean): Promise<void> {
}); });
// Also update the full configuration to ensure it takes effect // Also update the full configuration to ensure it takes effect
// Note: removed 'allowBluetoothA2DP' - causes "status -50" error
await AudioSession.setAppleAudioConfiguration({ await AudioSession.setAppleAudioConfiguration({
audioCategory: 'playAndRecord', audioCategory: 'playAndRecord',
audioCategoryOptions: useSpeaker audioCategoryOptions: useSpeaker
? ['allowBluetooth', 'allowBluetoothA2DP', 'defaultToSpeaker', 'mixWithOthers'] ? ['allowBluetooth', 'defaultToSpeaker', 'mixWithOthers']
: ['allowBluetooth', 'allowBluetoothA2DP', 'mixWithOthers'], : ['allowBluetooth', 'mixWithOthers'],
audioMode: 'voiceChat', audioMode: 'voiceChat',
}); });
} else if (Platform.OS === 'android') { } else if (Platform.OS === 'android') {