PDA

View Full Version : How can I let music play in the background of my website?



pavani25
04-15-2020, 03:51 AM
See the following code and give your suggestion

<body>
<audio id="audioFile" width="100%" height="auto" autoplay controls>
<source src="wonderland.mp3" type="audio/mp3">
</audio>

<script>

var audio = document.getElementById('audioFile');
audio.controls = false;

</script>
I don't need any control, it should play automatically.

<audio autoplay>
<source src="wonderland.mp3" type="audio/mpeg"> /
Your browser does not support the audio element.
</audio>

shaili shah
04-16-2020, 02:46 AM
You can do that with the <embed> tag of html.

<embed src="" loop="true" autostart="true" width="" height="" />

I hope this will help.

digitalludhiana
04-16-2020, 04:45 AM
<audio autoplay="true"><source src="audio.mp3"></source></audio>

try this code it will work. as it worked for me.