So according to Apple's documentation : https://developer.apple.com/documentation/webkit/wkwebviewconfiguration/1614793-allowsinlinemediaplayback
I should be able to play videos inline easily using Swift 4, but no matter what I do it always opens the video in the native video player.
This is my code :
convenience init(style: UITableViewCell.CellStyle, reuseIdentifier: String?, url: String = "", title: String) {
self.init(style: style, reuseIdentifier: reuseIdentifier)
self.videoTitleLabel.text = title
self.urlToVideo = url
setUpUI()
setUpLayout()
webView.backgroundColor = .smalt
webView.translatesAutoresizingMaskIntoConstraints = false
webView.configuration.allowsInlineMediaPlayback = true
webView.configuration.preferences.javaScriptEnabled = true
webView.load(URLRequest(url: URL(string: self.urlToVideo + "?playsinline")! ))
}
What Am I doing wrong?