Added stopAndReleaseAudioTag method to stop sound playback and mark audio tag as unused and release it for other sounds to use

This commit is contained in:
Pavle Goloskokovic 2018-01-11 18:53:54 +01:00
parent 8578319171
commit f6de613fd0

View file

@ -82,7 +82,7 @@ var HTML5AudioSound = new Class({
return false;
}
// \/\/\/ isPlaying = false, isPaused = false \/\/\/
// TODO implement stop method
this.stopAndReleaseAudioTag();
this.events.dispatch(new SoundEvent(this, 'SOUND_STOP'));
return true;
},
@ -139,6 +139,12 @@ var HTML5AudioSound = new Class({
}
return true;
},
stopAndReleaseAudioTag: function () {
this.audio.pause();
this.audio.dataset.used = 'false';
this.audio = null;
this.startTime = 0;
},
reset: function () {
BaseSound.prototype.stop.call(this);
},