How to embed youtube player in iphone app
I had gone through with the previous question and wrote simple co开发者_如何学Cde..
- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame {
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: white;\
}\
</style>\
</head><body style=\"margin:0\">\
<video src=\"point/to/mov\"></video>\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
NSString *html = [NSString stringWithFormat:embedHTML, urlString, frame.size.width, frame.size.height];
UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame];
[videoView loadHTMLString:html baseURL:nil];
//[videoView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=WL2l_Q1AR_Q"]]];
[self.view addSubview:videoView];
[videoView release];
}
if use the "html" is it not showing... but we load the url directly as i commented it is working fine...
Can anyone help me out of this issue..
精彩评论