google / model-viewer

Easily display interactive 3D models on the web and in AR!
https://modelviewer.dev
Apache License 2.0
6.88k stars 816 forks source link

WebXR mode does not time out when it fails #4765

Open petr-hajek opened 5 months ago

petr-hajek commented 5 months ago

Description

  1. Go to https://modelviewer.dev/ with affected device
  2. click the AR button for the default model
  3. Console logs: Attempting to present in AR with WebXR...
  4. Nothing happens. It never times out to try the SceneViewer. Clicking the AR button again does not do anything. When tested with SceneViewer as a first option it works. Expected: Underlying issue is related to Samsung (or Chrome), but it should still fail gracefully and try SceneViewer in case there's some issue with WebXR. Problem will be somehwere here, that this await never times out: https://github.com/google/model-viewer/blob/4a313508895ebac912e95d81f0c6f972dcaba2ad/packages/model-viewer/src/features/ar.ts#L278

Live Demo

https://modelviewer.dev/

Version

Browser Affected

OS

AR

elalish commented 5 months ago

@bialpio @toji This looks like a WebXR regression; can you repro?

toji commented 5 months ago

At the moment I only have Pixel devices on hand, but I can confirm that the Pixel 6, 7, and 8 are not seeing this regression on Android 14, so it's likely something to do with the Samsung software like @petr-hajek theorized.

That said, there's a few different places in the ARRenderer that the await could be getting hung up on, and it would be helpful to know which is was. Some would be more practical to put timeout logic around than others.

rAF: https://github.com/google/model-viewer/blob/4a313508895ebac912e95d81f0c6f972dcaba2ad/packages/model-viewer/src/three-components/ARRenderer.ts#L186

Session: https://github.com/google/model-viewer/blob/4a313508895ebac912e95d81f0c6f972dcaba2ad/packages/model-viewer/src/three-components/ARRenderer.ts#L207

Reference Space: https://github.com/google/model-viewer/blob/4a313508895ebac912e95d81f0c6f972dcaba2ad/packages/model-viewer/src/three-components/ARRenderer.ts#L219

alcooper91 commented 5 months ago

Can you also provide the full chrome://version string including the bitness of Chrome? (32 vs 64)?

petr-hajek commented 4 months ago

@alcooper91 Chrome: 124.0.6367.113 (Official Build) (64-bit)