From 79bece00f03dfeb7111eec519de26f75ebb02fce Mon Sep 17 00:00:00 2001 From: Kevin Ngo Date: Fri, 12 Oct 2018 03:46:24 -0700 Subject: [PATCH] don't play audio during song loading if it wasn't coming thru already --- src/components/song-preview.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/song-preview.js b/src/components/song-preview.js index a431028..adddc67 100644 --- a/src/components/song-preview.js +++ b/src/components/song-preview.js @@ -38,7 +38,13 @@ AFRAME.registerComponent('song-preview-system', { const data = this.data; // Continue to play preview song during loading to keep entertained. - if (oldData.isSongLoading && !data.isSongLoading) { this.stopSong(); } + if (oldData.isSongLoading && !data.isSongLoading) { + this.stopSong(); + } + // But don't start playing it if it wasn't playing already. + if (!oldData.isSongLoading && data.isSongLoading) { + if (this.audio.currentTime < 1) { this.stopSong(); } + } // Selected challenge ID updated. if (data.selectedChallengeId && oldData.selectedChallengeId !== data.selectedChallengeId) {