-
Notifications
You must be signed in to change notification settings - Fork 86
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
DeviceOrientationEvent.requestPermission() #161
Comments
It seems that the |
The src/devices/WebVRDevice wraps native WebVR 1.1 implementations, and src/devices/CardboardXRDevice uses the rendering polyfill, cardboard-vr-display -- confusing, I know. There's an open issue for permission change request for iOS there that's related to this. I don't have an iOS device to test this FWIW |
Hello,
In order to make this plugin work on iOS, you need to ask user permission for device orientation capture.
To do that, we need to insert the following code in the requestSession action.
navigator.xr.requestSession('immersive-vr', {
requiredFeatures: thisXRMananger.gameModule.WebXR.Settings.VRRequiredReferenceSpace,
optionalFeatures: thisXRMananger.gameModule.WebXR.Settings.VROptionalFeatures
}).then(async (session) => {
if (typeof(DeviceOrientationEvent) !== "undefined" && typeof(DeviceOrientationEvent).requestPermission === 'function')
{
DeviceOrientationEvent.requestPermission()
.then(response => {
if (response === 'granted') {
session.isImmersive = true;
session.isInSession = true;
session.isAR = false;
thisXRMananger.xrSession = session;
thisXRMananger.onSessionStarted(session);
}
}).catch(function (error) {
thisXRMananger.BrowserObject.resumeAsyncCallbacks();
thisXRMananger.BrowserObject.mainLoop.resume();
});
} else {
session.isImmersive = true;
session.isInSession = true;
session.isAR = false;
thisXRMananger.xrSession = session;
thisXRMananger.onSessionStarted(session);
}
});
The text was updated successfully, but these errors were encountered: