Я пытаюсь заставить MPMoviePlayerController работать, но есть странная проблема. При воспроизведении I нажмите кнопку Готово и, кажется, бесконечный взгляд срабатывает: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] воспроизведениеИнформация. Причина: Пользователь возбужденного
Я использую следующие уведомления о запуске:
- (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)