I am new to IOS application development. I've added the code for embedding Youtube video in my app by using UIWebview and the embed code from the youtube. But when I run the application in my simulator, the webview is simply blank. I don't see any video thumbnail or anything else. I heard youtube videos will not run on IPhone simulators but this link ("http://www.youtube.com/embed/36db4r3MsgU")shows that the video is playing perfectly in simulator. kindly look into this link and suggest me a solution.
NSString *code = @"<iframe width=\"640\" height=\"360\" src=\"http://www.youtube.com/embed/36db4r3MsgU?feature=player_detailpage\" frameborder=\"0\" allowfullscreen></iframe>";
[[self video]loadHTMLString:code baseURL:nil];
Thanks, Abilash.G
Google provides a helper to embed and control youtube videos in iOS apps. Have a look at the documentation here: https://developers.google.com/youtube/v3/guides/ios_youtube_helper
It is too much easy in swift 4
let url = URL(string: "http://www.youtube.com/watch?v=fDXWW5vX-64")
let request = URLRequest(url: url!)
webView?.load(request)
No need to use the embed code. The standard UIWebView aimed at the youtube web address should work fine...
// MY UIWebview is named "videoYoutube" in this example below // UIWebview size = 320x180 // This below will set the width to the guides ... or close to it and scale dependent on the device size.
For the first suggested answer i faced some issues like the whole youtube page has been loaded for fixing that i used some extra codes, the codes are
I have used this in my app. this doesn't use any webview
https://www.cocoacontrols.com/controls/hcyoutubeparser
OR