I am trying to play a YouTube video in my application. It seems I get to the right place, but the video does not play. I run the application on the device itself (not on the simulator).
this is the code i use:
- (void)viewDidLoad { [super viewDidLoad]; NSString *htmlString = @"<html><head>\ <meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 320\"/></head>\ <body style=\"background:#000;margin-top:0px;margin-left:0px\">\ <iframe id=\"ytplayer\" type=\"text/html\" width=\"320\" height=\"240\"\ src=\"http://www.youtube.com/embed/VIDEO_ID&feature?autoplay=1\"\ frameborder=\"0\"/>\ </body></html>"; //VIDEO_ID holds the video embedded code I get from YouTube [self.webView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.youtube.com"]]; }
The YouTube player loads, but when I press the PLAY button, I get "This video is currently unavailable":

I tested the ID of the embedded video (copy and paste into the web page) and it will find the corresponding video (for example, I assume that I have the correct video ID).
Does anyone know what I'm doing wrong?
source share