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

Stop streaming in componentWillUnmount #70

Open
BibhuVijayan opened this issue Jul 22, 2019 · 5 comments
Open

Stop streaming in componentWillUnmount #70

BibhuVijayan opened this issue Jul 22, 2019 · 5 comments

Comments

@BibhuVijayan
Copy link

Currently recording never stop after component is unmounted. Should we stop recording after componentWillUnmount?

@BibhuVijayan BibhuVijayan changed the title Stop streaming on componentWillUnmount Stop streaming in componentWillUnmount Jul 22, 2019
@Morsmetus
Copy link

Really need a way to do this but had no luck

@hackingbeauty
Copy link
Owner

Yes, stop recording after component is unmounted. In componentWillUnmount just set the state of ReactMic to recording={false}.

If you have multiple components that are interacting with React-Mic or React-Mic-Plus, you probably need to use Redux to stop recording when unmounting.

It's very simple. I can create a video lesson if required.

@Morsmetus
Copy link

Morsmetus commented Dec 11, 2019

Just to be clear, I am talking about red dot in browsers, recording works fine, but red dot won't go away without workaround.

It was really simple for static content, but in my case I needed to hide recording component after recording being stopped, so I had two states, one for view, and one for record, because only working solution was first make recording stop, and then close the recording view.

View was in modal and after closing modal even if I set record state to false in componentWillUnmount it was still showing a red dot. (Recording was fine, I am talking about the red dot) so only way I could get rid of red dot was to implement clickaway listener, and before clicking close from modal, set recording to false which was not a pretty solution, but working fine.

Thing is I had to move away from this lib anyways, because webm format was not played in IOS app and we needed mp3 format. I tried to use @cleandersonlobo/react-mic fork for it, but on his version red dot doesn't go away even if I do all the stuff I explained above.

@hackingbeauty
Copy link
Owner

hackingbeauty commented Dec 11, 2019 via email

@hackingbeauty
Copy link
Owner

@Morsmetus Red dot issue is fixed in React-Mic-Gold. Also, you can record in MP3 using React-Mic-Gold. You can find the premium upgrade here.

See demo here: https://voicerecordpro.com/#/record

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