how to play a music whenever the home/any page is opened
Download code form Play WAV sound files in ASP.Net using JavaScript
And make following change
<script type="text/javascript"> var soundObject = null; function PlaySound() { if (soundObject != null) { document.body.removeChild(soundObject); soundObject.removed = true; soundObject = null; } soundObject = document.createElement("embed"); soundObject.setAttribute("src", "sounds/sound.wav"); soundObject.setAttribute("hidden", true); soundObject.setAttribute("autostart", true); document.body.appendChild(soundObject); } window.onload = PlaySound; </script>
is it possible to upload music file into database and retrieve file from db and play
With the above approach no. You will have to use some media player instead but that won't be background music.
I would suggest keep file path in database and then based on that path load the file
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.