Release microphone immediately when cancelling recording

This commit is contained in:
Josh Perez 2021-10-15 14:51:33 -04:00 committed by GitHub
parent 9dc5214db7
commit ab1c31b64f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View file

@ -148,12 +148,20 @@ function completeRecording(
};
}
function cancelRecording(): CancelRecordingAction {
recorder.clear();
function cancelRecording(): ThunkAction<
void,
RootStateType,
unknown,
CancelRecordingAction
> {
return async dispatch => {
await recorder.stop();
recorder.clear();
return {
type: CANCEL_RECORDING,
payload: undefined,
dispatch({
type: CANCEL_RECORDING,
payload: undefined,
});
};
}
@ -200,7 +208,6 @@ export function reducer(
return {
...state,
errorDialogAudioRecorderType: action.payload,
isRecording: false,
};
}