force autoplay on audio player

Asked

Viewed 410 times

1

with the new Chrome update function autoplay audio does not work, would like to know how to force autoplay, already tried so:

document.getElementById("controles").setAttribute('autoplay', true);

Thus:

$("#controles")[0].autoplay = true; 

And so:

var controles = document.getElementById("controles");

function enableAutoplay() { 
    controles.autoplay = true;
    controles.load();
}

And no way it worked, anyone knows why?

  • What is the html markup of this player ?

  • @Atila Silva <audio src="kalimba.mp3" autoplay id="controles"></audio>

  • The attribute autoplay right in the tag didn’t work ? You’re testing on desktop or mobile ?

  • @Isac didn’t work at all, I’m testing on desktop

  • Put the way you have the html to understand if the mistake comes from

  • I don’t understand what you mean

  • The archive kalimba.mp3 that you are trying to load exists ? It is in the same folder as the html file ? It works in other browsers ? The html specified by you <audio src="kalimba.mp3" autoplay id="controles"></audio> works without even requiring javascript, so the problem comes from something else

  • actually, where ta music kalimpa.mp3 in place will a streaming, yes in other browsers work, it does not only work with the autoplay so I had to force it, even though it’s not playing, and streaming problem is not, because it touches other browsers, except on Chrome

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.