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

Open AR screen with script without clicked button #177

Open
Azeem00786 opened this issue Jan 17, 2024 · 2 comments
Open

Open AR screen with script without clicked button #177

Azeem00786 opened this issue Jan 17, 2024 · 2 comments

Comments

@Azeem00786
Copy link

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.

@herrpedro
Copy link

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

@AdaRoseCannon
Copy link
Member

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.

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

3 participants