destroy audio element when stop

destroy audio element when stop


destroy audio element when stop
This commit is contained in:
PP
2018-03-29 17:44:13 +08:00
parent 74fa58895e
commit 28779f3554
2 changed files with 5 additions and 0 deletions
+4
View File
@@ -41,6 +41,7 @@ var getAudioFromPath = function (path) {
var oldId = list.shift();
var oldAudio = id2audio[oldId];
oldAudio.stop();
oldAudio.destroy();
}
audio = new Audio(path);
@@ -365,6 +366,8 @@ var audioEngine = {
return false;
audio.off('load', audio.__callback);
audio.stop();
audio.destroy();
return true;
},
@@ -380,6 +383,7 @@ var audioEngine = {
var audio = id2audio[id];
if (audio && audio.stop) {
audio.stop();
audio.destroy();
audio.off('load', audio.__callback);
}
}
+1
View File
@@ -231,6 +231,7 @@ var AudioSource = cc.Class({
onDestroy: function () {
this.stop();
this.audio.destroy();
cc.audioEngine.uncache(this._clip);
},