use-media-recorder icon indicating copy to clipboard operation
use-media-recorder copied to clipboard

Unmounted component behavior

Open wmik opened this issue 4 years ago • 4 comments

Disable recording and cleanup when a component is no longer mounted.

  • [ ] Implementation
  • [ ] Testing
  • [ ] Documentation

Update How to replicate:

  1. Render multiple recording apps on separate routes
  2. Visit one app/route
  3. Begin recording
  4. Navigate to the previous route (<- Back)

Expected behavior: recording should stop Current behavior: recording continues/media recorder is not reset

Example sandbox

wmik avatar May 19 '20 16:05 wmik

Any recommendations on how to do this properly? I've encountered the same problem using your hook

hugomassing avatar Jul 16 '21 15:07 hugomassing

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

wmik avatar Sep 05 '21 05:09 wmik

@lenus-ehealth will look into this issue :)

marco2216 avatar Sep 08 '21 12:09 marco2216

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.

Rodeoclash avatar Feb 17 '22 00:02 Rodeoclash