Bug 263627 - [iOS] AudioContext is not consistently resumed when page is brought to foreground
Summary: [iOS] AudioContext is not consistently resumed when page is brought to foregr...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: Safari 17
Hardware: iPhone / iPad iOS 17
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-10-24 17:06 PDT by Yuwei
Modified: 2024-07-26 13:27 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuwei 2023-10-24 17:06:35 PDT
I'm running into this bug on a physical iPhone 12 Pro running iOS 17.0.3. I was not able to repro this on iPhone Simulator running iOS 17.0 on iPhone 15 Pro Max.

Repro:

1. Open this Web Audio Oscillator demo and play the sine wave: https://webaudioapi.com/samples/oscillator/
2. Minimize the browser and wait a few seconds
3. Bring the browser back to foreground
4. Repeat step 2-3 a few times and observe the audio output and sound wave visualization

Expected:

Audio is paused whenever the page is in the background, and it should be resumed whenever the page is brought back to the foreground.

Actual:

Sometimes the audio is paused and never resumed, but if you try minimizing and resuming the browser again then the audio will appear to resume itself.

---

The project I'm working on also have a silent video tag on the page. The video is also paused whenever the audio is (incorrectly) paused. Prior to switching to web audio, we played audio on an audio element, which would keep playing in the background and the video tag would not be paused when the page was brought back to the foreground.
Comment 1 Radar WebKit Bug Importer 2023-10-31 17:07:18 PDT
<rdar://problem/117771450>
Comment 2 Jean-Yves Avenard [:jya] 2023-11-15 12:43:53 PST
Did this ever work on earlier iOS version?
Comment 3 hamish@risingsoftware.com 2023-12-18 16:32:27 PST
I see this in my app. The audio context has state 'running', but currentTime is not increasing. If I suspend and resume programatically then the context works again.
Comment 4 Matthew Windwer 2024-07-26 13:27:01 PDT
Here are steps to reproduce what @hamish reported, that the audio context has a state 'running' but currentTime is not increasing, which in itself seems to be a bug, and it cannot always be resumed: https://bugs.webkit.org/show_bug.cgi?id=276687#c6