diff --git a/src/assets.html b/src/assets.html
index 614dc4f..81707fa 100644
--- a/src/assets.html
+++ b/src/assets.html
@@ -16,6 +16,7 @@
+
diff --git a/src/components/beat-hit-sound.js b/src/components/beat-hit-sound.js
index eb35387..6c83b5b 100644
--- a/src/components/beat-hit-sound.js
+++ b/src/components/beat-hit-sound.js
@@ -42,7 +42,7 @@ AFRAME.registerComponent('beat-hit-sound', {
this.currentCutDirection = '';
this.el.setAttribute('sound__beathit', {
poolSize: 12,
- src: 'assets/sounds/beatHit.ogg',
+ src: '#beatHitSound',
volume: 0.5
});
this.processSound = this.processSound.bind(this);
@@ -50,6 +50,15 @@ AFRAME.registerComponent('beat-hit-sound', {
sourceCreatedCallback = this.sourceCreatedCallback.bind(this);
},
+ play: function () {
+ // Kick three.js loader...Don't know why sometimes doesn't load.
+ if (!this.el.components.sound__beathit.loaded) {
+ console.log('[beat-hit-sound] Kicking three.js AudioLoader / sound component...');
+ this.el.setAttribute('sound__beathit', 'src', '');
+ this.el.setAttribute('sound__beathit', 'src', '#beatHitSound');
+ }
+ },
+
playSound: function (beatEl, cutDirection) {
const soundPool = this.el.components.sound__beathit;
this.currentBeatEl = beatEl;