Bug 220879 - [iOS] Set background playback restriction for WebAudio
Summary: [iOS] Set background playback restriction for WebAudio
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-01-22 15:17 PST by Eric Carlson
Modified: 2021-01-23 12:31 PST (History)
6 users (show)

See Also:


Attachments
Patch (6.92 KB, patch)
2021-01-22 15:39 PST, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch for landing (7.78 KB, patch)
2021-01-23 09:58 PST, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2021-01-22 15:17:08 PST
WebAudio does not play in the background on iOS both because audio doesn't play when the category is set to `AVAudioSessionCategoryAmbient`, and because the AudioContext is paused when the web process is forwarded the `UIApplicationWillResignActiveNotification` notification. 

This notification isn't forwarded when the WebView is hosted in SafariViewController so the AudioContext is not paused, so it resumes playing when the application is foregrounded even if the view controller is not in the foreground.
Comment 1 Eric Carlson 2021-01-22 15:18:13 PST
<rdar://72949281>
Comment 2 Eric Carlson 2021-01-22 15:39:02 PST
Created attachment 418188 [details]
Patch
Comment 3 Eric Carlson 2021-01-23 09:58:12 PST
Created attachment 418227 [details]
Patch for landing
Comment 4 EWS 2021-01-23 12:31:42 PST
Committed r271779: <https://trac.webkit.org/changeset/271779>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 418227 [details].