如何在原生iphone应用程序中播放youtube,metacafe等视频?

Pra*_*n S 1 iphone objective-c youtube-api ios4 ios

我得到一个Feed,其中包含一个指向youtube,metacafe等网站视频的网址.

我发现这篇文章建议如何使用UIWebView将视频加载到应用程序中.但是我不希望视频以全屏模式播放.我想让它在我为之分配的框架中播放.

  1. 如何将通过嵌入html加载的youtube视频放入分配给它的帧中的uiwebview播放而不是全屏模式?

  2. 我们如何播放来自metacafe和喜剧中心和其他网站的视频,其中url不指向文件,而是在浏览器上粘贴播放器.

  3. 是否有任何应用程序可以像本机iPhone应用程序一样播放?

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

编辑:我想知道我们如何播放网址中的视频说 - http://www.dailymotion.com/swf/video/xe1l96

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

Safari可以通过推出quicktime播放器来播放dailymotion和vimeo视频.所以我想知道如何使用quicktime播放器重定向播放视频.

如何在本机iphone应用程序中播放来自youtube和metacafec的视频?

Swa*_*tik 5

- (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];
}
Run Code Online (Sandbox Code Playgroud)

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