aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.69k stars 3.98k forks source link

VR mode on iOS 13.4.1 does not work #4554

Closed dax72 closed 4 years ago

dax72 commented 4 years ago

Gyroscope movement does not work, it works fine before ios13.4.1 update or without turning on vr mode.

machenmusik commented 4 years ago

Hi, can you try the branch in PR #4548 and see if that fixes it?

dax72 commented 4 years ago

is there a dist ready to download?

dmarcos commented 4 years ago

I couldn't find any relevant changes on the Safari release notes:

https://developer.apple.com/documentation/safari_release_notes

dax72 commented 4 years ago

I just tried on another iPad (iPad Pro 12,9""), v13.4.1...same problem! Motion sensor does not work when you click VR button.

dmarcos commented 4 years ago

We should probably disable cardboard / stereo mode on iPads

dax72 commented 4 years ago

and on iPhone? currently I can confirm that it does not work on iPhone and iPad with iOS13.4.1. VR mode on iPad has no sense..but on iPhone it's necessary

kowalus23 commented 4 years ago

Got same issue, with my older iphone for tests with iOS 13.3 it does work properly, but newest 13.4.X it doesn't... as far as i checked DeviceMotionEvent.requestPermission() doesn't seem to work right, it asks about permission, right after with my app it reloads page and and my typical promise that checks if it's gyroscope or if the device support gyroscope it saying "false" for iPhone with newest iOS :/ previous version was ok.

Also checked with DeviceOrientationEvent, doesn't help :(

dmarcos commented 4 years ago

On iPad we can disable. On iPhone we can keep for now. What’s your audience? Can you share details on your application? We see Cardboard usage decline and harder and harder to come by. Polyfilled VR comes with a lot of issues like this one where things break when browser APIs and policies change.

dax72 commented 4 years ago

We create VR games/apps for clients and they require iPhone compatibility

dmarcos commented 4 years ago

Is iPhone compatibility via Magic Window mode enough? Do you have any metrics of cardboard usage you can share?

dax72 commented 4 years ago

Magic Window mode it's not enough, they need stereo mode. I think the percentage of iPhone/cardboard is not relevant but clients require the compatibility iPhone/android and without it they do not market products.

Safari iOS from a development point of view is a nightmare because there is no webVR/webXR support but for big companies it is not their problem, they want it to work on iOS too :(

dmarcos commented 4 years ago

@dax72 Thanks for the info. Is your client decision based on any audience metrics?

dax72 commented 4 years ago

@dmarcos Unfortunately I don't have access to their audience metrics, but I have more clients that are asking to me to fix this iOS bug

dmarcos commented 4 years ago

@dax72 Are they willing to pay to fix the issue?

andreyrd commented 4 years ago

For what it's worth, this also affects magic window tracking, not just VR mode.

andreyrd commented 4 years ago

Ok, did some investigating. 🕵🏻‍♂️

This was a regression in Webkit, reported on 2020-03-31: https://bugs.webkit.org/show_bug.cgi?id=209831 And patched same day by the reporter: https://github.com/WebKit/webkit/commit/13e78b2bad4fb6f8c8a152e9a3cfc07c910dc858

Unfortunately, considering that the changeset which introduced the bug was in December 2019: https://trac.webkit.org/changeset/253357/webkit And the bug only showed up just now in 13.4.1, it seems it's gonna take a really long time to see the patch fixing it make it's way into iOS.

dmarcos commented 4 years ago

Thanks for investigating. Super appreciated. Magic window still works for me on examples:

https://aframe.io/aframe/examples/

it’s a different code path

andreyrd commented 4 years ago

Oh, interesting! That's probably because our team is currently stuck on 0.9.2 for other reasons, which is using the webvr-polyfill / device motion api for magic window?

So scratch that. Can confirm that on latest aframe, magic window is fine.

dmarcos commented 4 years ago

Since iOS 13, Safari requires permission to access DeviceMotion. 0.9.2 doesn’t have the request logic. It predates iOS 13

andreyrd commented 4 years ago

Yeah, we manually call DeviceMotionEvent.requestPermission(). Worked up until this bug. Same issue as VR mode in latest versions, lots of log spam TypeError: null is not an object (evaluating 'i.alpha') from webvr-polyfill.

jwjordan commented 4 years ago

Does this pull request fix what is needed for aframe to work properly with iOS 13.4 in cardboard mode? https://github.com/immersive-web/cardboard-vr-display/pull/42 If so, what's the process for getting that incorporated? Does that PR have to get merged into immersive-web, and then immersive-web gets merged into a new point release for aframe?

dmarcos commented 4 years ago

@jwjordan Yes, best would be for that PR to merge and then for the webvr-polyfill to incorporate. A-Frame would pick a new version of the polyfill Alternative would be to maintain a fork of both repos that it's preferable to avoid.

jsantell commented 4 years ago

webvr-polyfill 0.10.12 now has the changes from upstream cardboard-vr-display

dmarcos commented 4 years ago

@jsantell Yeah! Thank you very much. Super appreciated. I bumped the polyfill on master.

jsantell commented 4 years ago

shout out to @jwjordan @ivnnv @machenmusik for the research & patches :tada:

dmarcos commented 4 years ago

Yeah. Thanks everybody 👏

jwjordan commented 4 years ago

Checked out master and tested in a VR model inside Ideaspace, and I can confirm this fixed the cardboard mode on the latest version of iOS (13.4.1) in my specific instance. Thanks a ton everyone!

levmillr commented 4 years ago

Awesome! When does 1.0.5 release? :)

dmarcos commented 4 years ago

It’ll be 1.1.0 in a few days depending on how QA goes. In the meantime you can use master builds

levmillr commented 4 years ago

Nice even better! I hope it goes well. Thank you @dmarcos and thankyou to everyone who worked on this

andreyrd commented 4 years ago

And of course...everything works just like normal again in iOS 13.5 beta 5 using 1.0.4...

dmarcos commented 4 years ago

Thanks for reporting

NomisGnos commented 4 years ago

I can confirm commit cd01cec works.

I assume commit a326ceb will continue to have this update.

jgutierro commented 4 years ago

Hello @dmarcos I'm getting an error with the cd01cec35a01e03eb2d6a9272500a53de31d3828 version. On this [url]() you can see the error when you focus the pointer on the green marks

index.js:96 Uncaught TypeError: Cannot read property 'array' of undefined at TextGeometry.computeBoundingSphere (index.js:96) at H.raycast (three.js:11367) at Fa (three.js:46525) at Ba.intersectObjects (three.js:46600) at i.checkIntersections (raycaster.js:226) at i.tick (raycaster.js:198) at HTMLElement.tick (a-scene.js:719) at HTMLElement.render (a-scene.js:769) at bind.js:12 at m (three.js:25084)

With version 1.0.4 this doesn't happen, but VR is not working on iOS 13...

NomisGnos commented 4 years ago

@jgutierro that commit looks like it was moved to master. I get that same issue on master branch as well. You might want submit a new ticket or even take a look / revive https://github.com/aframevr/aframe/issues/3318

dmarcos commented 4 years ago

Your issue seems unrelated to VR mode not working on iOS. Best to open a separate issue as @NomisGnos mentioned

jgutierro commented 4 years ago

Hello @NomisGnos and @dmarcos thank you for your answer. I know that commit is moved to master. But I replied here because I guess this TextGeometry error it's caused by this new fixed version for safari, because with the 1.0.4 version it's working fine.

dmarcos commented 4 years ago

@jgutierro I recommend opening a new issue or information will get lost. Make sure you provide a link to reproduce. Thanks!

jgutierro commented 4 years ago

Hello @dmarcos, if I try to insert on a iOS WebKit this url https://app.estudiocactus.com/clickandrender/ (it's the master commit aframe version cd01cec35a01e03eb2d6a9272500a53de31d3828) is not working. Do you have any idea why? Because it's working fine if I open directly on safari

jgutierro commented 4 years ago

Hello @dmarcos and @NomisGnos I opened a new issue and finally was solved! https://github.com/aframevr/aframe/issues/4618#issuecomment-642433783

Thank you so much!