HTML5 Audio can’t play through Javascript unless triggered manually once

Well, for my purposes, here’s what I did:

Luckily, before the user can trigger the behavior to start audio, they have to click a button. I set the volume of the element to 0.0, and have it “play” when they click this button.

After the sound is played silently, I simply set the volume property back to 1.0, and it plays without user intervention just fine.

Leave a Comment