How do I make audio loop in decker when exported as .html? The audio seems to pause after the first 10 seconds even when i use play["sound" "loop"]. It does not pause in the .deck version.
Viewing post in General Decker Question and Answer Thread
Does looping work for you in the official All About Sound deck? In my browser (Firefox on Linux) I can click “Start Loop” and it runs for at least 11 loops (that’s when I got bored).
What browser are you using, on what platform?
How long is the sound that you’re looping?
Thank you for your reply!
Strangely, yes, it works in the All About Sound deck. I'm using Safari on Mac, and the sound runs the full 10 second limit that Decker has. I believe I'm using Decker version 1.54.
If you wish to check it out, you can find my project on https://puter-and-tunep-games.itch.io/inspiration-strikes. It might be the case that it's working for other browsers, and I have some weird local issue going on.
Ah, here’s what I see:
- when I start the game, no sound
- when I click on the background, the background loop plays once
- when I click on the “next” button, there’s still no background music
- if I press the left-arrow key on the keyboard to go back to the first card, the background loop begins playing, and loops properly
From the documentation, under Web-Decker and Native-Decker:
Most web browsers do not allow programs to play audio until the user has interacted with a page, so any
play[]commands issued before a user has clicked, tapped, or pressed a keyboard key will have no effect.
I think this is what you’re bumping into, since your deck tries to play audio when the first card appears. The simplest workaround would be to also start looping the sound on the second card, so that whether somebody’s using Web Decker or Native Decker, they get the background loop eventually. A more complex solution would be to add a pre-title card that the user has to click through to get to the title card.