2012-11-19 73 views
0

我有一個現有應用程序的問題,問題是該應用程序在UIScrollView中的應用程序中播放Youtube視頻,但是在我安裝了新的Xcode SDK 4.5.2影片有一個空白的白色正方形,他們沒有工作像他們用來當我對他們的挖掘,這裏是我在我的應用程序的代碼:Youtube視頻框架沒有出現或在iOS中播放6

- (void)playVideo:(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.scrollView addSubview:videoView]; 
[videoView release]; 
NSLog(@"%@",html); 
} 

- (void)viewDidLoad 
{ 

[self playVideo:@"http://www.youtube.com/...." frame:CGRectMake(5, 20, 110, 110)]; 

[self playVideo:@"http://www.youtube.com/...." frame:CGRectMake(5, 170, 110, 110)]; 

[self playVideo:@"http://www.youtube.com/...." frame:CGRectMake(5, 320, 110, 110)]; 

[self playVideo:@"http://www.youtube.com/...." frame:CGRectMake(5, 470, 110, 110)]; 

[self playVideo:@"http://www.youtube.com/...." frame:CGRectMake(5, 620, 110, 110)]; 

[self playVideo:@"http://www.youtube.com/...." frame:CGRectMake(5, 765, 110, 110)]; 


[scrollView setScrollEnabled:YES]; 
[scrollView setContentSize:CGSizeMake(320,1400)]; 

[super viewDidLoad]; 
} 

我不知道我需要在這個改變代碼讓它們出現並再次播放。

回答

0

我找到了解決我的問題的方法。我需要在我的代碼來改變唯一的辦法就是更換驗證碼:這個代碼

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 *embedHTML = @"<body style=\"margin:0\"> <iframe height=\"110\" width=\"110\"  src=\"http://www.youtube.com/embed/HERE YOU PUT THE ID OF YOUR VIDEO\" frameborder=\"0\"/></iframe></body> "; 
相關問題