override func viewDidLoad() {
super.viewDidLoad()
secondVideoPlayer.allowsInlineMediaPlayback = true
secondVideoPlayer.loadHTMLString("<iframe width=\"\(newVideoPlayer.frame.width)\" height=\"\(newVideoPlayer.frame.height)\" src=\"\(urlString)?&playsinline=1\" frameborder=\"0\" allowfullscreen></iframe>",baseURL: nil)
}
Youtube视频位置启动不正确,要正确看到我总是要拖动它我该如何解决?如何手动设置他的起始位置?
答案 0 :(得分:2)
将iframe
包裹在body
内并将margin
和padding
设置为零,因此内容从左上角开始。
secondVideoPlayer.loadHTMLString("<body style=\"margin: 0; padding: 0;\"><iframe width=\"\(newVideoPlayer.frame.width)\" height=\"\(newVideoPlayer.frame.height)\" src=\"\(urlString)?&playsinline=1\" frameborder=\"0\" allowfullscreen></iframe></body>",baseURL: nil)