Why WKWebView doesn’t display videos? – Swift 3

Why WKWebView doesn’t display videos? – Swift 3

I successfully added a WKWebView programmatically In a viewController (in viewDidLoad()). When loading a url that contains a video it appears fine, but when I try to tap on it (playing it), I cannot see it, but the audio works fine.

The weird thing is I created a new project just to make sure it should works fine and it did, I copied the same exact code the webView displayed the video as it should.

It was working fine before converting to Swift 3.

 

Simply, this is the code:

override func viewDidLoad() {

super.viewDidLoad()

let web = WKWebView(frame: view.frame) let urlRequest = URLRequest(url: URL(string: "http:/ web.frame = view.frame web.load(urlRequest) view.addSubview(web)

}

 

I tried to check many cases without any output. What am I missing?

Thanks in advance.