Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hitting wall sound when loading #171

Open
davidkmrcode opened this issue Dec 31, 2019 · 3 comments
Open

Hitting wall sound when loading #171

davidkmrcode opened this issue Dec 31, 2019 · 3 comments

Comments

@davidkmrcode
Copy link

I pulled down the latest code as of 12/28, and I noticed that for maze, if I load a level from local storage, the "hitting wall" sound plays immediately even though I didn't go off the edge. This happens only when loading an already-completed puzzle from local storage, there's no sound when starting a level fresh. This may happen with other games as well.

I noticed the same problem at https://blockly.games/. I don't recall this problem with a build from a few months ago (like around September).

@NeilFraser NeilFraser changed the title Hitting wall sound when loading from local storage Hitting wall sound when loading Jan 3, 2020
@NeilFraser
Copy link
Contributor

We need to preload and cache all the sounds, otherwise when we play a sound the first instance will play a second late. The Audio API has a 'preload' attribute that's designed to provide exactly this. However, when tested, this did not work across all browsers. So we chose to play all sounds at minimum volume upon page load. At a volume of just 1%, this didn't used to be audible.

I think it's time that Blockly take another look at sounds and determine if there are better ways of preloading sounds in the majority of browsers. We will probably need to keep the hacky low-volume preload technique for IE, but at a minimum I'd expect that Chrome and FF should have proper preloading abilities.

@davidkmrcode
Copy link
Author

Did you try prefetch: https://3perf.com/blog/link-rels/
The prefetch link tag has worked for me for preloading images and sounds.

@NeilFraser
Copy link
Contributor

Yes, I remember that 'prefetch' did absolutely nothing in any browser when this code was written. But that was 2014, and it's now 2019 2020 so we need to redo our entire survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants