itemFailedToPlayToEnd - MPMoviePlayerController - iOS7

En cours d'exécution dans un drôle de problème lors de la mise à jour de mon application pour iOS 7. Pour iOS 6, il n'y a pas de problème et les vidéos sont toujours chargées. Cependant ce n'est pas le cas ici.

J'ai un scrollview qui affiche playlistItems - et une fois que vous cliquez sur le playlistItem, un MPMoviePlayerController est créé pour afficher la liste de lecture de l'élément (vidéo).

Voici la méthode que je crois est à l'origine de problèmes:

- (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];
}

Le film devient chargé de l' 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];
 }

C'est bizarre que cela fonctionne pour iOS 6 mais pas iOS 7

Voici le NSLog erreurs quand une vidéo ne prend pas en charge/lecture: <Error>: CGImageCreate: invalid image size: 0 x 0. et: _itemFailedToPlayToEnd: {
kind = 1;
new = 2;
old = 0;
}

Je vais avoir le même problème que sur iOs7 je reçois aussi des erreur -11828 quelqu'un a trouvé la solution pour cela?
Avez-vous essayez d'écouter les MPMoviePlayerPlaybackDidFinishNotification de notification ? Il peut contient un objet error.

OriginalL'auteur OxenBoxen | 2013-09-30