Last active
June 28, 2019 06:00
-
-
Save seunggabi/d939d8b659acc6cc68849857856bd772 to your computer and use it in GitHub Desktop.
Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.__autoPlay = setInterval(() => { | |
this.playTracks(); | |
}, 500); | |
const promise = new Audio('/temp.mp3').play(); | |
if (promise !== undefined) { | |
promise.then(() => { | |
window.__autoPlay && clearInterval(window.__autoPlay); | |
}).catch(() => {}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
additional...
clearInterval
in play after callback