嵌入 Youtube 视频:- 包含来自 * 的内容,限制在某些网站上播放 [英] Embed Youtube videos :- with contains content from * , it is restricted from playback on certain site
问题描述
如何嵌入包含受版权保护内容的 Youtube 视频.
How to embed a Youtube video that has copyrighted content in it.
例如,当您尝试播放此视频时(http://www.youtube.com/embed/ADBKdSCbmiM) 在 UIWebView
它说
For example when you try playing this video(http://www.youtube.com/embed/ADBKdSCbmiM) in a UIWebView
it says
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)
How would I go about getting videos like this to play in an embedded player or a custom player that I would make using MPMoviePlayer
or such. I know this is possible as following app does this. (http://itunes.apple.com/us/app/audioviz-view-your-songs-on/id547001249?mt=8)
编辑很少有视频在浏览器中播放,但在 iOS 模拟器中显示
Edit Few videos play in browser but in iOS Simulator its showing
This video contains content from SME . It is restricted from playback on certain site
感谢大家的帮助!
推荐答案
使用 uiwebview
播放 youtube 视频:
To play the youtube video using uiwebview
:
首先检查您的 youtube 网址是否在浏览器中播放.如果视频不能在浏览器中播放,它也不会在设备中播放
First check if your youtube URL is played or not in browser. If the video doesn't play in the browser it won't play in the device either
您只需签入设备;视频无法在模拟器中播放
You only check in the device; the video doesn't play in simulator
- (void) displayGoogleVideo
{
CGRect rect = [[UIScreen mainScreen] bounds];
CGSize screenSize = rect.size;
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,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];
}
这篇关于嵌入 Youtube 视频:- 包含来自 * 的内容,限制在某些网站上播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!