Reputation: 197
My code worked in the morning. I made a few changes and it stopped working. I ran the code reverted to the earlier version and it also stopped working with the following warning in the debug console of visual studio code:
A-Frame:error This HTML file is currently being served via the file:// protocol. Assets, textures, and models WILL NOT WORK due to cross-origin policy! Please use a local or hosted server: https://aframe.io/docs/0.5.0/introduction/getting-started.html#using-a-local-server.
aframe.io/releases/1.2.0/aframe.min.js:23
A-Frame Version: 1.2.0 (Date 2021-02-05, Commit #b220fa00)
aframe.io/releases/1.2.0/aframe.min.js:2682
THREE Version (https://github.com/supermedium/three.js): ^0.125.1
aframe.io/releases/1.2.0/aframe.min.js:2682
WebVR Polyfill Version: ^0.10.12
aframe.io/releases/1.2.0/aframe.min.js:2682
Uncaught Event
core:a-assets:warn Asset loading timed out in 3000 ms
releases/1.2.0/node_modules/debug/browser.js:111
This is the error in the browser console:
I can't figure out why it is not working. I have also used crossorigion=null
Here's the complete code:
<html>
<head>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/donmccurdy/[email protected]/dist/aframe-extras.min.js"></script>
</head>
<body>
<a-scene>
<!-- Asset Management System -->
<a-assets>
<img id="space" src="space.jpg" crossorigin=null>
<a-asset-item id="spaceship" response-type="arraybuffer" src="spaceship.glb" ></a-asset-item>
</a-assets>
<!-- Sky -->
<a-sky src="#space"></a-sky>
<!-- Spaceship -->
<a-entity gltf-model="#spaceship" scale="0.1 0.1 0.1" animation-mixer="clip: CubeAction; loop: infinite" visible="" position="0 1.096 0" rotation="65.1693655337701 179.9998479605043 0"></a-entity>
<!-- Camera -->
<a-camera position="0 3.0 0" ></a-camera>
</a-scene>
</body>
</html>
Upvotes: 1
Views: 1158
Reputation: 1
In my case, Coding in VSCode
Holp this helps :)
Upvotes: 0
Reputation: 197
My problem was that I wasn't using CORS in write manner. My files in the project are exposed at with extentions "C:/" whereasa cross orgion response request supports only https and remaining other mentioned in screenshot. It can be big problem to security therefore in order to avoid it make a server.
https://stackoverflow.com/a/33801287/16972919
Upvotes: 1