Mam problem z MPMoviePlayerViewController, gdy aplikacja wchodzi w tle, a następnie uruchomię go ponownie lub przejść inny viewControllers film stał się czarny! Mam film, który odgrywa w tle mojego menu, tutaj jest mój kod:MPMoviePlayerViewController staje się czarny po wejściu w tło
EIDTED KOD:
-(void)viewDidLoad {
[self moviePlayer2];
}
- (void) moviePlayer2 {
NSString *path = [[NSBundle mainBundle] pathForResource:@"cloud" ofType:@"mp4"];
player = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path]];
player.view.userInteractionEnabled = YES;
player.moviePlayer.repeatMode = YES;
player.moviePlayer.scalingMode = MPMovieScalingModeFill;
player.moviePlayer.controlStyle = MPMovieControlStyleNone;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackStateChange:)
name:MPMoviePlayerPlaybackStateDidChangeNotification
object:[player moviePlayer]];
[[player moviePlayer] play];
[self.view addSubview:player.view];
}
-(void) moviePlayBackStateChange: (NSNotification *) note {
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackStateDidChangeNotification object:[player moviePlayer]];
[[player moviePlayer] play];
//[player release];
NSLog(@"FINISHED");
}
dziękuję.
Czy funkcja "movieFinishedPlaying" jest wywoływana, gdy aplikacja przechodzi w tło? Jeśli nie wiesz, ustaw punkt przerwania (lub użyj NSLog do konsoli) i dowiedz się. –
kiedy przełączam między viewController tak. kompilator pokaże mi wiadomość NSLog –