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

Getting "magic window" mode to trigger on Android tablets is difficult OR impossible. #4798

Closed
PlumCantaloupe opened this issue Feb 17, 2021 · 9 comments

Comments

@PlumCantaloupe
Copy link

PlumCantaloupe commented Feb 17, 2021

I am huge fan of the vastly underrated "magic window" mode that WebXR/A-Frame allows for mobile devices (and my initial research suggests that many others agree with me), but I have found that when using an Android tablet running Chrome A-Frame cannot get access to the accelerometers/gyrometers, even in "mobile site" mode. Switching to request "desktop site" or "request mobile site" both create the same modal pictured below on Android Chrome.

However one can use Firefox on Android and "request mobile device" to access the magic window, but unfortunately Firefox is very slow. On an iPad one can use either Safari, Firefox, or Chrome and "request mobile site" and it works; but having to find the "request mobile site" feature makes for a terrible user experience.

  • Assuming this isn't an A-Frame bug, can we force the mobile site to load somehow to make this easier for WebXR users to use magic window mode?
  • If on Android Chrome, this is a bug with their mobile site request is a there a workaround to forcing device access?

Thank you. Looking forward to some discussion on this.

IMG_3743

  • A-Frame Version: current
  • Platform / Device: Android Tablet running Chrome (don't have an Android phone to test)
  • Reproducible Code Snippet or URL: Aframe.io examples :)
@dmarcos
Copy link
Member

dmarcos commented Feb 18, 2021

Unfortunately most tablets today default to desktop mode and websites cannot override that setting. Only the user can change it and hence the need of the prompt on the A-Frame side. On desktop mode mobile browsers don't have the devicemotion API enabled that it's necessary for magic window mode. Not sure why some Android tablets have also devicemotion API disabled in mobile mode. It looks like an overlook or a bug on the browser side.

@PlumCantaloupe
Copy link
Author

Thanks for the response. This is tricky as it appears to affect all browsers built from Chromium i.e., Samsung browser. I’ll keep poking around. I am sorry to poke, but any suggestions @donmccurdy?

@PlumCantaloupe
Copy link
Author

PlumCantaloupe commented Feb 18, 2021

Okay, some progress. I will look at creating a PR in a bit but it seems the problem lies with A-Frame asking if a tablet "isMobile" in look-controls.js and is asking for "DeviceOrientationEvent.requestPermission()" in device-orientation-permission-ui.js which doesn't seem to exist on Chrome. Chrome just allows generic-sensors in either desktop or "mobile" mode (which is interesting).

If I just comment out all these checks it magic window works again so I'll poke around and suggest a more inclusive way to test for Android Chrome tablet ... ttyl

@dmarcos
Copy link
Member

dmarcos commented Feb 18, 2021

DeviceOrientationEvent should be supported as per can i use. I agree that the situation is a bit confusing.

@PlumCantaloupe
Copy link
Author

Yeah, sorry if I wasn’t clear. DeviceOrientationEvent definitely exists and allows Chrome Android to use magic window controls if we remove the isMobile and requestPermission check and promise (just quickly hacked a master fork to do this to confirm). It just appears the specific function of requestPermission() does not appear to work the same on iOS on Android, but I’ll do some more research ...

@dmarcos
Copy link
Member

dmarcos commented Feb 19, 2021

Thanks for the investigation. Much appreciated

@PlumCantaloupe
Copy link
Author

PlumCantaloupe commented Feb 19, 2021

One thing I am interesting in getting opinions about is whether it is even necessary to check if something "isMobile" or "isTablet" or "isDesktop" before checking for features such as DeviceOrientationEvent?

I understand isHeadsetConnected() but not this as much. I ask only because it is part of the problem in this case, and it appears that DeviceOrientationEvent exists and works on both mobile and desktop "site modes" anyhow (for both an iOS phone and Android tablet I have tried on) ...

Thoughts?

@PlumCantaloupe
Copy link
Author

Okay, just submitted a simple PR #4803 to fix this issue with minimal code change. I mention it there and in the previous comment here that perhaps we should skip the isMobile checks and just ask for the DeviceOrientationEvent. If it exists, it will show up in both Desktop and Mobile site mode, so might save users an extra step of finding "request mobile site" on their browser of choice.

@PlumCantaloupe PlumCantaloupe changed the title Getting "magic window" mode to trigger on tablets is difficult OR impossible. Getting "magic window" mode to trigger on Android tablets is difficult OR impossible. Feb 19, 2021
@cameronValtech
Copy link

We have a Galaxy Tab S7 on-hand and ran into this same error/dialog box. My PR (linked right there ^ ) will add to the resolution.

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