Video avatar fixes

This commit is contained in:
Ilya Laktyushin
2020-07-10 18:36:28 +03:00
parent ab41dbe22a
commit b51dd938f4
7 changed files with 202 additions and 106 deletions

View File

@@ -43,8 +43,12 @@ final class GenericEmbedImplementation: WebEmbedImplementation {
self.onPlaybackStarted = onPlaybackStarted
updateStatus(self.status)
let html = String(format: htmlTemplate, self.url)
webView.loadHTMLString(html, baseURL: URL(string: "about:blank"))
if self.url.contains("player.twitch.tv/"), let url = URL(string: self.url) {
webView.load(URLRequest(url: url))
} else {
let html = String(format: htmlTemplate, self.url)
webView.loadHTMLString(html, baseURL: URL(string: "about:blank"))
}
userContentController.addUserScript(WKUserScript(source: userScript, injectionTime: .atDocumentEnd, forMainFrameOnly: false))