-
-
Notifications
You must be signed in to change notification settings - Fork 426
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
TypeError: Cannot read properties of undefined (reading 'stopProcessVideo') #549
Comments
I've solved this for myself... I'll also post this over on the react mind AR repo (https://github.com/hiukim/mind-ar-js-react). This is happening in NextJS because it runs in strict mode by default - which is what all modern React implementations should really do. The error is happening because React (quite rightly) mounts, unmounts and then remounts to check for issues in strictMode when developing. So mindAR is mounted, then unmounted, then mounted again. I'm not sure exactly why the stop() function on MindARThree isn't available immediately, but it evidently isn't - which might point to another issue. To fix this i've set a state which checks to see if MindARThree has been started, if it has not been started it will not attempt to stop it. Key changes:
Here's the full solution:
|
Update on this. Another problem is caused by my workaround. Multiple instances of the canvas and mind-ar UI elements are getting created if the stop() function isn't called. This needs looking into more deeply |
I'm getting the above error with a fresh install of Next.js and attempting an integration of mind-ar and react. I've taken the exact versions of both mind-ar and threejs from the hiukim / mind-ar-js-react repo. My implementation is exactly this on a fresh NextJS install:
https://github.com/hiukim/mind-ar-js-react/blob/master/src/mindar-three-viewer.js
I'm not the only one with this error, there's a discussion on this repo too:
hiukim/mind-ar-js-react#13
It hasn't been answered, I can't find anything on this error anywhere else
package.json:
error:
TypeError: Cannot read properties of undefined (reading 'stopProcessVideo')
The text was updated successfully, but these errors were encountered: