From 61533b510e05838db8c52eaa1b6c71ed5aea1f7e Mon Sep 17 00:00:00 2001 From: PP Date: Mon, 19 Mar 2018 10:40:59 +0800 Subject: [PATCH] fixed bgm can't stop --- cocos2d/audio/CCAudio.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cocos2d/audio/CCAudio.js b/cocos2d/audio/CCAudio.js index 88d92f1a00..a3753f1dac 100644 --- a/cocos2d/audio/CCAudio.js +++ b/cocos2d/audio/CCAudio.js @@ -199,9 +199,17 @@ Audio.State = { proto.stop = function () { if (!this._element) return; - try { - this._element.currentTime = 0; - } catch (error) {} + if (CC_WECHATGAME) { + setTimeout(function () { + try { + this._element.currentTime = 0; + } catch (error) {} + }.bind(this), 0); + } else { + try { + this._element.currentTime = 0; + } catch (error) {} + } this._element.pause(); // remove touchPlayList for (var i=0; i