i need to load near 20 sounds on my page. i thought maybe i need to load only 2 element separately so that's why you will see inProgress property
loadAudio: function () { if (this.inProgress <= 1) { this.inProgress++; var elem = this.audioQueue.pop(); if (elem != null) { var path = elem.Path + elem.Fileid + ((this.canPlayMp3) ? '.mp3' : '.wav'); audio = new Audio(); audio.src = "http://localhost:55578/~/x.mp3"; audio.addEventListener('loadedmetadata', function (e) { AudioPlayer.audioLoaded(e); }, false); //audio.addEventListener('loadeddata', function (e) { AudioPlayer.audioLoaded(e); }, false); audio.addEventListener('error', function (e) { AudioPlayer.audioLoaded(e); }, false); if (elem.AudioType == AudioPlayerTypes.Keyboard) { this.keyboardAudio[elem.Id] = audio; } } } audioLoaded: function (e) { var t = e.target; if (e.type == "error") { var code = e.target.error.code; console.log("error" + t.currentSrc + e.target.error.code); } else { console.log("loaded" + t.currentSrc); } this.inProgress--; this.loadAudio(); } As you can see i am loading the same sound just for test but the same problem after 6 audio i got error
LOG: loadedhttp://localhost:55578/~/x.mp3 LOG: loadedhttp://localhost:55578/~/x.mp3 LOG: loadedhttp://localhost:55578/~/x.mp3 LOG: loadedhttp://localhost:55578/~/x.mp3 LOG: loadedhttp://localhost:55578/~/x.mp3 LOG: loadedhttp://localhost:55578/~/x.mp3 LOG: errorhttp://localhost:55578/~/x.mp3 (4 - is error code) it works pretty cool in Chrome, Firefox but not in IE. I cant find any limitations, and solutions.
Also additional question: I read that some times is better avoid DOM elements so thats why i am workin with audio object because i need to play different elements lots of times.