We've been developing a web app that uses WebAudio (specifically, AudioBufferSourceNode) to produce closely synchronised audio on desktop and mobile devices.
In recent testing on Chrome (97) on iPhone (15.2.1), we sometimes see a tab get into a state where it imposes extreme delay (we've seen up to ~1500ms) on audio output. This applies both to buffer-source playback and to trivial OscillatorNode-generated beeps. The audio eventually emerges intact from the speaker, but it's as if a 1500ms delay node has been introduced. It doesn't seem to be a hardware state; playback from Safari at those times is unaffected.
We don't yet have a reliable procedure for reproducing this. It seems to happen more readily when we put an audio-producing tab into the background for a while (say, 15 minutes or more) then wake it up again. We are usually testing with two or more tabs running the same app, so maybe that's part of the trigger too.
Our main question for this forum is: what can we do to diagnose how that extra delay is happening?
Or, alternatively: is there some kind of reset of the audio framework that should be able to force playback back to normal after getting into this state?
We would of course also be very grateful for pointers to anywhere that this situation has already been discussed. It doesn't seem to have cropped up before in these forums.