Skip to content

Commit 9a048ab

Browse files
committed
error code
1 parent 2605f86 commit 9a048ab

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/audio/AudioManager.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export type AudioEngineConfigurationState = {
1111
preferSpeakerOutput: boolean;
1212
};
1313

14+
const kAudioEngineErrorFailedToConfigureAudioSession = -4100;
15+
1416
type CleanupFn = () => void;
1517

1618
/**
@@ -84,7 +86,10 @@ export function setupIOSAudioManagement(
8486
await tryConfigure(newState, oldState);
8587
} catch (error) {
8688
log.error('AudioSession configuration failed, stopping audio engine:', error);
87-
throw error;
89+
// Throw the error code so the native AudioDeviceModuleObserver returns it
90+
// to the WebRTC engine, which will stop/rollback the operation.
91+
// eslint-disable-next-line no-throw-literal
92+
throw kAudioEngineErrorFailedToConfigureAudioSession;
8893
}
8994
// Update the audio state only if configure succeeds
9095
audioEngineState = newState;

0 commit comments

Comments
 (0)