【发布时间】:2011-09-04 17:56:34
【问题描述】:
我想在我的应用程序中播放 YouTube 视频。我写了下面的代码,但是视频无法播放,请告诉我如何播放视频,谢谢提前
NSURL *url =[NSUrl UrlWithString: @"http://www.youtube.com/watch?v=2MSMJgpmVM8&feature=grec_index"];;
NSString *embedHTML = @"<html><head>\
<body style=\"margin:0\">\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
videoView = [[UIWebView alloc] initWithFrame:CGRectMake(100, 100, 320.0, 412.0)];
[videoView setOpaque:NO];
NSString *html = [NSString stringWithFormat:embedHTML,url, videoView.frame.size.width, videoView.frame.size.height];
[videoView loadHTMLString:html baseURL:nil];
[self.view addSubview:videoView];
【问题讨论】:
-
此粘贴不正确。
*url没有值。并且对stringWithFormat的调用是错误的。 -
同样的问题,请告诉我怎么玩?
标签: iphone youtube video-streaming