Autoplay Audio in Loop

i am looking for autoplay an audio in loop without getting blocked by browser.

Code :

<audio id="audio1" src="assest/sound/1.mp3" autoplay="" />
      <script>
         a = document.getElementById('audio1');
         
         a.onended = function(){setTimeout("a.play()", 1000)}
      </script>

My current code working on firefox but in default it is blocked, i have to allow autoplay manually so it can play the audio and in other side in chrome the audio is not even playing.

Any solution for this?