0

我正在尝试制作Youtube video player内部应用程序(它在内部播放视频webview)。是否有任何基于此的教程。或任何示例程序?

提前致谢。

4

1 回答 1

1

您可以像这样在 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];
}
于 2013-07-20T10:12:38.440 回答