Can I play music on the background of the site??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can I play music on the background of the site???

I want to do a code that it sounds music from background and it can be autoplay. Pls tell me if its possible

23rd Feb 2021, 2:15 PM
JustSteve
3 Answers
0
JustSteve I downloaded that song and used Dropbox to upload it. https://code.sololearn.com/WW6t4B73kJVz/?ref=app https://code.sololearn.com/WT3661NHpV3B/?ref=app Maybe this helps :) Btw yes, you need an event, but it's quite easy, you can use a sweet alert, so we click automatically the screen. https://code.sololearn.com/W61pGgtsXa18/?ref=app Hope it helps & all the best :)
23rd Feb 2021, 6:45 PM
Matthew
Matthew - avatar
+ 3
Hey there JustSteve , Yes it is possible, just i found this solution because without a click or a response the code can't play the music because of a security console error. Hope you understand how it works with this example :) https://code.sololearn.com/WgnTlvLYaWX7/?ref=app
23rd Feb 2021, 2:19 PM
Matthew
Matthew - avatar
+ 1
So if i just put to play music when you just start the webpage, it wont work ? I need an event to play the music, like if you click on the screen, I will hear music? I've visited your code Major and I dont understand how did you get the link of that music? Please tell me I have a extremly ideea for a beautiful code...
23rd Feb 2021, 3:53 PM
JustSteve