0
How to add background-music in html?
I tried using embed tag and bgsource tag it won't work.tell me your opinion through a example so that I would understand it properly?
8 Respostas
+ 3
Create a variable in javascript using new Audio() like this
song = new Audio();
song.src="https://dl.dropbox.com/s/9thwwlf5qcl7k8s/Alan%20Walker%20-%20Faded.mp3?raw=0";
here i have used faded song
Then in html section
use this in body tag
<body onclick="song.play()">
So when someone clicks any where in output song starts playing due to onclick event attribute.
+ 3
Click the screen and the audio will be played
https://code.sololearn.com/WfCR2cDMdj94/?ref=app
+ 2
https://code.sololearn.com/WqlJtZNss9UW/?ref=app
Here is my code that may help you to insert a background music.
+ 1
Thank you bro(Akshay Panwar) for help.
0
Your most welcome shubham kumar
0
https://code.sololearn.com/WplL4058t0hT/?ref=app