【发布时间】:2013-07-20 10:07:26
【问题描述】:
我正在尝试在应用程序内制作Youtube video player(它在webview 本身内播放视频)。是否有任何基于this.or任何示例程序的教程?
提前致谢。
【问题讨论】:
标签: ios youtube-api
我正在尝试在应用程序内制作Youtube video player(它在webview 本身内播放视频)。是否有任何基于this.or任何示例程序的教程?
提前致谢。
【问题讨论】:
标签: ios youtube-api
您可以像这样在 web 视图中嵌入 youtube 视频:
- (void)embedYouTubeInWebView:(NSString*)url theWebView:(UIWebView *)aWebView {
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: white;\
}\
</style>\
</head><body style=\"margin:0\">\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
NSString* html = [NSString stringWithFormat:embedHTML, url, aWebView.frame.size.width, aWebView.frame.size.height];
[aWebView loadHTMLString:html baseURL:nil];
}
【讨论】: