hiukim / mind-ar-js

Web Augmented Reality. Image Tracking, Face Tracking. Tensorflow.js
MIT License
2.19k stars 407 forks source link

Image tracking fails after device orientation has changed #212

Closed DouglasLapsley closed 1 year ago

DouglasLapsley commented 2 years ago

Please see here on iPhone.

Is there a re-init method that can be called on orientationchange or something to deal with this?

Thank you.

arslc commented 1 year ago

@DouglasLapsley try this:

window.addEventListener('orientationchange', () => {
 //stop mindar
 mindar.stop()

 // ur function to hide 3D object (optional)

 //restart mindar after 1 second delay
 setTimeout(()=>{
  mindar.start()
 }, 1000)

}, false)

Not the most elegant way, but as a temporary solution it may help.

P.S. I know, this is deprecated event, but it still work on iOS 16. So we can use that until @hiukim not fix this bug

hiukim commented 1 year ago

fixed in v1.2.2