Playing a YouTube video in the app is very easy with UIWebView
Here is a snippet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
// YouTube video @IBOutlet weak var webView: UIWebView! // MARK: - Embed Video Player // id is like: xjr89789234 (grab this from youtube url) func loadYoutube(_ videoID:String) { guard let youtubeURL = URL(string: "https://www.youtube.com/embed/\(videoID)") else { return } webView.loadRequest( URLRequest(url: youtubeURL) ) } |