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

iPhone iOS 13 requires permission request for devicemotion/orientation #40

Open
richardtallent opened this issue Jan 3, 2020 · 1 comment

Comments

@richardtallent
Copy link

For Safari under iOS 13, the devicemotion and deviceorientation events aren't available without explicit permission from the user, which must be requested in the code before adding the listener. As a result, I can't get anything but a 45-degree still image to show up in the cardboard viewer.

Here's a related article:

https://dev.to/li/how-to-requestpermission-for-devicemotion-and-deviceorientation-events-in-ios-13-46g2

@danrossi
Copy link

danrossi commented Feb 24, 2020

Confirming there is no such feature. And gets worse. IOS 13 supports fullscreen. But the request has to be on a user click and not in a fullscreen callback, it complains about needing user click.

When going fullscreen the notification is hidden by the fullscreen element. Just ridiculous.

Therefore it has to be made before triggering fullscreen within the promise callback. And then fullscreen fails the first time. Second time it magically works.

Only fix. Or trigger this capturing a user click for the application. It will store the request and not popup a notification. On reload orientation works without request.

window.DeviceOrientationEvent.requestPermission().then( function ( response ) {
						console.log("SUCCESS", response);
  if ( response == 'granted' ) { 
     //request session / present
  }

});

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

2 participants