From 35674b5780df2f658da6d3cf615817bee75f6cb9 Mon Sep 17 00:00:00 2001 From: Santhosh Date: Sun, 6 Sep 2015 16:24:26 +0530 Subject: [PATCH] Update CordovaAudioSoundInstance.js Getting the error TypeError: Cannot read property 'release' of null while invoking destroy on CordovaAudioSound instance.Fix for https://github.com/CreateJS/SoundJS/issues/195. --- src/soundjs/cordovaaudio/CordovaAudioSoundInstance.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/soundjs/cordovaaudio/CordovaAudioSoundInstance.js b/src/soundjs/cordovaaudio/CordovaAudioSoundInstance.js index dac1b526..1541d059 100644 --- a/src/soundjs/cordovaaudio/CordovaAudioSoundInstance.js +++ b/src/soundjs/cordovaaudio/CordovaAudioSoundInstance.js @@ -126,9 +126,10 @@ this.createjs = this.createjs || {}; }; p.destroy = function() { - // call parent function, then release - this.AbstractSoundInstance_destroy(); + // pause and release the playback resource, then call parent function + this._playbackResource.pause(); this._playbackResource.release(); + this.AbstractSoundInstance_destroy(); }; /** @@ -178,7 +179,7 @@ this.createjs = this.createjs || {}; p._handleCleanUp = function () { clearTimeout(this._audioSpriteTimeout); - this._playbackResource.pause(); // OJR cannot use .stop as it prevents .seekTo from working + // OJR cannot use .stop as it prevents .seekTo from working // todo consider media.release };