I cannot redefine the category or port of AVAudioSession when sound is played from WKWebView. The same code works fine when using a regular UIWebView.
AVAudioSession *session = [AVAudioSession sharedInstance]; [session setCategory:AVAudioSessionCategoryPlayAndRecord error:&err];
I also tried activating sharedInstance like this, but this did not help:
[session setActive: YES error: nil]
The above code does not affect the sound coming from WKWebView. I found some Twitter posts stating that iOS 8.1 mixes WKWebView audio with the background sound of the application, but I could not find the source of this. See this thread on twitter for reference: https://twitter.com/marcoarment/status/530881842900373504
ios cordova cordova-plugins wkwebview avaudiosession
Lyle pratt
source share