Bug 167788 - WKWebView seems to ignore AVAudioSession category settings in iOS app
Summary: WKWebView seems to ignore AVAudioSession category settings in iOS app
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Other
Hardware: iPhone / iPad iOS 10
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-02-03 02:57 PST by Victor Wang
Modified: 2021-08-30 10:22 PDT (History)
8 users (show)

See Also:


Attachments
A simple project which show the problem of WKWebView and AVAudioSession (27.13 KB, application/zip)
2017-02-03 02:57 PST, Victor Wang
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Wang 2017-02-03 02:57:33 PST
Created attachment 300516 [details]
A simple project which show the problem of WKWebView and AVAudioSession

By setting app's AVAudioSession's category to `AVAudioSessionCategoryPlayback` with option `mixWithOthers`, will make sounds from video in UIWebView be mixed with third party background music (such as Spotify). It do not work at all once switch to WKWebView.

Tested on Xcode 8.2.1, iOS 10.2.1

Many thanks.
Comment 1 Radar WebKit Bug Importer 2017-02-04 00:17:35 PST
<rdar://problem/30362584>
Comment 2 distinctdan 2019-11-22 15:50:47 PST
This bug is annoying some of my app's users also because the webview ignores the hardware mute switch. Is there any hope of getting this fixed, or at least providing a property on wkwebview to set its audio session category?
Comment 3 zn 2020-06-09 00:38:54 PDT
We're unable to mix audio from WkWebView and AVPlayer as the webview audio takes precedence and ducks everything else. I really don't understand why WkWebView is so restrictive when it comes to media, i.e. getUserMedia and this audio issue.
Comment 4 haimomesi 2021-08-29 14:33:55 PDT
getUserMedia works under WKWebView, but without any AudioSession manipulation.

That blocks as from using CallKit or applying any audio routing, modes and categories. 

WebKit's setSinkId and enumerateDevices are still experimental so no impl for WebKit.

I hope these missing features will be developed soon and at least WKWebView's AudioSession will be added to its API.