So I've this warning on my console. I read the documentation : https://developers.google.com/web/updates/2017/09/autoplay-policy-changes
I did everything as they said but I still have this warning. Here's my code :
let context;
window.onload = function() {
context = new AudioContext();
...
}
// click event
document.addEventListener('click', function (e) {
if (e.target.closest('.play1')) {
context.resume().then(() => {
source.start(0);
});
}
})
The warning text is about this line : context = new AudioContext();
Does anyone see what I'm missing ? Thank you very much