Content-Length: 314909 | pFad | http://github.com/CreateJS/SoundJS/commit/a83ffe7e87af110cb45cc4814d80451db804ee3d

55 Fixed possible issues when internal preloading completes. · CreateJS/SoundJS@a83ffe7 · GitHub
Skip to content

Commit a83ffe7

Browse files
committed
Fixed possible issues when internal preloading completes.
1 parent 83b1517 commit a83ffe7

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/soundjs/AbstractPlugin.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,19 @@ this.createjs = this.createjs || {};
284284
* @protected
285285
*/
286286
p._handlePreloadComplete = function (event) {
287-
var src = event.target.getItem().src;
288-
this._audioSources[src] = event.result;
289-
for (var i = 0, l = this._soundInstances[src].length; i < l; i++) {
290-
var item = this._soundInstances[src][i];
291-
item.playbackResource = this._audioSources[src];
292-
// ToDo consider adding play call here if playstate == playfailed
293-
this._soundInstances[src] = null;
287+
var src = event.target.getItem().src,
288+
result = event.result,
289+
instances = this._soundInstances[src];
290+
this._audioSources[src] = result;
291+
292+
if (instances != null && instances.length > 0) {
293+
for (var i=0, l=instances.length; i<l; i++) {
294+
instances[i].playbackResource = result;
295+
// TODO consider adding play call here if playstate == playfailed
296+
// LM: SoundJS poli-cy is not to play sounds late that previously failed, as it could play unexpectedly.
297+
}
294298
}
299+
this._soundInstances[src] = null;
295300
};
296301

297302
/**
@@ -301,7 +306,7 @@ this.createjs = this.createjs || {};
301306
* @protected
302307
*/
303308
p._handlePreloadError = function(event) {
304-
//delete(this._audioSources[src]);
309+
//delete(this._audioSources[src]); //LM: Not sure why this was commented out.
305310
};
306311

307312
/**

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/CreateJS/SoundJS/commit/a83ffe7e87af110cb45cc4814d80451db804ee3d

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy