mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
destroy audio element when stop
destroy audio element when stop destroy audio element when stop
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,6 +231,7 @@ var AudioSource = cc.Class({
|
||||
|
||||
onDestroy: function () {
|
||||
this.stop();
|
||||
this.audio.destroy();
|
||||
cc.audioEngine.uncache(this._clip);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user