0
我编写的代码如下,在youtube嵌入式播放器中播放视频。 它打开播放器窗口并显示视频,但不播放。在iphone中播放视频播放器中的视频播放器
if(self.isYouTube)
{
NSString *embedHTML;
NSComparisonResult order = [[UIDevice currentDevice].systemVersion compare: @"4.3" options: NSNumericSearch];
if (order == NSOrderedSame || order == NSOrderedDescending) {
embedHTML = @"<html><head><style type=\"text/css\">body {background-color:black; color:black; margin-right:auto; margin-left:auto;}</style></head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@\" airplay=\"allow\" type=\"application/x-shockwave-flash\" position=\"fixed\" allowfullscreen=\"true\" autoplay=\"1\" width=\"320.0\" height=\"460.0\"></embed></body></html>";
} else {
embedHTML = @"<html><head><style type=\"text/css\">body {background-color:black; color:black; margin-right:auto; margin-left:auto;}</style></head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" position=\"fixed\" allowfullscreen=\"true\" autoplay=\"1\" width=\"320.0\" height=\"460.0\"></embed></body></html>";
}
NSString *contentHtml = [NSString stringWithFormat:embedHTML,self.url];
[self.webView setBackgroundColor:[UIColor blackColor]];
[self.webView loadHTMLString:contentHtml baseURL:nil];
}
else
{
NSURL *urlForOpenFile=[NSURL URLWithString:self.url];
NSURLRequest *request=[NSURLRequest requestWithURL:urlForOpenFile];
[self.webView loadRequest:request];
}
你能告诉我,代码中有什么问题。
谢谢。
那不是真实的,你仍然可以在播放嵌入的内容从YouTube youtube播放器。尽管如此,iOs不支持Flash。 –
anyways..it不玩在模拟器和设备也 –
请确保您的视频网址可以在iOS上播放,说,mov或mp4格式,而不是flv。 – cxa