Ashley's Recent Forum Activity

  • shortwave - those are interesting links - it sounds like it's an iOS bug that has been around for a while, and it definitely sounds like it's something to do with iOS changing the sampling rate as mentioned earlier in the thread:

    [quote:1w4jr61m]I believe the issue is caused due to resetting the audioContext.sampleRate prop, which seem to happen after the browser/OS plays something recorded in a different sampling rate.

    [quote:1w4jr61m]I noticed that if you play a video using a <video> tag, it sets the context.sampleRate value to whatever the video's audio was encoded at. It seems as if iOS Safari has one global sampleRate that it uses for everything...

    This global sample rate appears to persist across page loads and is shared between tabs and browser instances. So, playing a youtube video in another tab could break all your decoded audio.

    So under some circumstances iOS ends up playing audio buffers at the wrong sample rate, which probably corrupts the audio and sounds distorted.

    I think this confirms it's an iOS bug and not something wrong with our own code, so the best we could do from here is figure out a reliable way to reproduce it and forward it to Apple. I think the repro will look something like:

    1. Open a C2 project in Safari which plays some audio at 44.1KHz

    2. Close Safari

    3. Open something else that plays audio at a different sample rate, e.g. 48KHz

    4. Close that and go back to Safari

    5. See if the audio is distorted

    However as per usual in bug reports, we need absolute specifics for every step. So I think it's just a matter of finding something reliable for step 3 (e.g. a youtube video or something public and reliable like that).

    I've looked at some of the workarounds and they look very difficult - they say things like "just recreate the AudioContext", but in our engine that would mean tearing down and rebuilding the entire audio routing graph, and possibly re-decoding audio buffers. That's complicated and we have no code to cover that right now since normally there's no need to ever do that, and implementing it is enough new code that it is likely to cause as many problems as it solves (as already happened recently with an Android audio bug, and that was much simpler!) Other workarounds like "just play an audio buffer at this frequency" don't make sense, because it's already doing that when you play a new sound when coming back, but it still sounds distorted.

    The good news is I think this should have limited impact - it seems unlikely it will affect everyone, it's just certain combinations of playing something else in between Safari.

  • If you add the Browser object and display in a text object the WindowInnerWidth and WindowInnerHeight values, does it report what look like the right values? I still think this kind of issue is likely an iOS bug for the iPad Pro build only for some reason, since it seems to work fine everywhere else, and unfortunately I can't guarantee that there's anything much we can do about iOS bugs, even with a device to test on...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That just seems to cover getUserMedia (i.e. webcam/microphone feeds). I'm not aware there's any official support for DataChannel yet, but I think it's in the works.

  • There's no browser feature that allows this yet. I think it's a work in progress though.

  • Still nobody has reported if r222 is any different, which is important to know! Testing usually requires trying several times over a period of time, so going to a local store is not really a viable approach, and I'd prefer to avoid purchasing a whole device just to investigate one bug.

  • One other idea to try when there is a .capx again: if this is to do with switching to the home screen/another app and then coming back, it might be worth trying enabling "play in background" in the Audio object properties. Normally switching away and coming back will suspend and resume the audio context, but if you enable that option it just leaves it running. This might help identify if the problem stems from suspending the audio context.

  • I tested an iPad Air 2. Does anyone else have one to test and does it definitely not reproduce on that? iOS devices tend to be pretty consistent so deviations like this tend to be unusual.

  • I don't think any modern devices have hardware limits, they just mix all the channels on the CPU in to a single output stream. If it's not hundreds you'll probably be fine.

  • Ignaci - have you tested r222 and is it any different? I made some changes for that.

  • The only thing in the engine that are DOM elements are the form controls. Everything else is pure JS rendering to a canvas. So there are no div, img or any other kind of elements at all for those things.

  • I think modern systems are limited only by how fast the CPU can process all the audio you're throwing at it. Then if you throw in a lot of high-volume sounds, the output will start clipping and it will sound horrible, so it's not really a good idea anyway.

  • There are free options: the Intel XDK costs nothing. The Cordova CLI is free too, but is a more complicated setup.

    Yes of course Native Exportation would be better.

    Not necessarily: if development is 5x slower than it is now as we have to maintain 5 platforms separately, and due to the quirks of each platform each individual feature is only supported over a random selection of platforms making porting constantly a huge headache, and some features are entirely missing or incompatible with their browser equivalents, and some platforms face awkward bugs that others don't, then the end result is not necessarily even better than what we have now. None of this is hypothetical, other products on the market with this approach face these problems. If you add up all those other problems, is it really better? Then throw in the colossal engineering effort it takes to even get started on this...

    It also won't necessarily remove the difficulty of configuring certificates, setting up provisioning profiles etc. All of that you still have to go through for native apps too, and that can be a big part of the pain of setting up mobile publishing.

Ashley's avatar

Ashley

Online Now
Early Adopter

Member since 21 May, 2007
Last online 27 Oct, 2026

Twitter
Ashley has 1,832,952 followers

Connect with Ashley

Trophy Case

  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Forum Wizard Made 5,000 posts in the forums
  • Forum Unicorn Made 10,000 posts in the forums
  • Forum Mega Brain Made 20,000 posts in the forums
  • x126
    Coach One of your tutorials has over 1,000 readers
  • x74
    Educator One of your tutorials has over 10,000 readers
  • x6
    Teacher One of your tutorials has over 100,000 readers
  • Sensei One of your tutorials has over 1,000,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • x44
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

32/44
How to earn trophies

Blogs