add destroy for fireball/issues/6888

This commit is contained in:
knoxHuang
2018-02-11 15:42:30 +08:00
parent 992b74f0ac
commit ec2f53fb1b
2 changed files with 13 additions and 0 deletions
+6
View File
@@ -175,6 +175,12 @@ Audio.State = {
});
};
proto.destroy = function () {
if (CC_WECHATGAME) {
this._element.destroy();
}
};
proto.pause = function () {
if (!this._element) return;
this._unbindEnded();
+7
View File
@@ -425,6 +425,7 @@ var audioEngine = {
var audio = id2audio[id];
if (audio) {
audio.stop();
audio.destroy();
delete id2audio[id];
}
}
@@ -439,6 +440,12 @@ var audioEngine = {
*/
uncacheAll: function () {
this.stopAll();
for (var id in id2audio) {
var audio = id2audio[id];
if (audio) {
audio.destroy();
}
}
id2audio = {};
url2id = {};
},