2012-02-13 10 views
0

MPMoviePlayerControllerを動作させようとしましたが、奇妙な問題があります。再生するとき私は、[完了]ボタンをクリックして、そこに思わ無限の表情がトリガー:MPMoviePlayerControllerは 'Done'をタップすると無限ループを返します

2012-02-13 15:18:04.395 iDomsPortalDev [7376:12203]はplaybackFinished。 理由:ユーザーが参加しました2012-02-13 15:18:04.395 iDomsPortalDev [7376:12203] playbackFinished理由:ユーザーが参加しました2012-02-13 15:18:04.395 iDomsPortalDev [7376:12203] playbackFinished理由:

- (void) showMoviePlayer { 
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterFullscreen:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil]; 
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willExitFullscreen:) name:MPMoviePlayerWillExitFullscreenNotification object:nil]; 
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enteredFullscreen:) name:MPMoviePlayerDidEnterFullscreenNotification object:nil]; 
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exitedFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:nil]; 
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];  

    id appDelegate = (iDomsAppDelegate *)[[UIApplication sharedApplication] delegate]; 
    //[[self navigationController] presentMoviePlayerViewControllerAnimated:[appDelegate movieController]];  
    [[appDelegate moviePlayer].view setFrame: self.view.bounds]; 
    [self.view addSubview:[appDelegate moviePlayer].view]; 
    [[appDelegate moviePlayer] setFullscreen:YES animated:YES];  
} 

と、次のリスナー:

#pragma mark - Movieplayer feedback 
- (void)willEnterFullscreen:(NSNotification*)notification { 
    NSLog(@"willEnterFullscreen"); 
} 

- (void)enteredFullscreen:(NSNotification*)notification { 
    NSLog(@"enteredFullscreen"); 
} 

- (void)willExitFullscreen:(NSNotification*)notification { 
    NSLog(@"willExitFullscreen"); 
} 

- (void)exitedFullscreen:(NSNotification*)notification { 
    NSLog(@"exitedFullscreen"); 
    iDomsAppDelegate *appDelegate = (iDomsAppDelegate *)[[UIApplication sharedApplication] delegate];  
    [[appDelegate moviePlayer].view removeFromSuperview]; 
    [[appDelegate moviePlayer] release]; 
    [appDelegate setMovieController:nil]; 
    [[NSNotificationCenter defaultCenter] removeObserver:self]; 
} 

- (void)playbackFinished:(NSNotification*)notification { 
    iDomsAppDelegate *appDelegate = (iDomsAppDelegate *)[[UIApplication sharedApplication] delegate];  
    NSNumber* reason = [[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey]; 
    switch ([reason intValue]) { 
     case MPMovieFinishReasonPlaybackEnded: 
      NSLog(@"playbackFinished. Reason: Playback Ended");   
      break; 
     case MPMovieFinishReasonPlaybackError: 
      NSLog(@"playbackFinished. Reason: Playback Error"); 
      break; 
     case MPMovieFinishReasonUserExited: 
      NSLog(@"playbackFinished. Reason: User Exited"); 
      break; 
     default: 
      break; 
    } 
    [[appDelegate moviePlayer] setFullscreen:NO animated:YES]; 
} 

のみPlayBackFinishedセレクタがそうそこに、(無限回)と呼ばれているユーザーは、私がスタートで、次の通知を使用

を終了しました私は何か愚かでなければならない(iOS5でシミュレータで動いている)

答えて

0

私は問題を見つけた。それを引き起こしたフルスクリーンオプションを設定しました:

[[appDelegate moviePlayer] setFullscreen:YES animated:YES]; 
関連する問題