model-viewer: WebXR does not work from inside iFrame
Description
This is a follow-up to an earlier discussion on Spectrum.
When using model-viewer inside an iFrame, WebXR mode just outputs a black screen. There’s a brief split-second moment when a camera image is shown on a tiny slice of the screen, but afterwards it just turns black. The request to allow a WebXR session pops up properly if done for the first time.
The iFrame has allow="xr"
, but that doesn’t change the outcome.
Edit: I also found https://github.com/immersive-web/webxr/issues/25#issuecomment-549959055, but allow="xr-spatial-tracking"
exhbits exactly the same behaviour.
Live Demo
Open this page in Chrome on Android (I have removed the repro page for now since the bug has been accepted as bug - I’ll happily test again once resolved) Click the “View in AR” button (the page isn’t very responsive, you might have to turn to landscape mode) Expected: AR model Actual: black screen
Browser Affected
- Chrome
- Edge
- Firefox
- Helios
- IE
- Safari
OS
- Android
- iOS
- Linux
- MacOS
- Windows
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (7 by maintainers)
Great, I’m closing as fixed in Chrome 86, but feel free to reply if you notice any further problems.
I’m still investigating, but it appears that the WebXR DOM Overlay feature doesn’t currently work when used within an iframe. I filed https://bugs.chromium.org/p/chromium/issues/detail?id=1101193 to follow up on the Chrome side.
In the meantime, is there a way to disable use of DOM Overlay in model-viewer as a workaround?
I know this is closed already. But just wanted to confirm, in my testing, ModelViewer / WebXR is working great when served from iFrame. The lingering issue I mentioned above was due to the fact I wasn’t listening for
beforexrselect
event to prevent DOM interactions causing unwanted interaction with WebXR. So it’s all good now.Thanks, I have a repro and some strange console errors; I’ll look into it.