-
Hi, I am new to this so apologies for the very basic question. But I am trying to make a message pop up for when a device isn't compatible with AR so therefore the button doesn't show. I am following the example from here, but am getting an error in the web console:
This is the code snippet where thats causing the error: document.querySelector("#model-viewer").addEventListener('ar-status', (event) => {
if(event.detail.status === 'failed'){
const error = document.querySelector("#error");
error.classList.remove('hide');
error.addEventListener('transitionend',(event) => {
error.classList.add('hide');
});
}
}); From looking at model-viewer.js, I believe these events no longer exist, but due to my limited knowledge of javascript, I'm not sure how to proceed and fix it. Any help would be massively appreciated and can provide anymore useful details if needed. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
I think this error appears when you start an AR session on a device where AR is not supported. Did you maybe change model-viewer components id? Since its searching for id "model-viewer". |
Beta Was this translation helpful? Give feedback.
Just to update this, I figured out a solid way of getting a AR not supported message to appear every time the AR button does not.
EDIT: need to add an event listener on if the button is clicked, as otherwise when the ar button turns itself off to view in AR, the error will come on.