Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing issues in stopping the audio recording #585

Open
SulthanNK opened this issue Feb 12, 2024 · 2 comments
Open

Facing issues in stopping the audio recording #585

SulthanNK opened this issue Feb 12, 2024 · 2 comments

Comments

@SulthanNK
Copy link

Even though using the stopRecorder method. it shows 'already stopped' but keeps recording the audio

@parthpanchalTAI
Copy link

For stopping the recording, you can directly attempt to stop the recorder, remove the record back listener, and then update your state.

const onStopRecord = React.useCallback(async () => {
    try {
        const result = await audioRecorderPlayer.stopRecorder();
        audioRecorderPlayer.removeRecordBackListener();
        setIsRecording(false);
        console.log("Stopped recording:", result);
    } catch (error) {
        console.error("Error stopping the recording:", error);
    }
}, []);

found the solution here

@Iamfavur
Copy link

Even though using the stopRecorder method. it shows 'already stopped' but keeps recording the audio

faced the same issue but apparently, it was happening because you declared the audio player inside your component when it should have been outside, like this >>

import....

const audioRecorderPlayer = new AudioRecorderPlayer();

const App()=>{}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants