itemFailedToPlayToEnd - MPMoviePlayerController - iOS7
Correndo em um problema estranho ao atualizar meu aplicativo paraiOS 7
. ParaiOS 6
, não há problema e os vídeos são sempre carregados. No entanto, esse não é o caso aqui.
eu tenho umscrollview
que exibeplaylistItems
- e depois de clicar noplaylistItem
, umaMPMoviePlayerController
é criado para mostrar o item da lista de reprodução (vídeo).
Aqui está o método que acredito estar causando problemas:
- (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];
}
O filme está sendo carregado para oMovieContainerView
.
- (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];
}
É estranho que isso funcioneiOS 6
mas nãoiOS 7
Aqui estão os erros do NSLog quando um vídeo não é carregado / reproduzido:<Error>: CGImageCreate: invalid image size: 0 x 0.
e:_itemFailedToPlayToEnd: { kind = 1; new = 2; old = 0; }