ios 13 and DeviceOrientationEvent.requestPermission

  • Hello!

    In ios 12 apple introduced the pesky checkbox in settings for allowing device motion, which meant that we did not have any way but making the user go into settings and enabling this feature.

    But now in ios 13 they have removed that checkbox and now you have to ask permission for the different apis.

    i just tried 1.20 against ios 13 and it doesn't seem to ask for permission, so this is something that needs fixing.

    Something like this is needed


    if (typeof DeviceOrientationEvent.requestPermission === 'function') {
    document.body.addEventListener('click', function () {
    DeviceOrientationEvent.requestPermission()
    .then(function() {
    console.log('DeviceOrientationEvent, DeviceMotionEvent enabled');
    })
    .catch(function (error) {
    console.warn('DeviceOrientationEvent, DeviceMotionEvent not enabled', error);
    })
    }, {once: true});
    return;
    }

  • DeviceOrientationEvent.requestPermission()
    .then(function() {
    console.log('DeviceOrientationEvent, DeviceMotionEvent enabled');
    })

    It seems permission have to be requested separately for DeviceOrientationEvent and DeviceMotionEvent

  • Hi,

    make sure to use krpano 1.20 and also the newer gyro2.js and webvr.js plugin from there!

    They already support requestPermission for DeviceMotionEvent (which is used by default) and also for DeviceOrientationEvent.

    Best regards,
    Klaus


    Hi, I've updated my krpano to 1.20.2 and copied gyro2 and webvr files but I still can't get my gyro and vr to work on iPhone.


    Any idea what to do?

  • Will this code work even though the motion and orientation option is missing from Safari with the iOS 13 update?

    And when I open the gyro2 in 1.20 - its a lot of code..where does the above code go??

    I see code examples but no where are tutorials on WHERE to put the code. I know this is a great software, but for experienced code gurus newbies must own way but I'm under deadline, totally lost and ready to find another application. Wont spend the money on a 3rd upgrade if its so difficult to use.

  • Hello All,

    Reporting about gyro issue - just been updated to 13.1.3 and gyro stop working (1.20.2/https/etc) as there is no motion&orientation permission dialog request. At the same time when I enters WebVR, the motion&orientation request dialog appears fine and it works once allowed.

    Also, when using videoplayer.xml from 1.19.pr16 no user interaction is needed when video is muted, while with 1.20.2 it is needed in any case (13.1.3 Safari) - keep using old videoplayer.xml with 1.20.2 as of now and it's just fine.

    regards,
    Granton

    Edited 2 times, last by granton (October 23, 2019 at 10:52 AM).

  • If I may piggyback on this topic.

    I have an app that uses a WKWebView to display the panorama. If I open the Panorama on my iOS 13.2.2 device in mobile Safari, the gyro works just as expected (after tapping the button to allow the requested DeviceMotion data).

    However, if I open the same URL in my WKWebView inside my own app, the gyro isn't available.

    I've tried everything from proper SSL certificates to location permissions on the main app itself, I just can't get the gyro to even be available when used within the app. Again, with Safari everything works, so I think it's fair to exclude SSL etc. as issues.

    The DeviceMotionEvent.requestPermission() event returns that permissions have been granted.

    Any ideas? We have the PRO version (1.20.2) and our interactive is down because of this issue.

    Thanks,

    Peter

  • Can anyone confirm that this fix requires a button click or user interaction to trigger the request permission dialog?

    We've got a few projects that are running on an iPad specifically for the gyro control so I was enabling it automatically at startup. I'm now attempting to trigger the permission dialog at startup and I can't seem to get it to fire without linking it to a button. Works fine on a button click (yes, https).

    Is there an undocumented function call we can make to the new gyro plugin that will request permission?

    Thanks,
    bhh

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!