ARTICLE AD BOX
Asked today
Viewed 35 times
Problem
I am using react-native-audio-recorder-player for microphone open/close handling inside a React Native voice SDK.
On Android 16, the first microphone session works correctly, but if I rapidly start/stop the recorder multiple times, the microphone session eventually stops initializing after 2–3 cycles.
Example:
await audioRecorderPlayer.startRecorder() await audioRecorderPlayer.stopRecorder() await audioRecorderPlayer.startRecorder() await audioRecorderPlayer.stopRecorder() await audioRecorderPlayer.startRecorder() // eventually failsImportant detail
This is NOT a permission issue.
RECORD_AUDIO permission is already granted
First initialization always succeeds
Failure only happens after rapid repeated open/close cycles
Observed behavior
Reproducible on only Android 16
Waiting a few seconds before reopening usually fixes it
Looks like native audio resources are not fully released before the next initialization
Sometimes startRecorder() hangs or does not properly initialize after repeated cycles
Questions
Has Android 16 changed AudioRecord teardown/reinitialization timing?
Is react-native-audio-recorder-player known to have issues with rapid recorder restarts?
Is there a recommended delay/debounce between stopRecorder() and startRecorder()?
Should recorder start/stop calls be serialized to avoid native race conditions?
Current flow
const start = async () => { await audioRecorderPlayer.startRecorder() } const stop = async () => { await audioRecorderPlayer.stopRecorder() }Rapidly calling startRecorder() and stopRecorder() eventually causes microphone initialization failures on Android 16.
Has anyone faced similar issues with react-native-audio-recorder-player or AudioRecord on newer Android versions?
New contributor
Code is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Hmm...
react-native-audio-recorder-player seems to be officially deprecated and archived, so this won't get a fix. The maintainer has moved to react-native-nitro-sound See here as the replacement. You could find your things to be fixed here.
If you can't migrate right now, adding a ~300ms delay after stopRecorder() before calling startRecorder() again might help with the teardown race on Android 16 — but that's a workaround, not a real fix.
Could work as work around.
const stop = async () => { await audioRecorderPlayer.stopRecorder(); await new Promise(res => setTimeout(res, 300)); };Migration is probably the cleaner path here.
Explore related questions
See similar questions with these tags.
