WKWebview doesn't allow me to set allowsAirplayForMediaPlayback

I am using WKWebview to load a webpage that has a list of media files.

When I select a media file, I want it to be played locally only, and not through airplay.

For this I use the following code snippet:


var webView: WKWebView

let config = WKWebViewConfiguration()

config.allowsAirPlayForMediaPlayback = false

webView = WKWebView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height), configuration: config)

print(webView.configuration.allowsAirPlayForMediaPlayback)


However, airplay is still used for media playback and the value "allowsAirPlayForMediaPlayback" remains set to true.

Replies

Were you able to solve this?