javascript - IE 9 and 10 yield unexpected and inconsistent MediaError's -
we have set of html blocks -- around 50 of them -- iteratively parsed , have audio
objects dynamically added:
var someaudiowrapper = function(name) { this.internal_player = new audio(); this.internal_player.src = this.determinesrcfromname(name); // mp3 this.play = function() { if (someotherconditionsaremet()) { this.internal_player.play(); } } }
suppose generate 40 80 of these on page load, same set particular configuration. in browsers tested, basic strategy appears work. audio load , play successfully.
in ie's 9 , 10, transient bug surfaces. on occasion, calling .play()
on inner audio
object fails. upon inspection, inner audio
object has .error.code
of 4
(media_err_src_not_supported). file's .duration
shows nan
.
however, happens occasionally, , random subset of audio files. e.g., usually file_abc.mp3
plays, generates error. network monitor shows successful download in either case. , attempting reload file via console fails -- , no requests appears in ie's network monitor:
var = new audio(); a.src = "the_broken_file.mp3"; a.play(); // fails a.error.code; // 4
even appending query value fails refetch audio or trigger network requests:
var = new audio(); a.src = "the_broken_file.mp3?v=12345"; a.play(); // fails a.error.code; // 4
however, attempting load broken audio file in new tab using same code works: "unsupported src" plays perfectly.
are there resource limits hitting? (maybe "unsupported" audio finishes downloading late?) there known bugs? workarounds?
i think can pretty detect when file fails. other compatibility reasons run loop check audio progress , completion stats prevent progression through app (an assessment) until audio complete. .error
values -- if find one, it!?
addendum: found related question (ie 9/10/11 sound file limit) suggests there's undocumented limit of 41 -- not sure whether that's limit of "41 requests audio files", "41 in-memory audio objects", or what. have yet find m$ documentation on matter -- or known solutions.
have seen these pages on audio file limits within ie? these specific sound.js, information may applicable issue:
https://github.com/createjs/soundjs/issues/40 ...
possible solution mentioned in last comment: "control maximum number of audio tags depending on platform , reuse these instead of recreating them"
additional info: http://community.createjs.com/kb/faq/soundjs-faq (see section entitled “i load lot of sounds, why running errors in internet explorer?”)
Comments
Post a Comment