0
我正在處理YouTube視頻流並顯示youtube縮略圖圖像。如何發揮安全的YouTube網址開始與「https://」在ios SDK?
我使用的代碼顯示縮略圖:
NSString *Videoidtsr =[NSString stringWithFormat:@"%@",[strArray objectAtIndex:i]] ;
NSLog(@"vidoe sr %@",Videoidtsr);
NSString *YouTibevideoId=[Videoidtsr bstringByReplacingOccurrencesOfString:@"http://www.youtube.com/watch?v=" withString:@""];
youtubeURLForThumb = [NSURL URLWithString:[NSString stringWithFormat:@"http://img.youtube.com/vi/%@/0.jpg",YouTibevideoId]];
NSLog(@"youtubeURL %@",youtubeURLForThumb);
代碼播放YouTube視頻:
- (void)embedYouTube {
videoHTML = [NSString stringWithFormat:@"\
<html>\
<head>\
<style type=\"text/css\">\
body {background-color:#000; margin:0;}\
</style>\
</head>\
<body>\
<iframe width=\"100%%\" height=\"250px\" src=\"\%@\" frameborder=\"0\" allowfullscreen></iframe>\
</body>\
</html>", videoURL];
[videoView loadHTMLString:videoHTML baseURL:nil];
}
我用網址:http://www.youtube.com/watch?v=FQPJkXyn93c
它wokred罰款
但是這個代碼不工作的另一個URL:「https://www.youtube.com/watch?v=KULJOEkR0l4」
因爲它是保護的URL包含「https」開頭
如何發揮這種類型的網址也?以及如何創建縮略圖?我們可以在iphone中保護url嗎?
任何答案可以讚賞。
請幫我解決這個問題。
感謝