Hey all,
In the release notes to r50, I mentioned browser caching is terrible in Firefox and Chrome.
I've done a live test on a real web server and it looks like I was wrong: Firefox and Chrome do actually cache sound files properly, but only when running on a live server. The caching issue looks like a problem with Construct 2's own local HTTP server. It's just that Firefox and Chrome seem to be extremely fussy about the way the server talks to them. As you can imagine C2's own server is not designed to be a full blown internet web server - it's just to serve up some local files - so it does not implement all possible internet server features. This seems to confuse Firefox and Chrome a bit and so they download sound files multiple times. The other browsers aren't bothered and cache anyway.
So, looking at the logs for the local server, I got the impression these browsers were making multiple requests and would do so on the internet as well. Having tested it on the real internet, they seem to cache OK.
They'll keep making multiple requests locally, but it doesn't matter - when just running on your computer, files can be loaded in milliseconds. Nothing is downloaded from the internet.
So, the situation doesn't seem to be as bad as I thought! Chrome can even loop sounds as well, but Firefox still doesn't.
More features can be added but the rest of the HTML5 audio features are still variously supported and unsupported. Still, I could add one or two and see how they work for everyone.
Sound files are still downloaded on first play. I'm actually in favour of keeping it this way, since sound and music can make a large part of a game's download size (especially music). Browsers can stream audio so it can start playing before the whole file has downloaded. This means it's not necessary to leave the user sitting and waiting for all audio to fully download - it can stream it during the game, and the user gets to play the game quicker. This does mean extra latency the first time some sound effects are played, but this seems a small price to pay for a much smaller download. Also, it means sound files which are never played are never downloaded.
For common sound effects I can add a "preload sound" action to download it immediately on startup, so there's no latency on first play. Apart from that, streaming is probably a good idea for the rest.
Sound good?