0
我有一個URL擴展數組。目標是分段的:迭代視頻數組iOS
將擴展名添加到基本URL以創建特定視頻的URL。使用YTViewExtractor在MPMovieViewController
播放視頻。
重複用於在陣列下一URL擴展時MPMovieFinishReasonPlaybackEnded = TRUE或當下次按鈕被按下
這是迄今我的工作:
int i;
for (i=0; i < [_uriToBeAppended count]; i++)
{
NSString *uriString = [_uriToBeAppended objectAtIndex:i];
NSString *urlString = [NSString stringWithFormat:@"http://vimeo.com/%@", uriString];
NSLog(@"URL String: %@", urlString);
[YTVimeoExtractor fetchVideoURLFromURL:urlString
quality:YTVimeoVideoQualityMedium
completionHandler:^(NSURL *videoURL, NSError *error, YTVimeoVideoQuality quality) {
if (error) {
// handle error
NSLog(@"Video URL: %@", [videoURL absoluteString]);
} else {
// run player
self.moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];
[self.moviePlayer.moviePlayer prepareToPlay];
[self presentViewController:self.moviePlayer animated:YES completion:nil];
}
}];
}
日誌:
2014-10-11 22:30:05.528 Voulette[668:162653] URL String: http://vimeo.com/96558506
.
.
2014-10-11 22:30:05.577 Voulette[668:162653] URL String: http://vimeo.com/6615855
2014-10-11 22:30:06.997 Voulette[668:162653] -[UIApplication beginIgnoringInteractionEvents] overflow. Ignoring.
.
.
2014-10-11 22:30:09.700 Voulette[668:162653] -[UIApplication beginIgnoringInteractionEvents] overflow. Ignoring.
2014-10-11 22:30:10.063 Voulette[668:162653] -[UIApplication endIgnoringInteractionEvents] called without matching -beginIgnoringInteractionEvents. Ignoring.
.
.
2014-10-11 22:30:10.189 Voulette[668:162653] -[UIApplication endIgnoringInteractionEvents] called without matching -beginIgnoringInteractionEvents. Ignoring.
2014-10-11 22:30:11.519 Voulette[668:162653] Warning: Attempt to present <MPMoviePlayerViewController: 0x1568fcd0> on <ViewController: 0x1554e3e0> whose view is not in the window hierarchy!
.
.
2014-10-11 22:30:11.729 Voulette[668:162653] Warning: Attempt to present <MPMoviePlayerViewController: 0x16818810> on <ViewController: 0x1554e3e0> whose view is not in the window hierarchy!
2014-10-11 22:30:11.739 Voulette[668:162653] -[UIApplication beginIgnoringInteractionEvents] overflow. Ignoring.
2014-10-11 22:30:11.742 Voulette[668:162653] Warning: Attempt to present <MPMoviePlayerViewController: 0x1681d690> on <ViewController: 0x1554e3e0> whose view is not in the window hierarchy!
.
.
2014-10-11 22:30:11.887 Voulette[668:162653] -[UIApplication beginIgnoringInteractionEvents] overflow. Ignoring.
2014-10-11 22:30:11.903 Voulette[668:162653] Warning: Attempt to present <MPMoviePlayerViewController: 0x157b1e70> on <ViewController: 0x1554e3e0> whose view is not in the window hierarchy!
2014-10-11 22:30:12.674 Voulette[668:162653] -[UIApplication endIgnoringInteractionEvents] called without matching -beginIgnoringInteractionEvents. Ignoring.
.
.
2014-10-11 22:30:12.699 Voulette[668:162653] -[UIApplication endIgnoringInteractionEvents] called without matching -beginIgnoringInteractionEvents. Ignoring.
日誌表明for循環遍歷所有元素的每個動作然後繼續執行循環中包含的下一個操作。
我有什麼是不能產生所需的輸出,我很感激任何反饋或建議。
這是一個非常狹窄的問題。在將來可能不會有用嗎? – Sirens 2014-10-12 05:08:59
我不同意你的觀點,我不知道如何更一般地設計它。如果您有任何建議可以爲其他用戶提供更大的價值,我很樂意進行編輯。 – 2014-10-12 15:06:21