Skip to content

Commit

Permalink
Reset this._isRecording on an error
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaudanza committed Aug 13, 2024
1 parent 7e52ae6 commit 4654fc5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,16 @@ class AudioRecorderPlayer {
if (!this._isRecording) {
this._isRecording = true;

return RNAudioRecorderPlayer.startRecorder(
uri ?? 'DEFAULT',
audioSets,
meteringEnabled ?? false,
);
try {
return await RNAudioRecorderPlayer.startRecorder(
uri ?? 'DEFAULT',
audioSets,
meteringEnabled ?? false,
);
} catch (error: any) {
this._isRecording = false;
throw error;
}
}

return 'Already recording';
Expand Down

0 comments on commit 4654fc5

Please sign in to comment.