wait for audio buffer source when restarting

This commit is contained in:
Kevin Ngo
2018-10-16 12:58:14 -07:00
parent e241db6dac
commit b86d4ec9c0
2 changed files with 2 additions and 0 deletions

View File

@@ -124,6 +124,7 @@ AFRAME.registerComponent('song', {
if (this.source) { this.source.disconnect(); }
this.data.analyserEl.addEventListener('audioanalyserbuffersource', evt => {
this.source = evt.detail;
this.el.sceneEl.emit('songloadfinish', null, false);
if (this.data.isBeatsPreloaded) { this.source.start(); }
}, ONCE);
this.audioAnalyser.refreshSource();

View File

@@ -133,6 +133,7 @@ AFRAME.registerState({
state.isBeatsPreloaded = false;
state.isGameOver = false;
state.isPaused = false;
state.isSongLoading = true;
},
gamemenuexit: (state) => {