javascript - CreateJS - Type not recognized error thrown during sound registration -
i trying load sounds through soundjs sound registration, , getting following error:
createjs.js:15 uncaught error: type not recognized.
i figure soundjs library having issues either locating files or having trouble file extensions, using .ogg, inline examples i've seen.
here code:
createjs.sound.alternateextensions = ["mp3", "ogg"]; createjs.sound.on("fileload", function(event) { console.log(event); }, this); (var = 0; < soundmanifest.length; i++) { soundmanifest[i].loaded = false; console.log("loading " + soundmanifest[i].src); createjs.sound.registersound(soundmanifest[i].src, soundmanifest[i].id) }
soundmanifest array of objects source item giving path .ogg files, , id. i've double , triple checked path names, pretty sure that's not it. ideas? developing on chrome.
thanks posting github link. helpful. fortunately, have super simple answer you.
rename "object" class made in main.js, , should go.
-- long answer --
i tossed breakpoint error thrown, , showed when soundjs tries create loaditem, fails. because should treating loaditem receives object, line below failing:
} else if (value instanceof object && value.src) { // code should executed }
at first thought there bug in soundjs had somehow missed in last 2 years, closer inspection showed object prototypes in application messed up. if open any browser window, , hit console, return true
:
({}) instanceof object // true
however while running app, returns false
.
the issue became clear when removed other classes other createjs , main, , tried this:
new object(); // throws error includes info "victor"
in main.js, defining "object" class, extends createjs shape. global because there no method closure around code, overwrites global object class/prototype.
the reason included explanation, because couldn't figure out going on until had steps show prototypes broken in app written out before reason dawned on me. thought might of interest :)
Comments
Post a Comment