diff --git a/src/components/song.js b/src/components/song.js index 99e8baf..40aee6e 100644 --- a/src/components/song.js +++ b/src/components/song.js @@ -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', () => {