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

recordingBlob undefined #27

Closed
TyposBro opened this issue Apr 16, 2023 · 2 comments
Closed

recordingBlob undefined #27

TyposBro opened this issue Apr 16, 2023 · 2 comments
Labels
not an issue Something that is expected to happen

Comments

@TyposBro
Copy link

Hi there.
I wanted to use this library's hooks but can't access to recordingBlob.

Hook usage
const {
startRecording,
stopRecording,
togglePauseResume,
recordingBlob,
isRecording,
isPaused,
recordingTime,
} = useAudioRecorder();

const handleSave = () => {
stopRecording();
setBlob(recordingBlob);
};

** Usage: user can toggle pause/resume as much as they want. But once they press pause button, save button will appear and they can either save or discard it. Save button is implemented by handleSave function

@samhirtarif
Copy link
Owner

samhirtarif commented Apr 16, 2023

Hey @TyposBro - I believe doing something like this may solve your problem

useEffect(() => {
   if (!recordingBlob) return;

   setBlob(recordingBlob)
}, [recordingBlob])

const handleSave = () => {
    stopRecording(); // you can directly call stopRecording from where you're calling handleSave
};

Let me know if this helps

@samhirtarif samhirtarif pinned this issue Apr 16, 2023
@TyposBro
Copy link
Author

Yeah, works. Sorry for my silly issue🥹

@samhirtarif samhirtarif added the not an issue Something that is expected to happen label May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not an issue Something that is expected to happen
Projects
None yet
Development

No branches or pull requests

2 participants