我的應用程序中有一個腳本在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