Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Swift:youtube视频的自动播放和自动全屏_Ios_Swift_Video_Youtube - Fatal编程技术网

Ios Swift:youtube视频的自动播放和自动全屏

Ios Swift:youtube视频的自动播放和自动全屏,ios,swift,video,youtube,Ios,Swift,Video,Youtube,我必须在我的swift应用程序中嵌入youtube视频。视频必须在点击按钮后以全屏模式自动播放。我搜索了很多,发现有很多方法可以嵌入youtube视频,但并不是所有的方法都支持自动播放和自动全屏。 我已经测试了此代码,但视频不是自动播放的,也不是以全屏模式自动显示的: let webView:UIWebView = UIWebView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.ma

我必须在我的swift应用程序中嵌入youtube视频。视频必须在点击按钮后以全屏模式自动播放。我搜索了很多,发现有很多方法可以嵌入youtube视频,但并不是所有的方法都支持自动播放和自动全屏。 我已经测试了此代码,但视频不是自动播放的,也不是以全屏模式自动显示的:

 let webView:UIWebView = UIWebView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height))
        self.view.addSubview(webView)

        webView.allowsInlineMediaPlayback = true
        let myVideo = "https://www.youtube.com/embed/N-GNV7jhKV4"

        let myHTML = "<iframe width=\"\(webView.frame.size.width)\" height=\"\(webView.frame.size.height)\" src=\"\(myVideo)?autoplay=1\" frameborder=\"0\" allowfullscreen=1></iframe>"

        webView.loadHTMLString(myHTML, baseURL: nil)
        webView.mediaPlaybackRequiresUserAction = false
让webView:UIWebView=UIWebView(帧:CGRect(x:0,y:0,宽度:UIScreen.main.bounds.width,高度:UIScreen.main.bounds.height))
self.view.addSubview(webView)
webView.allowsInlineMediaPlayback=true
让我的视频=”https://www.youtube.com/embed/N-GNV7jhKV4"
让myHTML=“”
loadHTMLString(myHTML,baseURL:nil)
webView.mediaplaybackrequiresseraction=false
有人能告诉我,在我的代码、和之间满足上述所有条件(自动播放和自动全屏)的最佳方式是什么,或者如果有人有其他建议