I want create a html5 audio in dynamic and play it,here is the code:
function playAnotherMusic(playUrl){
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', playUrl);
audioElement.setAttribute('controls', true);
audioElement.setAttribute('preload', true);
audioElement.setAttribute('type', 'audio/mpeg');
audioElement.addEventListener("load", function() {
audioElement.play();
}, true);
console.log(playUrl);
audioElement.load();
}
However it doesn't work,the firebug assigin me "HTTP "Content-Type" of "audio/mpeg" is not supported.
"
how can I solve this problem?