I have encountered a slight issue on the website I am building. The problem is that the audio plays fine on the home page just like I want it to but when I navigate to other pages on my website then go back to the homepage, there seems to be TWO audio files playing. Here is my code so far for having the background audio on the home page.
<source src="audio/sound.mp3" type = "audio/mpeg">
Your browser doesn't support audio
Give this a shot! It just stops, resets, and plays the audio when you land on the page. Make sure to give the audio file a corresponding ID.
var mySong = document.getElementById("mySong"); mySong.pause(); mySong.currentTime = 0; mySong.play();