From d4b1672a7b8f16e460bd4459a83e5f41f4e86fc2 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Wed, 11 Dec 2013 11:51:31 +0800 Subject: [PATCH 1/2] Fixed #3373 : Add verification to audio duration to prevent issue --- CocosDenshion/SimpleAudioEngine.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CocosDenshion/SimpleAudioEngine.js b/CocosDenshion/SimpleAudioEngine.js index 271c6be901..f2cbbc6374 100644 --- a/CocosDenshion/SimpleAudioEngine.js +++ b/CocosDenshion/SimpleAudioEngine.js @@ -301,7 +301,7 @@ cc.SimpleAudioEngine = cc.AudioEngine.extend(/** @lends cc.SimpleAudioEngine# */ if (locSoundList.hasOwnProperty(locPlayingMusic)) { var au = locSoundList[locPlayingMusic].audio; au.pause(); - au.currentTime = au.duration; + au.currentTime = 0 | au.duration; if (releaseData) delete locSoundList[locPlayingMusic]; cc.AudioEngine.isMusicPlaying = false; @@ -573,7 +573,7 @@ cc.SimpleAudioEngine = cc.AudioEngine.extend(/** @lends cc.SimpleAudioEngine# */ var au = this._audioIDList[audioID]; if (!au.ended) { au.loop = false; - au.currentTime = au.duration; + au.currentTime = 0 | au.duration; } } }, @@ -592,7 +592,7 @@ cc.SimpleAudioEngine = cc.AudioEngine.extend(/** @lends cc.SimpleAudioEngine# */ au = tmpArr[j]; if (!au.ended) { au.loop = false; - au.currentTime = au.duration; + au.currentTime = 0 | au.duration; } } } @@ -669,7 +669,7 @@ cc.SimpleAudioEngineForMobile = cc.SimpleAudioEngine.extend({ if (!au.ended) { au.removeEventListener('ended', this._audioEndedCallbackBound, false); au.loop = false; - au.currentTime = au.duration; + au.currentTime = 0 | au.duration; } } } @@ -745,7 +745,7 @@ cc.SimpleAudioEngineForMobile = cc.SimpleAudioEngine.extend({ if (!au.ended) { au.removeEventListener('ended', this._audioEndedCallbackBound, false); au.loop = false; - au.currentTime = au.duration; + au.currentTime = 0 | au.duration; } } continue; @@ -1059,7 +1059,7 @@ cc.SimpleAudioEngineForMobile = cc.SimpleAudioEngine.extend({ if (!au.ended) { au.removeEventListener('ended', this._audioEndedCallbackBound, false); au.loop = false; - au.currentTime = au.duration; + au.currentTime = 0 | au.duration; } } this._deletePlayingTaskFromList(audioID); @@ -1080,7 +1080,7 @@ cc.SimpleAudioEngineForMobile = cc.SimpleAudioEngine.extend({ if (!au.ended) { au.removeEventListener('ended', this._audioEndedCallbackBound, false); au.loop = false; - au.currentTime = au.duration; + au.currentTime = 0 | au.duration; } } } From c8876179676fdccf94628b56a7dfa3d18901f37d Mon Sep 17 00:00:00 2001 From: pandamicro Date: Wed, 11 Dec 2013 11:59:19 +0800 Subject: [PATCH 2/2] Fixed #3373 : change methode of verification to audio duration --- CocosDenshion/SimpleAudioEngine.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CocosDenshion/SimpleAudioEngine.js b/CocosDenshion/SimpleAudioEngine.js index f2cbbc6374..667a4dad7c 100644 --- a/CocosDenshion/SimpleAudioEngine.js +++ b/CocosDenshion/SimpleAudioEngine.js @@ -301,7 +301,7 @@ cc.SimpleAudioEngine = cc.AudioEngine.extend(/** @lends cc.SimpleAudioEngine# */ if (locSoundList.hasOwnProperty(locPlayingMusic)) { var au = locSoundList[locPlayingMusic].audio; au.pause(); - au.currentTime = 0 | au.duration; + au.currentTime = au.duration ? au.duration : 0; if (releaseData) delete locSoundList[locPlayingMusic]; cc.AudioEngine.isMusicPlaying = false; @@ -573,7 +573,7 @@ cc.SimpleAudioEngine = cc.AudioEngine.extend(/** @lends cc.SimpleAudioEngine# */ var au = this._audioIDList[audioID]; if (!au.ended) { au.loop = false; - au.currentTime = 0 | au.duration; + au.currentTime = au.duration ? au.duration : 0; } } }, @@ -592,7 +592,7 @@ cc.SimpleAudioEngine = cc.AudioEngine.extend(/** @lends cc.SimpleAudioEngine# */ au = tmpArr[j]; if (!au.ended) { au.loop = false; - au.currentTime = 0 | au.duration; + au.currentTime = au.duration ? au.duration : 0; } } } @@ -669,7 +669,7 @@ cc.SimpleAudioEngineForMobile = cc.SimpleAudioEngine.extend({ if (!au.ended) { au.removeEventListener('ended', this._audioEndedCallbackBound, false); au.loop = false; - au.currentTime = 0 | au.duration; + au.currentTime = au.duration ? au.duration : 0; } } } @@ -745,7 +745,7 @@ cc.SimpleAudioEngineForMobile = cc.SimpleAudioEngine.extend({ if (!au.ended) { au.removeEventListener('ended', this._audioEndedCallbackBound, false); au.loop = false; - au.currentTime = 0 | au.duration; + au.currentTime = au.duration ? au.duration : 0; } } continue; @@ -1059,7 +1059,7 @@ cc.SimpleAudioEngineForMobile = cc.SimpleAudioEngine.extend({ if (!au.ended) { au.removeEventListener('ended', this._audioEndedCallbackBound, false); au.loop = false; - au.currentTime = 0 | au.duration; + au.currentTime = au.duration ? au.duration : 0; } } this._deletePlayingTaskFromList(audioID); @@ -1080,7 +1080,7 @@ cc.SimpleAudioEngineForMobile = cc.SimpleAudioEngine.extend({ if (!au.ended) { au.removeEventListener('ended', this._audioEndedCallbackBound, false); au.loop = false; - au.currentTime = 0 | au.duration; + au.currentTime = au.duration ? au.duration : 0; } } }