1
Audio in JS not working
neodymium (27)

I'm trying to play audio by doing this:

var audio = new Audio("sound.mp3");
audio.play();

I am getting a little click on my speakers but the sound is not playing. Is there another way of doing this?

You are viewing a single comment. View All
1
locness3 (0)

@neodymium Make sure your browser doesn't block audio autoplay, I allowed it and it worked for me. Also check the console.