I am getting this error in the console everytime I try to play a song when my timer is up. How can I do to solve it?
DOMException { code: 0, name: "NotAllowedError", message: "play() can only be initiated by a user gesture.", INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, … }
if (time < 0) { clearInterval(interval); text.innerHTML = 'Time is up!'; let audio = new Audio('Download/Homer Simpson Woohoo Sound FX.mp3'); audio.play(); }
if (time < 0) { clearInterval(interval); text.innerHTML = 'Time is up!'; let audio = new Audio('Download/Homer Simpson Woohoo Sound FX.mp3'); audio.play(); }