Bug 237878

Summary: AudioContext is suspended on iOS when page is backgrounded
Product: WebKit Reporter: youenn fablet <youennf>
Component: MediaAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achronop, adrien.wurth, eric.carlson, ews-watchlist, glenn, ian, jeremy.thomas, jer.noble, leo.au, mattwindwer, philipj, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
WIP
none
Patch none

youenn fablet
Reported 2022-03-15 00:09:11 PDT
Following on https://bugs.webkit.org/show_bug.cgi?id=231105 which was MacOS specific, we have the same AudioContext issues: - If page is backgrounded, AudioContext will be stopped even though AudioContext is not used directly for playing audio - AudioContext might be resumed by web page in case it can autoplay (for instance if page is continuing to capture audio, which allows to continue playing audio).
Attachments
WIP (9.96 KB, patch)
2022-03-15 06:29 PDT, youenn fablet
no flags
Patch (22.91 KB, patch)
2022-03-16 03:03 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2022-03-15 06:29:10 PDT
youenn fablet
Comment 2 2022-03-16 03:03:20 PDT
EWS
Comment 3 2022-03-17 00:22:56 PDT
Committed r291390 (248520@main): <https://commits.webkit.org/248520@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 454812 [details].
Radar WebKit Bug Importer
Comment 4 2022-03-17 00:23:16 PDT
youenn fablet
Comment 5 2022-03-23 23:55:39 PDT
As spotted by Cameron, media/auto-play-web-audio-in-about-blank-iframe.html is failing on bots after this change.
youenn fablet
Comment 6 2022-03-23 23:59:40 PDT
(In reply to youenn fablet from comment #5) > As spotted by Cameron, media/auto-play-web-audio-in-about-blank-iframe.html > is failing on bots after this change. Hypothesis: background state is kept from a past test and never reset to false across tests.
Matthew Windwer
Comment 7 2022-04-04 09:49:24 PDT
Thanks for fixing this. What iOS release can we expect this fix?
Jeremy Thoms
Comment 8 2022-04-29 05:30:21 PDT
> Thanks for fixing this. What iOS release can we expect this fix? I'd also like to know the targeted iOS release. It's become a critical issue for us.
Adrien iWebDJ
Comment 9 2022-05-20 04:53:16 PDT
Oh no not again... almost same problem was introduce iOS 13 (webaudio stops when app is in background), it took one year to fix back then... https://developer.apple.com/forums/thread/121822 Please, this is CRITICAL, how can we develop a real music app with WVWebView if the audio stops in background? ... The problem doesn't happen on iOS Safari. I am questioning the QA team who validated this release because the problem is so obvious.
Adrien iWebDJ
Comment 10 2022-05-20 04:57:28 PDT
Same bug in iOS13 > https://bugs.webkit.org/show_bug.cgi?id=203293, fixed in iOS14 and introduced again in iOS15... please this is a big issue...
Adrien iWebDJ
Comment 11 2022-06-07 10:08:42 PDT
@youenn fablet, Is this critical bug fix will be shipped on iOS16 only? if so it won't be accessible for all iPhones prior to iPhone 8, which is a big problem for wide adopted apps. Could you please release the fix in iOS15? iOS14 is not affected by this bug. Thanks!!
youenn fablet
Comment 12 2022-06-07 10:24:53 PDT
(In reply to Adrien iWebDJ from comment #11) > @youenn fablet, Is this critical bug fix will be shipped on iOS16 only? if > so it won't be accessible for all iPhones prior to iPhone 8, which is a big > problem for wide adopted apps. Could you please release the fix in iOS15? > iOS14 is not affected by this bug. Thanks!! This particular fix should be in the iOS 16 beta 1.
Adrien iWebDJ
Comment 13 2022-06-08 16:25:36 PDT
@youenn fablet thank you for the reply and the fix!! but tell me if I am wrong, will this mean that the iPhones 6s/7/SE1 and many iPads will never be able to play background webaudio? (= making it unusable) If so, this would be a big problem because it has never happened to have a "hole" in the support of webaudio... :/
Ian Lovejoy
Comment 14 2022-06-15 11:07:23 PDT
Just another upvote: it would really really be great if this fix could be merged into a 15.x release! Thanks for your consideration.
Adrien iWebDJ
Comment 15 2022-07-12 10:58:52 PDT
@youenn fablet, I just installed iOS 16 Beta 1 as you adviced, the fix is not there, WebAudio keeps stopping if app go to background... :'( Also I have issue with WebAudio with bluetooth, it is completely buggy. I don't know if you were aware of it... (I am french too :)
Adrien iWebDJ
Comment 16 2022-07-12 11:11:32 PDT
ps : test it by yourself if you need : https://apps.apple.com/us/app/youdj-mix-music-now/id1459666155 (desktop version is a popular DJ app : https://you.dj)
Adrien iWebDJ
Comment 17 2022-09-16 08:48:52 PDT
Just to let you know, the fix is still not included in iOS 16.1 beta :'(
leo.au
Comment 18 2022-10-26 12:42:52 PDT
The bug is still present in iOS 16.1 release. Tested on an iPhone 11 Pro demo playing various games on https://nj-casino.goldennuggetcasino.com/
Adrien iWebDJ
Comment 19 2023-02-01 11:03:02 PST
The bug is 18 months old and it is still present in iOS 16.3, discouraging... Also iOS 16.3 introduced a new bug! Now the silent switch is also muting WebAudio... The WKWebView behavior should match native apps for audio, otherwise it is useless and confusing. I have open a new bug thread, these issues are too blocking : https://bugs.webkit.org/show_bug.cgi?id=237878
Adrien iWebDJ
Comment 20 2023-02-01 11:03:35 PST
Note You need to log in before you can comment on or make changes to this bug.