如何在iphone应用程序中嵌入youtube播放器
我已经完成了前面的问题,并编写了简单的代码如何在iphone应用程序中嵌入youtube播放器,iphone,objective-c,ios,ios4,Iphone,Objective C,Ios,Ios4,我已经完成了前面的问题,并编写了简单的代码 - (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame { NSString *embedHTML = @"\ <html><head>\ <style type=\"text/css\">\ body {\ background-color: transparent;\ color: white;\
- (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];
}
-(void)embeddeYouTube:(NSString*)urlString frame:(CGRect)frame{
NSString*embedHTML=@”\
\
\
身体{\
背景色:透明\
颜色:白色\
}\
\
\
\
\
";
NSString*html=[NSString stringWithFormat:embedHTML,urlString,frame.size.width,frame.size.height];
UIWebView*videoView=[[UIWebView alloc]initWithFrame:frame];
[videoView loadHTMLString:html baseURL:nil];
//[videoView加载请求:[NSURLRequest requestWithURL:[NSURL URLWithString:@]http://www.youtube.com/watch?v=WL2l_Q1AR_Q"]]];
[self.view addSubview:videoView];
[视频视图发布];
}
如果使用“html”,它是否不显示。。。
但我们直接加载url,因为我评论说它工作正常
有人能帮我解决这个问题吗