Browse Source

Fix music startup

main
fluffy 7 months ago
parent
commit
f489107a5c
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      html/sbh.js

+ 9
- 1
html/sbh.js View File

@@ -23,7 +23,15 @@ window.addEventListener("load", () => {
for (var i = 0; i < 2; i++) {
music[i] = new Audio("veggie-baggle.mp3");
}
flipMusic();

var musicStarted = false;
music[0].addEventListener("canplaythrough", () => {
if (!musicStarted) {
musicStarted = true;
flipMusic();
}
});

frame();
});



Loading…
Cancel
Save