+ 6
How can I put background music
I want to listen to music without the need to press a button or an item https://code.sololearn.com/WfdJ33wTlust/?ref=app
3 ответов
+ 2
Autoplay is not possible due to modern browsers policies (similar to micro and cam). In iframes is more restrictive.
but is always possible control using HTMLMediaElement DOM interface
https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
+ 1
Actually using JavaScript like this must be worked:
window.onload = function(){
audio.play()
}
But Console not let the script playing an audio without user Gesture
0
u can use <audio> if possible