I’m experiencing issues with AR.js when trying to use NFT markers on my GitHub page. The project runs perfectly on my local machine, but once uploaded, ar-nft.js returns a 404 error. I attempted to use an alternative link for ar-nft.js; however, the problem persists. It seems like the server is unable to locate the NFT data files. Can someone suggest a solution?
Here’s a simplified version of the code I’m using:
<!DOCTYPE html>
<html>
<head>
<script src="arjs-lib.js"></script>
<script src="three-lib.js"></script>
</head>
<body>
<script>
function setupAR() {
const scene = new THREE.Scene();
const camera = new THREE.Camera();
const renderer = new THREE.WebGLRenderer({ alpha: true });
const arSource = new ARToolkitSource({ sourceType: 'webcam' });
const arContext = new ARToolkitContext({
cameraParametersUrl: 'camera_data.dat',
detectionMode: 'color'
});
const markerRoot = new THREE.Group();
scene.add(markerRoot);
const markerControl = new ARMarkerControls(arContext, markerRoot, {
type: 'nft',
descriptorsUrl: 'my-nft-marker',
smooth: true
});
// Load 3D model and add to scene
loadModel('mymodel.glb', (model) => {
markerRoot.add(model);
});
function animate() {
requestAnimationFrame(animate);
arContext.update(arSource.domElement);
renderer.render(scene, camera);
}
animate();
}
setupAR();
</script>
</body>
</html>
Any ideas on resolving the NFT marker issue on the server?