I have this function:
function audioPlayer(band, album, track) {
var audio = new Audio; //Class\
audio.src = 'music/' + band + '/' + album + '/' + track + '.mp3';
audio.play();
}
It will play the song that is clicked. But when another song is clicked I'll hear both songs play.
I have tried multiple suggestions already but none of them seem to work for me. I have tried:
- How to stop one audio player from playing when I click another - javascript
- HTML5 Audio stop function
- http://msdn.microsoft.com/en-us/library/ie/gg589489(v=vs.85).aspx
- http://www.binarytides.com/stop-function-html5-audio-element/
I don't use the html5 <audio>
tag only JavaScript / jQuery.
Is there a way to make the first song stop and than just play the other?
If you need more information please let me know. Thanks in advance