use-media-recorder
use-media-recorder copied to clipboard
Unmounted component behavior
Disable recording and cleanup when a component is no longer mounted.
- [ ] Implementation
- [ ] Testing
- [ ] Documentation
Update How to replicate:
- Render multiple recording apps on separate routes
- Visit one app/route
- Begin recording
- Navigate to the previous route (<- Back)
Expected behavior: recording should stop Current behavior: recording continues/media recorder is not reset
Any recommendations on how to do this properly? I've encountered the same problem using your hook
What's up @hugomassing sorry for the wait Actually have no idea how to get around that yet 😂 Still haven't investigated in detail but I have a hunch it has something to do with the refs
@lenus-ehealth will look into this issue :)
Doesn't seem like a big deal to handle this manually:
useEffect(() => {
return () => {
console.log('fire stop')
stopRecording()
}
}, [])
Stops the recording on unmount of the component that's consuming it.