mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
add destroy for fireball/issues/6888
This commit is contained in:
@@ -175,6 +175,12 @@ Audio.State = {
|
||||
});
|
||||
};
|
||||
|
||||
proto.destroy = function () {
|
||||
if (CC_WECHATGAME) {
|
||||
this._element.destroy();
|
||||
}
|
||||
};
|
||||
|
||||
proto.pause = function () {
|
||||
if (!this._element) return;
|
||||
this._unbindEnded();
|
||||
|
||||
@@ -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 = {};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user