I ran into a rather strange problem. What I'm trying to do right now is to get a YouTube audio video for this link. I tried a couple of things, but it either didn't work or was ineffective.
So I decided to turn to more experienced iOS developers. Thanks in advance.
@implementation ViewController
@synthesize web;
- (void)embedYouTube:(NSString*)url 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=\"%@\" 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];
UIWebView *webView =[[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[webView loadHTMLString:html baseURL:nil];
[self.view addSubview:webView];
}
-(IBAction)play{
[self embedYouTube:@"http://www.youtube.com/watch?v=iw1aT5c1Lus" frame:CGRectMake(0, 0, 320, 480)];
}
source
share