check current time to decide whether to pause preview song

This commit is contained in:
Kevin Ngo
2018-10-13 12:10:52 -07:00
parent bba975e477
commit 8034e78501

View File

@@ -45,7 +45,8 @@ AFRAME.registerComponent('song-preview-system', {
// Play clicked.
// But don't start playing it if it wasn't playing already.
if (!oldData.challengeId && data.challengeId) {
if (this.analyserEl.components.audioanalyser.volume === 0) {
if (this.analyserEl.components.audioanalyser.volume === 0 ||
this.audio.currentTime < 1) {
this.stopSong();
} else {
this.el.components['animation__songpreviewfadedown'].beginAnimation();