Audio support: I was wrong

0 favourites
  • 7 posts
From the Asset Store
Comprehensive localization solution for Construct 3 projects, no addons required!
  • 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?

  • 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?

    ---------------------------------------------------

    This sounds promising ! ! !

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Could the preload sound action have two options: 1, load at startup, and 2, load specifically when the action is called? Then sound loading could be hidden at the start of a level or something. It would give more flexibility.

  • Arima, you can put a bunch of preload sound actions on "Start of layout" on the first layout (e.g. the menu), or put the actions in some other event. Doesn't that do what you want?

  • Yeah, that's basically what I meant. I guess I misunderstood, I thought it might be like setting globals where it doesn't matter what event sheet they're on.

  • i just tested support on iphone and its a no go, doesn't play at all,

    well seems to play them, but you can't hear it, and it doesn't cache either so there's huge framedrop, i have provided ogg and m4a so i suppose it should work or there's another filetype that should be used, maybe mp3? im waiting for ios5 to retest, hoping for better framerates and soundsupport

    testlink - firefox test was very good

    testlink

  • testlink - firefox test was very good

    http://dl.dropbox.com/u/36224287/shooter/index.html

    I can confirm.

    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, 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.

    A good news overall.

    By features, you mean pan and volume or are you thinking about more ?

    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?

    Sounds really good.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)