webxr-samples icon indicating copy to clipboard operation
webxr-samples copied to clipboard

Open AR screen with script without clicked button

Open Azeem00786 opened this issue 1 year ago • 2 comments

Hii there, i want to open AR screen automatic on DOMContentLoaded for which i am using document.addEventListener("DOMContentLoaded", function () { setTimeout(() => xrButton.__onXRButtonClick(), 2000); }); this is working fine on desktop browser but when i am testing the same thing in my phone browser it is not working. we are getting this error in console- XRSession creation failed: Failed to execute 'requestSession' on 'XRSystem': The requested session requires user activation. image

while on click button manually on same device with same browser it is working.

Azeem00786 avatar Jan 17 '24 06:01 Azeem00786

It is a mobile limitation that prevents full screen, camera access and things like that without user consent/click/activation There are several discussions online about it and maybe some workarounds that i haven't explored

herrpedro avatar May 20 '24 14:05 herrpedro

This should not work on desktop, which browser is it? WebXR requires a user interaction with the page to start, this is an intentional restriction.

AdaRoseCannon avatar May 20 '24 14:05 AdaRoseCannon