fix song restart/exit

This commit is contained in:
Kevin Ngo
2018-10-10 00:35:29 -07:00
parent 196f5acd01
commit 08fd752fe1

View File

@@ -17,11 +17,13 @@ AFRAME.registerComponent('song', {
audio.crossOrigin = 'anonymous';
this.el.sceneEl.appendChild(audio);
this.el.addEventListener('cleargame', () => {
if (audio.paused) {
audio.currentTime = 0;
audio.play();
}
this.el.addEventListener('pausemenuexit', () => {
audio.currentTime = 0;
});
this.el.addEventListener('pausemenurestart', () => {
audio.currentTime = 0;
audio.play();
});
audio.addEventListener('ended', () => {