我正在尝试制作Youtube video player
内部应用程序(它在内部播放视频webview
)。是否有任何基于此的教程。或任何示例程序?
提前致谢。
您可以像这样在 webview 中嵌入 youtube vids:
- (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];
}