I have the URL for example https://www.youtube.com/watch?v=c2ccXwwmcnA
. If I pass this URL to UIWebView
it automatically the play
the Video. I have the tried the following ways
Option-1
@property (weak, nonatomic) IBOutlet UIWebView *webvie;
NSString *url=@"https://www.youtube.com/watch?v=7jYa7dfrXKU";
self.webvie.allowsInlineMediaPlayback = YES;
self.webvie.scrollView.bounces = NO;
self.webvie.mediaPlaybackRequiresUserAction = NO;
[self.webvie loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
Option-2
NSString *youTubeHTMLTemplate = @"<html><head><style type=\"text/css\">body { background-color: transparent;color: white;}</style></head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" width=\"%0.0f\" height=\"%0.0f\"></embed></body></html>";
finalHtml = [NSString stringWithFormat:youTubeHTMLTemplate, fullYopuTubeUrl, htmlFrameWidth, htmlFrameHeight];
Option-3
How to autoplay a YouTube video in a UIWebView
I dont want auto play the in UIWebview play youtube video
but all options does not helped me,