Tengo un archivo HTML alojado en cPanel – https://ar.tiagoperes.eu/ar.html
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://aframe.io/releases/0.8.0/aframe.min.js"></script>
<script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.6.0/aframe/build/aframe-ar.js"></script>
<script>
AFRAME.registerComponent('foo', {
init: function() {
this.el.addEventListener("click", (e)=>{
console.log(e)
document.querySelector("a-animation").emit("buttonpressed")
})
}
})
</script>
</head>
<body style="margin : 0px; overflow: hidden;">
<a-scene embedded arjs="sourceType: webcam;">
<a-marker preset="hiro" cursor="rayOrigin: mouse">
<a-box position="0 0 0" scale="2 2 2" material="opacity: 0.5;" foo>
<a-animation begin="buttonpressed" dur="750" attribute="scale" to="2 4 4" direction="alternate"></a-animation>
</a-box>
</a-marker>
<a-camera-static/>
</a-scene>
</body>
</html>
Al abrirlo, podrá ver lo siguiente
Si pruebo colocar este archivo en un iFrame usando otro archivo HTML – https://ar.tiagoperes.eu/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello!</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Hi there!</h1>
<p>
I'm your cool new webpage. Made with <a href="https://glitch.com">Glitch</a>!
</p>
<iframe src="ar.html" width="300px" height="300px"></iframe>
<!-- include the Glitch button to show what the webpage is about and
to make it easier for folks to view source and remix -->
</body>
</html>
funciona como se esperaba
Cuando intento agregar el mismo iFrame en una publicación de WordPress usando
<iframe src="https://ar.tiagoperes.eu/ar.html" width="300px" height="300px"></iframe>
me sale el error
Error de la cámara web
Nombre: Error no permitido
Mensaje: El agente de usuario o la plataforma no permiten la solicitud en el contexto actual
y luego esto es lo que veo en la publicación: https://weblog.tiagoperes.eu/testing/
Probé agregando el iframe usando HTML de Elementor y elementos HTML personalizados y también usando el Editor de WordPress, pero en todas las opciones se mantuvo el mismo error. Probé esto usando Chrome y Firefox tanto en una computadora con Windows 10 como en un dispositivo Android. En todos los escenarios, el error persistió.
.