HOW TO ADD A BACKGROUND AUDIO??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

HOW TO ADD A BACKGROUND AUDIO???

how can I add a background audio to my webpage that should play automatically and loop without any controls. Does CHROME support autoplay?? https://www.dropbox.com/s/t5ji42eotis93f6/desi%20spiderman%20official%20song%20-%20SPIDERMAN%20SPOOF.mp3 can you give an example how to add this song to a web page.

4th Nov 2019, 6:56 AM
Rajneesh Kumar
Rajneesh Kumar - avatar
5 Answers
4th Nov 2019, 1:28 PM
Jônatas Araripe
Jônatas Araripe - avatar
+ 1
Most browsers block autoplay. You’re better off requiring a click to start or whatever.
5th Nov 2019, 12:58 AM
Rora
+ 1
Rora can it be played by clicking any where in the screen ??How???
5th Nov 2019, 2:48 AM
Rajneesh Kumar
Rajneesh Kumar - avatar
+ 1
you can use the play() function of the audio in an onclick handler I think
5th Nov 2019, 12:04 PM
Rora
+ 1
Rora can you give an example
5th Nov 2019, 12:41 PM
Rajneesh Kumar
Rajneesh Kumar - avatar