Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure out prompting for DeviceMotion permissions #293

Open
mysterycommand opened this issue Jul 27, 2019 · 7 comments
Open

Figure out prompting for DeviceMotion permissions #293

mysterycommand opened this issue Jul 27, 2019 · 7 comments

Comments

@mysterycommand
Copy link
Collaborator

In iOS Safari 12.2+ permission needs to be enabled in settings for iPhones to fire 'devicemotion' and 'deviceorientation' events … in iOS Safari 13 beta 3 release notes it appears they've implemented a permissions API but I can't find any documentation for it yet.

See also: aframevr/aframe#3976
… and: w3c/deviceorientation#57 (comment)

@awe-media
Copy link

The Permission API for DeviceOrientation does work in iOS 13 using the standard pattern.

DeviceOrientationEvent.requestPermission().then((_result) => {
  if (_result == 'granted') { // or invert this and check for denied/dismissed
    ...
  }
}); 

But there are 2 key issues you'll face!

  1. This request requires a user gesture to fire it.
  2. iOS Safari caches the user's permission decision and if they deny then it seems there's no way to clear this at all 8(

We'll ping @chris_dumez on twitter for more info as he suggested w3c/deviceorientation#57 (comment)

@alfeugds
Copy link

alfeugds commented Sep 5, 2019

Hi! Any luck with Safari caching the user's permission decision? I'm facing the same exact issue =/
The DeviceOrientationEvent.requestPermission() returns 'denied' no matter what I do

@mysterycommand
Copy link
Collaborator Author

@alfeugds I have not figured out a way to re-request permission if it's been denied previously. I think we might be stuck prompting our users to go into Settings and toggle the permission themselves … which sounds like something people won't likely do?

@newhouseb
Copy link

It turns out that you can just restart Safari on iOS and it will forget all permissions. Not great, but at least it's reversible if you accidentally hit deny (for what it's worth there's no longer any permissions in the Settings app either).

@KevinEverywhere
Copy link

I am so frustrated with freaking Apple's elusive coding practices but had to at least share one piece of positive feedback. As @mysterycommand and @alfeugds and @newhouseb have pointed out, denials of permissions are cached and can be reset by restarting Safari. The positive side of permissions caching is that, once permission has been granted, that also caches! Finally! A sliver of good news in a forest of less-than-good-news! :)

@charlie-george-1989
Copy link

charlie-george-1989 commented Oct 27, 2020

This is what I get on Safari:

IMG-20201027-WA0001

@charlie-george-1989
Copy link

charlie-george-1989 commented Oct 27, 2020

This website allows immersion without requesting permission:

https://vr.bymelt.com

***edit: allows the 3D scene to display and be played but does not allow camera control (assuming due to lack of permissions as none are asked).

Does anyone know what technology they are using to achieve this?

I need a couple of 'windows' into my VR scenes for my website:

https://immersify.co.uk

But at the moment I need to use extra CSS of:

pointer-events: none;

On my iframe in order to enable page scrolling on the iframe element but this takes away the ability to select the prompt.

Is there a way around this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants