+ 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

22nd Apr 2020, 5:49 AM
Cmurio
Cmurio - avatar
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
18th Aug 2021, 11:56 PM
David Ordás
David Ordás - avatar
+ 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
23rd Apr 2020, 7:40 AM
Farino
0
u can use <audio> if possible
22nd Apr 2020, 11:56 AM
Param Dudhe
Param Dudhe - avatar