Closed xpol closed 6 years ago
This is an easy addition, but what was your steps to get into this situation? I would like to ensure the fix is tested properly.
ie, it is unclear if we should be splicing the current instance out of the array, or moving the line out of the if() so it deletes it once it has set the playbackResource on all audio sources.
Was fixed in a83ffe7e87af110cb45cc4814d80451db804ee3d
This still seems to be a problem in version 1.0.0: https://code.createjs.com/1.0.0/soundjs.js
This is closed, but did it ever make it into a version?
How do I use a version with this fix?
Confirming this fix never made it to the code in https://github.com/CreateJS/SoundJS/blob/master/lib/soundjs.min.js or https://code.createjs.com/1.0.0/soundjs.min.js The fix landed one month after the last publish date.
Our users are routinely observing this error (though I've never been able to recreate it myself):
TypeError: Cannot read properties of null (reading '1') SoundJS/soundjs.min.js 18:15312
Can the contents of /lib
be regenerated?
@curiousdustin One approach to get this code is to use a monkey patch. Just load the published version, then in your code add the following:
createjs.AbstractPlugin.prototype._handlePreloadComplete = function(e) {
var src = e.target.getItem().src;
var result = e.result;
var instances = this._soundInstances[src];
this._audioSources[src] = result;
if (instances != null && instances.length > 0) {
for (var i=0, l=instances.length; i<l; i++) {
instances[i].playbackResource = result;
}
}
this._soundInstances[src] = null;
};
The current code:
The line
this._soundInstances[src] = null;
will cause indexnull
in next loop at linevar item = this._soundInstances[src][i];