How can I get a YouTube-video in a UITableViewCell
, and how do I handle the Done
-button of the UIWebView
playing the video?
I have embedded the video in a view, but like on the image. And I want this Done
-button in this image:
I want to open another screen when I return to the view, not the previous view.
-(void)viewDidLoad {
[super viewDidLoad];
videoURL = [[NSString alloc]init];
videoURL =@"http://www.youtube.com/watch?v=aE2b75FFZPI";
[self embedYouTube:videoURL frame:CGRectMake(10, 85, 300, 180)];
}
- (void)embedYouTube:(NSString*)url frame:(CGRect)frame {
NSString* embedHTML = @"\ <html><head>\ <style type=\"text/css\">\ body {\ background-color: transparent;\ color: red;\ }\ </style>\ </head><body style=\"margin:0\">\ <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \ width=\"%0.0f\" height=\"%0.0f\"></embed>\ </body></html>";
NSString* html = [NSString stringWithFormat:embedHTML, url, frame.size.width, frame.size.height];
if (videoView == nil) {
videoView = [[UIWebView alloc] initWithFrame:frame];
[self.view addSubview:videoView];
NSLog(@"html%@",html);
}
[videoView loadHTMLString:html baseURL:nil];
}
I need some help with this. I did a search, but I didn't get anything.