0
私はYouTubeの埋め込みプレーヤーでビデオを再生するために、次のようにコードを書いた。 プレーヤーウィンドウを開き、ビデオゲームを表示しますが、再生しません。iphone sdkのyoutubeプレーヤーのvidoesを再生
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];
}
uがコードに問題は何でしょう、私に言うことができます。
ありがとうございました。
ザッツ真実ではありませんyoutubeプレーヤー。しかし、フラッシュは本当にサポートされていません。 –
とにかくシミュレータとデバイスで再生されていません –
ビデオURLがiOSで再生できることを確認してください。つまり、flvではなくmovまたはmp4形式です。 – cxa