artoolkitx / jsartoolkit5

Javascript ARToolKit v5.x
https://artoolkitx.github.io/jsartoolkit5/examples/
Other
290 stars 67 forks source link

Issue with Camera on iOS 13 and Safari Browser #90

Open kalwalt opened 4 years ago

kalwalt commented 4 years ago

I report an issue from my repository https://github.com/kalwalt/kalwalt-interactivity-AR/issues/9 It seems that camera is not working properly with iOS 13, video start but suddenly is stopped. @huynhthanhnhan if you want maybe add other details, maybe we can try to fix this. @nicolocarpignoli @ThorstenBux have you an idea?

lucasmatheustesta commented 4 years ago

Hi, can you inform me if this problem happens only with the version "13"? Because I have a iPhone 7 version 13.3.1 and I can't reproduce the error. I saw the thread in "kalwat-interactivity-AR#9".

Is your iPhone a new one?

kalwalt commented 4 years ago

@lucasmatheustesta i don't know. I can not test on iPhone, my only devices are Android based. It could that in some cases it is required more memory? Anyway i added the -s ALLOW_MEMOR_GROWTH in the build script, see the PR https://github.com/artoolkitx/jsartoolkit5/pull/96 it will be merged soon.

szabadimiklos commented 4 years ago

I tried the nft_improved_worker example (https://github.com/artoolkitx/jsartoolkit5/blob/master/examples/nft_improved_worker/threejs_worker_gltf.html) on Windows/Chrome and Android/Chrome, and it works perfectly, but on an iPhone 7 running iOS 13.3.1 in Safari the problem still occurs, after a few seconds the page reloads itself, so it actually works for a brief time, but then it suddenly stops and reloads the page. I don't have problems with the wasm version so far on any devices (https://github.com/artoolkitx/jsartoolkit5/blob/master/examples/nft_threejs_wasm.html), but i wanted to use the nft_improved_worker example, because it has that nice movement smoothening.

kalwalt commented 4 years ago

Can you try the version in https://github.com/webarkit/jsartoolkit5 ? It should have the allow_memory_growth option that may help...

szabadimiklos commented 4 years ago

For me, this didn't solve the problem, it acts the same way: works for a few seconds (with quite low FPS), then safari reloads the page.

szabadimiklos commented 4 years ago

Update: I've updated the iPhone 7 from iOS 13.3.1 to 13.4.1 and the problem has gone, now it's working well! Also might be interesting to know: now it's working with both versions (I mean the one with allow_memory_growth, and the one without it works the same for me now) Another interseting thing is that on az iPhone 6s with iOS 13.3.1 (so with the same iOS version than it was on the iPhone 7 before the update) everything is working well, so this problem - for me - seems like a very device AND os specific iOS bug.

Davidwang007 commented 4 years ago

I am now use iPhone 11,iOS 14 beta 1,when use jsARToolKit,the camera start but suddenly stopped as above talked,but Android chrome without any problem, so how to solve it ? thank you .

JohnnyJimJams commented 4 years ago

Android is working fine for me. iOS 13.6 (iPhone X) on safari wasn't working. The camera would freeze.

Reloading/refreshing the page fixed the issue every time. First page load would freeze, second and subsequent page loads would work.

I suspected the camera permissions were the issue. Apple require user interaction to access the camera.

I added a launch button and it works on iOS consistently now.

I changed the last portion of code here in this file: jsartoolkit5/examples/nft_threejs_wasm.html

This bug is making me second guess my own sanity.

I very occasionally see an issue on PC, where "if (window.ARController && ARController.getUserMediaThreeScene) {" never runs.

When I attempt to log a bunch of stuff, I can't reproduce the issue. Race condition somewhere? Heisenbug? What the?

On iOS I see (again occasionally) the same bug where that code is never run. I also see a second bug when that code does run, but the camera freezes on the first frame.

Davidwang007 commented 3 years ago

@JohnnyJimJams ,Have you solve the problem yet ?

rievez commented 3 years ago

Had the same issue on iPhoneX os14.2 . Tried the fix from the repo and at last find out that it seems to be a common bug for getUserMedia with ios. A solution from here works : https://github.com/cozmo/jsQR/issues/185#issuecomment-725057289 Thank you guys for making this great library and repo ,it works perfectly on Android and Ios now like charm!