mind-ar-js-react icon indicating copy to clipboard operation
mind-ar-js-react copied to clipboard

TypeError: Cannot read properties of undefined (reading 'stopProcessVideo') when running nextjs

Open elblogbruno opened this issue 2 years ago • 2 comments

I am trying to run mindar on nextjs 14, but I have not been succesful. Whetever I use AFrame or Three, I get this error:

image

What could it be? Thanks

elblogbruno avatar Dec 19 '23 15:12 elblogbruno

i have exactly the same issue - i'll put something on the mind-ar repo and link to this too, but did you solve this

amcc avatar Oct 15 '24 15:10 amcc

fixed this here: https://github.com/hiukim/mind-ar-js/issues/549#issuecomment-2414458455

The issue is that strictMode mounts, unmounts then remounts the component. The stop function gets run in that process. I think this points to more checking needed within the stop function perhaps to account for the video not being started yet. I don't think react strict mode should really cause this error, but it is.

One solution would be to turn off strict mode, i wouldn't, the above link uses state to do an additional check

amcc avatar Oct 15 '24 16:10 amcc