Debugging: The sounds don't always play, which kills some of the motivation to keep playing.
Customization: Besides asking for the dino to grow (cause you feed him), my son kept asking for different colors for the dino.
I suspected that one issue was that the sounds were not loaded in time for immediate playback. So my idea was to pre-fetch the sounds and "hide" the pre-fetching with a modal that would show up when the page is loaded. That would also allow me to offer a selection of colors so that you could select your own colorful dino.
To pre-fetch the sounds as much as I can, I create
for them, trigger a
load and register a listener for
that pre-fetches the sounds, it didn't fix the issue.
Turns out that the browser is protecting us from annoying websites by preventing automatic playback. After enabling automatic playback in Firefox' settings, the sounds now play every time 🎉. But two issues remain:
Why does it work sometimes? My best guess is that my sons sometimes managed to interact with the page in a way that enabled playback. One thing that seems to work is selecting some text or element, opening the context menu for it. That left the page in a state were playback was enabled for some reason that I didn't look into.
The "resolution" also raises the question of how to ensure that playback is enabled on first load. I added a quick check (The promise returned by
HTMLAudioElementfails in case the browser stops playback) but I would prefer to add a reasonable "dialog" to explain what's going on, but ran out of time to implement that and the modal.
So now I have pre-fetching strategy implemented that I don't really need 🤷 But hey, maybe it helps when there's a bit of latency 😜
for (x of xs)rather than
for (x in xs)or even
for each (x in xs). Check MDN for details.
There seems to be no way to be certain that I can use a
HTMLAudioElementfully offline. That is, I want to make sure it is fully downloaded versus it is partially cached enough that it can be played back if the current download rate is maintained.
A reminder of why I appreciate error handling in Go. While it often feels repetitive or even cumbersome, it makes failure points explicit and probably would have saved me some time here.
(setq prettier-js-args '( "--trailing-comma" "es5" "--bracket-spacing" "false" "--single-quote" "true" "--arrow-parens" "avoid" ))
knut-03 - spent about 1.5 hours.
- Debugging ✅ Pretty sure that the automatic playback setting was the "bug" I was hunting.
- Customization ❌ Didn't find the time to tackle it this time.
No visual changes in this one - so will probably try to get back to that next.