Answers for "Safari autoplay audio"

0

Safari autoplay audio

const soundEffect = new Audio();

// onClick of first interaction on page before I need the sounds
soundEffect.play();

// later on when you actually want to play a sound at any point without user interaction
soundEffect.src = 'path/to/file.mp3';
soundEffect.play();
Posted by: Guest on April-24-2020

Browse Popular Code Answers by Language