jsartoolkit5 icon indicating copy to clipboard operation
jsartoolkit5 copied to clipboard

Issue with Camera on iOS 13 and Safari Browser

Open kalwalt opened this issue 5 years ago • 10 comments

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?

kalwalt avatar Feb 07 '20 10:02 kalwalt

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?

lucasmatheustesta avatar Apr 09 '20 14:04 lucasmatheustesta

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

kalwalt avatar Apr 09 '20 15:04 kalwalt

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.

szabadimiklos avatar May 08 '20 08:05 szabadimiklos

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

kalwalt avatar May 08 '20 08:05 kalwalt

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 avatar May 08 '20 09:05 szabadimiklos

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.

szabadimiklos avatar May 08 '20 13:05 szabadimiklos

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 .

Davidwang007 avatar Aug 03 '20 08:08 Davidwang007

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.

JohnnyJimJams avatar Aug 21 '20 05:08 JohnnyJimJams

@JohnnyJimJams ,Have you solve the problem yet ?

Davidwang007 avatar Oct 27 '20 09:10 Davidwang007

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!

rievez avatar Nov 25 '20 18:11 rievez