hiukim / mind-ar-js

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

[bug] Switching orientation breaks the AR #238

Closed marcusx2 closed 1 year ago

marcusx2 commented 2 years ago

If I switch the orientation on the phone from portrait to landscape and vice versa, the augmented content disappears permanently.

marcusx2 commented 2 years ago

Apparently this bug was already reported here. Will it be fixed? This is a pretty big deal...I can't use mindarjs in production like this.

marcusx2 commented 2 years ago

@hiukim Any thoughts on this? Will it be fixed, or are there currently no plans to fix it?

hiukim commented 2 years ago

Yes, currently it will break if device changes orientation. I agree it needs to be handled. I will look into it when I have some free time.

marcusx2 commented 2 years ago

Ah ok. For now I'll need to use zappar. ARJS' image tracking is just not good enough, and switching orientation is really important for production. I can't just tell the client not to switch orientations T_T. I hope this gets fixed soon.

marcusx2 commented 1 year ago

@hiukim Will this be fixed soon? ;_;

hiukim commented 1 year ago

@marcusx2 sorry, unlikely. At least not these two weeks. Busy with work lately.

marcusx2 commented 1 year ago

Is there any workaround while this isn't fixed?

arslc commented 1 year ago

@marcusx2 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

marcusx2 commented 1 year ago

@arslc Thanks this is a good enough workaround, it works just fine!

arslc commented 1 year ago

@marcusx2 Glad it helped :) @hiukim Probably should be closed issue?

marcusx2 commented 1 year ago

@arslc I don't think it should be closed. I think we should be able to rotate the phone without having to stop and start the AR engine again. This is still just a workaround in my opinion.

hiukim commented 1 year ago

fixed in v1.2.2