我一直在寻找通过该应用程序播放 YouTube 视频的大量教程。但是他们正在制作一个空白屏幕。根据对教程的评论,这在 xocde 5 上很常见吗?有没有其他方式可以流式传输视频?我在 iphone 上运行它并连接了 webview。
我正在使用:
.h
@interface detailViewController : UIViewController {
IBOutlet UIWebView *webView;
}
查看已加载
NSURL *url = [NSURL URLWithString:@"<iframe width=\"560\" height=\"315\" src=\"//www.youtube.com/embed/AmMF7hWrYZk\" frameborder=\"0\" allowfullscreen></iframe>"];
NSURLRequest *requestURL = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestURL];
最佳答案
UIWebView *web;
NSString *pageHTML = [[NSBundle mainBundle] pathForResource:@"url" ofType:@"html"];
NSString *htmlString = [NSString stringWithContentsOfFile:pageHTML encoding:NSUTF8StringEncoding error:nil];
[web loadHTMLString:htmlString baseURL:nil];
url.html中的代码是
<html> <head></head> <body> <iframe src='http://player.vimeo.com/video/73198189?title=1&byline=0&portrait=0&loop=1' width='690' height='500' frameborder='10' webkitAllowFullScreen mozallowfullscreen allowFullScreen>myframe</iframe> </body>
我已经使用此代码播放 vimeo 视频并且有效..希望这对您有帮助..
关于ios - 在 Xcode 5 中加载 youtube URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21380581/