Environment
- expo-audio-studio version: 2.18.1
- Expo SDK version: 53
- Platform & OS version: iOS 18
- Device: iPhone 16
Description
Unintended switching of audio devices, Steps to reproduce:
- Configure RecordingConfig with
ios.audioSession.categoryOptions = ['AllowBluetooth'] and define a deviceId for the built-in mic
- Start the recording, then connect bluetooth AirPods
- The waveform stops, no new audio analysis data and the recording switches to the AirPods
Cross-Platform Validation
The above steps can be reproduced with the AudioPlayer app on iOS. I couldn't test on Android because there the recording never started.
Can this issue be reproduced in the AudioPlayground app?
Reproduction steps in the AudioPlayground app (including any settings you modified):
- Microphone: Bulit-In
- Advanced Settings > Custom iOS Audio Settings > Mode: Measurement
- Advanced Settings > Custom iOS Audio Settings > Category: [
Allow Bluetooth]
Even if I disable Allow Bluetooth and start with the internal mic in the sample app and then connect Bluetooth, the waveform stops updating (and I guess the audio switched).
Is the behavior consistent across platforms?
Couldn't get the app running on Android.
Configuration
{
sampleRate: 16000,
channels: 1,
encoding: 'pcm_16bit',
keepAwake: true,
showNotification: true,
showWaveformInNotification: false,
autoResumeAfterInterruption: true,
android: {
audioFocusStrategy: 'background',
},
ios: {
audioSession: {
category: 'PlayAndRecord',
// Use 'Measurement' to minimize system processing during capture for higher STT accuracy.
// Avoid 'SpokenAudio' which is intended for playback of spoken content.
// Do not set 'DefaultToSpeaker' by default to prevent forcing speaker routing while recording.
mode: 'Measurement',
categoryOptions: ['AllowBluetooth'],
},
},
output: {
primary: { enabled: true, format: 'wav' },
compressed: {
enabled: true,
format: 'aac',
bitrate: compressedBitrate,
},
},
// Ensure that recording continues on the default device if the current device disconnects
deviceDisconnectionBehavior: 'fallback',
// Animate metering at ~25 FPS
enableProcessing: true,
intervalAnalysis: 20,
segmentDurationMs: 20,
onAudioStream: onAudioStream,
onAudioAnalysis: extractMeteringVisualizationDataFromAudioAnalysis,
onRecordingInterrupted: handleRecordingInterrupted,
};
Logs
Expected Behavior
No device switching
Actual Behavior
Switching to bluetooth
Additional Context
Checklist
Environment
Description
Unintended switching of audio devices, Steps to reproduce:
ios.audioSession.categoryOptions = ['AllowBluetooth']and define adeviceIdfor the built-in micCross-Platform Validation
The above steps can be reproduced with the AudioPlayer app on iOS. I couldn't test on Android because there the recording never started.
Can this issue be reproduced in the AudioPlayground app?
Reproduction steps in the AudioPlayground app (including any settings you modified):
Allow Bluetooth]Even if I disable
Allow Bluetoothand start with the internal mic in the sample app and then connect Bluetooth, the waveform stops updating (and I guess the audio switched).Is the behavior consistent across platforms?
Couldn't get the app running on Android.
Configuration
Logs
Expected Behavior
No device switching
Actual Behavior
Switching to bluetooth
Additional Context
Checklist