ios – 嵌入Youtube视频: – 包含来自*的内容,限制在特定网站上播放

如何嵌入包含受版权保护内容的Youtube视频.

例如,当您尝试在UIWebView中播放此视频(http://www.youtube.com/embed/ADBKdSCbmiM)时,它说

This Video Contains content from Vevo. It is restricted from playback on certain sites

我如何才能将这样的视频用于嵌入式播放器或使用MPMoviePlayer等制作的自定义播放器.我知道这是可能的,因为下面的应用程序这样做. (http://itunes.apple.com/us/app/audioviz-view-your-songs-on/id547001249?mt=8)

编辑
很少有视频在浏览器中播放,但在iOS模拟器中显示

This video contains content from SME . It is restricted from playback on certain site

感谢您的帮助!

解决方法

要使用uiwebview播放youtube视频:

>首先检查浏览器中是否播放了您的YouTube网址.如果视频无法在浏览器中播放,则它也不会在设备中播放
>您只需检查设备;视频无法在模拟器中播放

- (void) displayGoogleVideo

    {

    CGRect rect = [[UIScreen mainScreen] bounds];

    CGSize screenSize = rect.size;

    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,screenSize.width,screenSize.height)];

    webView.autoresizesSubviews = YES;

    webView.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);

    Nsstring *videoUrl = @"http://www.youtube.com/v/oHg5SJYRHA0"; // valid youtube url


    Nsstring *htmlString = [Nsstring stringWithFormat:@"<html><head><Meta name = \"viewport\" content = \"initial-scale = 1.0,user-scalable = no,width = 212\"/></head><body style=\"background:#F00;margin-top:0px;margin-left:0px\"><div><object width=\"320\" height=\"480\"><param name=\"movie\" value=\"%@\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"%@\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"320\" height=\"480\"></embed></object></div></body></html>",videoUrl,videoUrl]    ;



    [webView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.youtube.com"]];


    [window addSubview:webView];

    [webView release]; 

}

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...