My attempt was to set webView.configuration.mediaTypesRequiringUserActionForPlayback = .video
However, this does not work and after searching Google I was not able to find a workaround.
webView is an IBOutlet with a custom WKWebView class as follows:
import UIKit
import WebKit
class ScrollWebView: WKWebView {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.configuration.allowsInlineMediaPlayback = true
self.configuration.mediaTypesRequiringUserActionForPlayback = .all
}
}