我的应用程序中有一个脚本在UIView的一部分中加载Youtube链接,该链接由我的服务器(mySQL /使用php)提供,并从中载入。 ..这个脚本下面工作正常.....但是...Youtube-iPhone-显示视频UIWebView
这是我现在有什么,我正在寻找删除程序化的部分(它给出的尺寸,并可能取代它与UIWebView)所以我可以即兴使用IB,这将有助于我的应用程序启动时,发生快速动画,然后我希望这个youtube链接加载并在viewDidLoad完成后显示。
.h文件中:
- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame;
.m文件
//view did load function...
[self embedYouTube:youtubestring frame:CGRectMake(69,72,184,138)];
//after the view did load is closed I have..
- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame {
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, urlString, frame.size.width, frame.size.height];
UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame];
[videoView loadHTMLString:html baseURL:nil];
[self.view addSubview:videoView];
[videoView release];
}
任何帮助将大大感激!谢谢
其实我的代码现在工作开不起来了youtube的应用程序,实际上播放youtube视频(从应用程序内),只是说,它在应用程序商店...它只是使用CGRect,而不是界面生成器....我明白iPhone不支持Flash,然而,他们认为他们可能是一种解决方法...谢谢,虽然... – chance 2011-01-18 23:14:19
这个链接告诉你如何嵌入你管视频:http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-移动apps.html – 2012-05-14 04:53:58