ios youtube嵌入式视频帧问题

ios youtube嵌入式视频帧问题,ios,swift,youtube,uiwebview,Ios,Swift,Youtube,Uiwebview,我正在尝试使用以下代码嵌入来自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"

我正在尝试使用以下代码嵌入来自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)
}
func setUpVideo(){
让宽度=webView.frame.width
让高度=webView.frame.height
设帧=0
bmiWebView.allowsInlineMediaPlayback=true
让videoUrl=”https://www.youtube.com/embed/GCALWdwKr48"
让htmlUrl=“”
webView.loadHTMLString(htmlUrl,baseURL:NSBundle.mainBundle().bundleURL)
}
我可以加载视频最初与白色背景,但当它加载时,它看起来像下面。我不知道为什么会有白色背景。如果有人能告诉我如何删除这将是非常有帮助的。非常感谢。

白色背景是UIWebView HTML主体上的边距

添加一些CSS将边距设置为0,如下所示:


正文{margin:0px;}
实现这一点的最佳方法是-->而对于swift的其他库,则是