As far as I know, Apple does not allow you to play Youtube videos in WebView in their own application, and they will also reject your application. Because I have this experience before.
Btw I wrote a Youtube video playback method in my application:
- (void)embedYouTube:(NSString*)videoId frame:(CGRect)frame { NSString* embedHTML = @"\ <html><head>\ <style type=\"text/css\">\ body {\ background-color: transparent;\ color: white;\ }\ </style>\ </head><body style=\"margin:0\">\ <embed id=\"yt\" src=\"http://www.youtube.com/watch?v=%@\" type=\"application/x-shockwave-flash\" \ width=\"%0.0f\" height=\"%0.0f\"></embed>\ </body></html>"; NSString* html = [NSString stringWithFormat:embedHTML, videoId, frame.size.width, frame.size.height]; [self.webView loadHTMLString:html baseURL:nil]; }
Hope this helps.
source share