如何在原生iphone应用程序中播放youtube,metacafe等视频? [英] How to play videos from youtube, metacafe etc in a native iphone app?

查看:191
本文介绍了如何在原生iphone应用程序中播放youtube,metacafe等视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I get a feed which consists of a URL pointing to the videos from sites like youtube, metacafe etc.

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

I found this post suggesting how to use UIWebView to load the video into the app. However I don't want the video to play in full screen mode. I want it to play in the frame I have allocated for it.


  1. 如何制作由...加载的YouTube视频将html嵌入到分配给它的帧中的uiwebview播放而不是全屏模式?

  1. How do I make the youtube video which is loaded by embedding html into the uiwebview play in the frame allocated to it and not in full screen mode?

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

How do we play videos from sites like metacafe and comedy central and other sites where url doesn't point to a file but instead loads a player if pasted on browser.

是否有任何应用程序可以播放相同的内容作为原生iphone应用程序?

Are there any applications which have achieved to play the same as a native iphone app?

这方面的任何帮助都会非常有帮助。

Any help in this regards would be greatly helpful.

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

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

I would like to know how to play the video in the webview itself. I want to use the space around it to display other information. Currently it forces full screen mode.

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

Safari is able to play dailymotion and vimeo videos by lauching the quicktime player. So I would like to know how to redirect to play the videos using quicktime player.

如何在原生iphone应用中播放来自youtube和metacafec的视频?

How do I play videos from youtube and metacafec in a native iphone app?

推荐答案

- (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];
}

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

Basically, i had to show thumbnails in table cell

这篇关于如何在原生iphone应用程序中播放youtube,metacafe等视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆