fartts / superfluity

Neon has the unique quality of representing contrasting ideas about our future. In form and in color, its natural hues represent an optimistic and technologically-fueled tomorrow. Simultaneously, its past applications are fading into ruin, marking failed attempts at establishing utopia. Through medium and metaphor, the artists in NEON explore this strange duality.
MIT License
0 stars 0 forks source link

Figure out prompting for DeviceMotion permissions #293

Open mysterycommand opened 5 years ago

mysterycommand commented 5 years ago

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: https://github.com/aframevr/aframe/issues/3976 … and: https://github.com/w3c/deviceorientation/issues/57#issuecomment-498417027

awe-media commented 5 years ago

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 https://github.com/w3c/deviceorientation/issues/57#issuecomment-498417027

alfeugds commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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 commented 4 years ago

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 commented 3 years ago

This is what I get on Safari:

IMG-20201027-WA0001

charlie-george-1989 commented 3 years ago

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?