Audio not playing in HTML using <script> tag

I’m trying to get an audio file to play in the background and it isn’t working, any insight on it?

        <audio id="bgmusic" preload hidden loop src="music.mp3"></audio>
         function Play() {
         var $audio = $('#bgmusic');

Where/how are you calling Play()?

The audio will likely get blocked because of no user interaction (check the console, F12). But it still depends on the browser I think.

We have a guide article on this.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.