如何从本地iPhone应用程序中播放YouTube,metacafe等video?

我收到了一个包含指向来自YouTube,metacafe等网站的video的url的Feed

我发现这篇文章build议如何使用UIWebView将video加载到应用程序。 不过,我不希望video以全屏模式播放。 我希望它在我分配的框架中播放。

  1. 我如何使通过embeddedHTML的uiwebview播放加载的YouTubevideo分配给它的框架,而不是在全屏模式?

  2. 我们如何从像metacafe和喜剧中心等网站播放video,而url不指向文件,而是在浏览器中加载播放器。

  3. 是否有任何应用程序已经实现了相同的本地iPhone应用程序?

在这方面的任何帮助将是非常有益的。

编辑:我想知道我们怎么从url播放video说 – http://www.dailymotion.com/swf/video/xe1l96

我想知道如何在webview本身播放video。 我想用它周围的空间来显示其他信息。 目前它强制全屏模式。

Safari可以通过开发quicktime播放器来播放dailymotion和vimeovideo。 所以我想知道如何redirect使用QuickTime播放器播放video。

如何在本地iPhone应用程序中播放来自YouTube和metacafec的video?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ UIWebView *wbView = (UIWebView *)[cell.contentView viewWithTag:1]; 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, 64.0, 64.0]; [wbView loadHTMLString:html baseURL:nil]; } "url" is the youtube video url - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCell *cell = [category_table cellForRowAtIndexPath:indexPath]; UIWebView *wbView = (UIWebView *)[cell.contentView viewWithTag:1]; UIButton *btn = [self findButtonInView:wbView]; [btn sendActionsForControlEvents:UIControlEventTouchUpInside]; } // detecting the play button on the you tube video thumbnail - (UIButton *)findButtonInView:(UIView *)view { UIButton *button = nil; if ([view isMemberOfClass:[UIButton class]]) { return (UIButton *)view; } if (view.subviews && [view.subviews count] > 0) { for (UIView *subview in view.subviews) { button = [self findButtonInView:subview]; if (button) return button; } } return button; } - (void)webViewDidFinishLoad:(UIWebView *)_webView { UIButton *button = [self findButtonInView:_webView]; [button sendActionsForControlEvents:UIControlEventTouchUpInside]; } 

基本上,我不得不在表格单元格中显示缩略图

普利文,

您的video将始终在iPhone和iPod上全屏播放。 提到的标志( allowsInlineMediaPlayback )只适用于iPad …

YouTube很容易。 只需将UIWebView的allowsInlineMediaPlayback属性设置为YES即可。

其他的东西只是一个包装video的Flash播放器。 这将是更困难的,可能不值得它没有问题的网站的支持。

祝你好运,如果你需要更多的帮助只是评论/编辑你的问题。