I have a UIWebView subclass that I used to play both youtube and local videos. Worked perfectly under iOS6. In upgrading to iOS7 I\'ve encountered a problem I don\'t really kn
Try this:
NSString* videoUrl = @"//www.youtube.com/embed/Of_hjbYCx4Y";
if([videoUrl hasPrefix:@"//"]) {
videoUrl = [NSString stringWithFormat:@"https:%@", videoUrl]; // or http
// if its a local file add proper scheme like "file:///"
}
NSString* iframeWidth = @"100%";
NSString* iframeHeight = @"240px";
NSString *iframeHTML =[NSString stringWithFormat:@"", iframeWidth, iframeHeight, videoUrl];
// you can directly use iframeHTML below or u can wrap it up in body and span tags and then use it if u need to add any extra stuff or customize the page itself
[videoWebView loadHTMLString:htmlString baseURL:nil];
Make sure of two things: Video url starts with http (proper scheme) and replace the /watch?v= with embed/ if u don't have it already in url. Check other answers given here to see how to do this. Hope it helps.