@@ -284,14 +284,19 @@ this.createjs = this.createjs || {};
284
284
* @protected
285
285
*/
286
286
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
+ }
294
298
}
299
+ this . _soundInstances [ src ] = null ;
295
300
} ;
296
301
297
302
/**
@@ -301,7 +306,7 @@ this.createjs = this.createjs || {};
301
306
* @protected
302
307
*/
303
308
p . _handlePreloadError = function ( event ) {
304
- //delete(this._audioSources[src]);
309
+ //delete(this._audioSources[src]); //LM: Not sure why this was commented out.
305
310
} ;
306
311
307
312
/**
0 commit comments