I'm building a jquery/html5 audio player and I have some problems on changing the source to the audio tag. The method I've implemented works on all browsers except IE9.
Here is a sample of code:
audio = $("<audio>").attr("id", "audioElement")
.attr("preload", "auto")
.appendTo(player);
function addMp3Source(sourceUrl) {
audio.empty();
var newSrc = $("<source>").attr("src", config.tracksURL + sourceUrl).appendTo(audio);
}
On IE9, the source is changing, but when I'm playing the track, it's the old sound that plays. On other browsers works fine.
Any ideeas?
<audio>you should use.remove()and$('<audio/>');to create a new element audio, that way u loose trace of the old element, :)