I want to embed a youtube video into a webviewer whenever I press a button. I have this code
- (IBAction)testBtn:(id)sender {
NSString *code = @\"
Try this one this is working perfect. You use youtube Url as "http://www.youtube.com/v/YOU_TUBE_VIDEO_ID".
UIWebView * youTubeWebView=[[UIWebView alloc]initWithFrame:CGRectMake(0,0,320,320)];
youTubeWebView.allowsInlineMediaPlayback=YES;
youTubeWebView.mediaPlaybackRequiresUserAction=NO;
youTubeWebView.mediaPlaybackAllowsAirPlay=YES;
youTubeWebView.delegate=self;
youTubeWebView.scrollView.bounces=NO;
NSString *linkObj=@"http://www.youtube.com/v/1iBIcJFRLBA";//@"http://www.youtube.com/v/6MaSTM769Gk";
NSLog(@"linkObj1_________________%@",linkObj);
NSString *embedHTML = @"\
\
\\\\\\";
NSString *html = [NSString stringWithFormat:embedHTML, linkObj];
[youTubeWebView loadHTMLString:html baseURL:nil];
[self.view addSubview:youTubeWebView];