[bump npm] start progress events for loading

This commit is contained in:
Kevin Ngo
2018-10-12 18:01:01 -07:00
parent 0092a91cbe
commit 5b8e13d69d
3 changed files with 12 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ AFRAME.registerComponent('song', {
this.analyserSetter = {buffer: true};
this.audioAnalyser = this.data.analyserEl.components.audioanalyser;
this.context = this.audioAnalyser.context;
this.victory = this.victory.bind(this);
// Base volume.
@@ -95,6 +96,9 @@ AFRAME.registerComponent('song', {
}, once);
this.analyserSetter.src = utils.getS3FileUrl(data.challengeId, 'song.ogg');
data.analyserEl.setAttribute('audioanalyser', this.analyserSetter);
this.audioAnalyser.xhr.addEventListener('progress', evt => {
this.onFetchProgress(evt);
});
});
},
@@ -111,5 +115,9 @@ AFRAME.registerComponent('song', {
victory: function () {
if (!this.data.isPlaying) { return; }
this.el.sceneEl.emit('victory', null, false);
},
onFetchProgress: function (evt) {
}
});