Skip to content

Commit

Permalink
fixed music not autoplaying
Browse files Browse the repository at this point in the history
  • Loading branch information
ThinLiquid committed Aug 17, 2024
1 parent 25c5459 commit 70f90c3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions root.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,22 @@

const songs = [
'gemini-bleeps.mod',
'tempest-acidjazz.mod',
'unsuspected_h.mod'
]
await player.load('/audio/' + songs[Math.floor(Math.random() * songs.length)]);

new Audio().play().catch(error => {
const _ = new Audio('https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_1MG.mp3')
player.play()
_.play()
.catch(error => {
if (error.message.includes('interact')) {
window.addEventListener('click', async () => {
player.play();
player.stop()
player.play()
});
}
});

player.play()

player.watchRows((pos, row) => {
if ((row % 8) === 0) {
flash()
Expand Down

0 comments on commit 70f90c3

Please sign in to comment.