From b41c5e127c1288b9fa614699543223fe52b850e5 Mon Sep 17 00:00:00 2001 From: Kevin Ngo Date: Tue, 25 Sep 2018 03:57:02 -0700 Subject: [PATCH] play intro song after scene load to prevent choppy --- src/components/intro-song.js | 9 +++++++++ src/index.html | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 src/components/intro-song.js diff --git a/src/components/intro-song.js b/src/components/intro-song.js new file mode 100644 index 0000000..4365a3a --- /dev/null +++ b/src/components/intro-song.js @@ -0,0 +1,9 @@ +AFRAME.registerComponent('intro-song', { + multiple: true, + + play: function () { + const audio = document.getElementById('introSong'); + audio.volume = 0.5; + audio.play(); + } +}); diff --git a/src/index.html b/src/index.html index bcd494e..4971c3a 100644 --- a/src/index.html +++ b/src/index.html @@ -6,6 +6,9 @@ + + + - - {% include './templates/stage.html' %} {% include './templates/gameUi.html' %}