google / model-viewer

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

activateAR in chrome not working #1176

Closed vargavd closed 3 years ago

vargavd commented 4 years ago

In the "Load" event hander, I am trying to call activateAR on mobile. It is working in Firefox and in Safari, but not in Chrome. Maybe it is not a bug, it is the intended working on Chrome, due to the limitation to the browser to not imitate user interaction. Can you clarify on this?

Example

Code:

<script type="module" src="..model-viewer.js"></script>
 <model-viewer id="model-viewer" src="..Delonghi-machine.glb" ios-src="..Delonghi-machine.usdz" alt="Machine" auto-rotate camera-controls ar magic-leap>
        <button id="mv-ar-button" slot="ar-button" style="...">View in your space</button>
 /model-viewer>

...
<script>
var modelViewer = document.getElementById('model-viewer');
modelViewer.addEventListener('load', function () { 
    modelViewer.activateAR(); 
});
</script>
elalish commented 4 years ago

Does this comment help? Does it work better if you put webxr ahead of scene-viewer in ar-modes?