Hello,
You can do that after some user interaction - this is a browser security measure. Just like with audio the browser requires the user to interact with the website (e.g. by clicking a button or clicking somewhere on the website) before it can music or before a web AR session can start.
What you can do is create a simple website with just a button that says “Start the experience” (or something similar) and then immediately start a Needle Engine webxr (AR) session.
Here’s an example on Stackblitz for reference (not that you might need to copy the main.ts code into your own file and relevant sections from index.html and then open the localhost URL on your phone or AR capable device)
Needle Engine: Start AR automatically - StackBlitz
This is the relevant code that you can add to your project (checkout the main.ts file)
import { NeedleXRSession } from "@needle-tools/engine"
window.addEventListener('pointerdown', () => {
if (!NeedleXRSession.active) NeedleXRSession.start('ar');
});