react-video-recorder icon indicating copy to clipboard operation
react-video-recorder copied to clipboard

React 18 Strict mode breaks camera - stuck on "Loading"

Open MikiMullorXjump opened this issue 10 months ago • 0 comments

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

MikiMullorXjump avatar Apr 08 '24 16:04 MikiMullorXjump