2
我試圖從YouTube嵌入視頻用下面的代碼:iOS版的YouTube嵌入式視頻幀問題
func setUpVideo() {
let width = webView.frame.width
let height = webView.frame.height
let frame = 0
bmiWebView.allowsInlineMediaPlayback = true
let videoUrl = "https://www.youtube.com/embed/GCALWdwKr48"
let htmlUrl = "<html><body><iframe width=\(width) height=\(height) src=\(videoUrl)?&playsinline = 1 frameborder=\(frame) allowfullscreen></iframe></body></html>"
webView.loadHTMLString(htmlUrl, baseURL: NSBundle.mainBundle().bundleURL)
}
我能夠與白色背景最初加載視頻,但是當它加載它看起來像下面。我不確定爲什麼有白色背景。如果有人能告訴我如何刪除這將是非常有用的。謝謝。
爲最好的辦法是---> https://developers.google.com/youtube/ v3/guides/ios_youtube_helper和其他swift庫是https://github.com/gilesvangruisen/Swift-YouTube-Player – jose920405