itemFailedToPlayToEnd - MPMoviePlayerController - iOS7
Сталкиваюсь со странной проблемой при обновлении моего приложения дляiOS 7
, ЗаiOS 6
, нет проблем, и видео всегда загружается. Однако это не тот случай.
у меня естьscrollview
который отображаетplaylistItems
- и как только вы нажмете наplaylistItem
,MPMoviePlayerController
создан, чтобы показать элемент списка воспроизведения (видео).
Вот метод, который, я считаю, вызывает проблемы:
- (void) play:(NSInteger)itemId withAutostart:(BOOL)autostart {
// remember whether it is in fullscreen or not to restore for the next playlist item
self.playerInFullscreen = self.player.isFullscreen;
if (player != nil) {
[self.player setFullscreen:NO animated:NO];
[self stopListeningPlaybackFinishedEvents];
[player stop];
[self startListeningPlaybackFinishedEvents];
}
PlaylistItem * pi = [dbHelper getPlaylistItem:itemId];
NSURL *movieURL = [pi getMovieUrl];
if (DELEGATE.useSSL) {
NSURLCredential *credential = [[NSURLCredential alloc]
initWithUser: DELEGATE.username
password: DELEGATE.password
persistence: NSURLCredentialPersistenceForSession];
NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc]
initWithHost: [movieURL host]
port: 80
protocol: [movieURL scheme]
realm: [movieURL host]
authenticationMethod: NSURLAuthenticationMethodHTTPBasic];
[[NSURLCredentialStorage sharedCredentialStorage]
setDefaultCredential: credential
forProtectionSpace: protectionSpace];
[protectionSpace release];
[credential release];
}
MPMoviePlayerController * temp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
[temp prepareToPlay];
self.player = temp;
[temp release];
player.shouldAutoplay = autostart;
player.view.frame = movieViewContainer.bounds;
[movieViewContainer addSubview:player.view];
NSLog(@"movie added to subview");
[player setFullscreen:self.playerInFullscreen animated:NO];
[self.view setNeedsDisplay];
}
Фильм загружается в.MovieContainerView
- (void)playlistItemSelected:(NSInteger)itemId withAutostart:(BOOL) autostart {
for(UIView *subview in [thumbsScrollView subviews]) {
if ([subview isKindOfClass:[PlaylistItemView class]] == YES ) {
PlaylistItemView *piv = ((PlaylistItemView *) subview);
[piv setCurrent: piv.playlistItem._id == itemId];
if (piv.playlistItem._id == itemId) {
[self ensurePlaylistItemViewVisible:piv];
}
}
}
[[movieViewContainer subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
self.currentPlaylistItem = [dbHelper getPlaylistItem:itemId];
[self updateMetadataArea:itemId];
if ([_currentPlaylistItem.type isEqual:VIDEO_TYPE]) {
self.zoomButtonOut.hidden = YES;
self.zoomButtonIn.hidden = YES;
[self play:itemId withAutostart:autostart];
}
else {
[self.player pause];
_zoomButtonIn.alpha = ZOOM_BUTTON_ALPHA;
_zoomButtonOut.alpha = ZOOM_BUTTON_ALPHA;
[self showPDFandImage:_currentPlaylistItem];
}
[self scrollViewDidEndDecelerating:nil];
}
Это'странно, что это работает дляiOS 6
но нетiOS 7
Вот ошибки NSLog, когда видео не загружается / не воспроизводится:: CGImageCreate: invalid image size: 0 x 0.
и я'_itemFailedToPlayToEnd: { kind = 1; new = 2; old = 0; }