ios - Swift: Autoplay and auto fullScreen for youtube video -
i have embed youtube videos in swift application. video have played automatically after button click , in fullscreen mode. have searched lot , have found many ways exists embed youtube videos not of them support autoplay , auto fullscreen. have tested code video not autoplayed , it’s not automatically showed in fullscreen mode:
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
can please tell me best way satisfy conditions cited above (autoplay , auto full screen) between code, youtube-player-ios-helper , swift-youtube-player or if have other suggestions.
Comments
Post a Comment