pmndrs / xr

🤳 VR/AR for react-three-fiber
https://pmndrs.github.io/xr/docs/
Other
2.14k stars 155 forks source link

Click ARButton on Android and the camera don´t show up. #284

Closed AYTSistemas13 closed 2 months ago

AYTSistemas13 commented 1 year ago

When I click Enter AR on my phone the web page displays in all the screen but the camera don´t show up and in the browser appear the notification that my camera is in use. Also I tried the examples about webar in three.js site and here it works fine. My project it is in NEXT js, I have the emulator on my browser desktop and here works but on my phone doesn´t, it is omething about css styling?

dendrofen commented 11 months ago

same for me.

CodyJasonBennett commented 11 months ago

Are you doing anything out of the ordinary in your rendering pipeline like post-processing or have texture use? Unless this is a trivial setup, I'd need to see an example. Note that camera-access currently corrupts three.js' texture state (https://github.com/mrdoob/three.js/issues/26452), but AR shouldn't normally depend on that.

dendrofen commented 11 months ago

Okey, after some tests with android chrome, I have found out there are some warnings in debugger console. One of the warning messages - XR.js:200 Unrecognized feature requested: dom-overlay-for-handheld-ar

So I decided to append ARButton optionalFeatures with dom-overlay and this solution fix camera issue.

Following code fix issue for me:

<ARButton
     className="ar_button"
     sessionInit={{ optionalFeatures: [
          'local-floor', 
          'bounded-floor', 
          'hand-tracking', 
          'layers', 
          'dom-overlay'
     ] }}
/>
CodyJasonBennett commented 11 months ago

Fixed how? Optional features shouldn't change behavior unless they're supported. Only required features will block a request.

dendrofen commented 11 months ago

Well, without 'dom-overlay' feature pressing AR button leads to just fullscreen page, no AR camera, nothing just a fullscreen page. Adding 'dom-overlay' feature normalise AR button functional

dendrofen commented 11 months ago

@CodyJasonBennett Need to mention, despite the fact my solution fix camera issue it's also generates new warnings...))

image
MuhammadAakash commented 7 months ago

Same here from my side as well. Without the dom-overlay clicking on the AR Button just leads to the Full page and not opens up Camera. And by adding dom-overlay clicking on the AR Button is working fine.

bbohlender commented 2 months ago

dom overlay is now supported in 6.1 feel free to reopen if this issue reoccurs