I want to play YouTube videos from my iPhone app. I have to tried play YouTube videos in my iPhone app with the following codes,
[self playVideo:@\"http://ww
Add Pod pod 'XCDYouTubeKit'
import XCDYouTubeKit in ViewController
func playYoutubeVideo(){
let strUrl = "https://www.youtube.com/watch?v=9m_K2Yg7wGQ"
if let range = strUrl.range(of: "=") {
let strIdentifier = strUrl.substring(from: range.upperBound)
print("Identifier:\(strIdentifier)")
let videoPlayerViewController =
XCDYouTubeVideoPlayerViewController(videoIdentifier: strIdentifier)
videoPlayerViewController.present(in: viewYTVideo)
videoPlayerViewController.moviePlayer.play()
}
}