WKWebView "ignores" the app sharedInstance AVAudioSessionCategory because it doesn't use it. It has its own AVAudioSessionCategory not available directly (as it runs in a separate process). This latter AVAudioSessionCategory can be indirectly influenced by <audio> and <video> html5 elements or their javascript counterparts. When audio starts playing through either of them the category switches from Ambient to Playback, and snaps back when it stops. To achieve the behavior of respecting the hardware silent switch one must not use audio and video html elements (or js equivalents).
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: