react-video-recorder
react-video-recorder copied to clipboard
React 18 Strict mode breaks camera - stuck on "Loading"
Under Strict Mode, isCameraOn state prop doesn't set to true, therefore breaking downstream the capture of video
Line 333 in video-recorder.js:
handleSuccess = (stream) => { // Since handleSuccess is an async function, we may be in a situation where this was called after the // component was unmounted if (this.isComponentUnmounted) { return }
isComponentUnmounted is true when Reacts mounts the second time in strict mode.
This prevents setting isCameraOn to true
It's a race condition somewhere.
disabling strict mode "fixes" the issue