Ho un problema con MPMoviePlayerViewController, quando l'app entra in background e poi la lancio di nuovo o passa a un'altra vista. Il film è diventato nero! Ho filmato, che si sente in sottofondo dei miei menu, qui è il mio codice:MPMoviePlayerViewController diventa nero quando entra in background
EIDTED CODICE:
-(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");
}
grazie.
viene chiamato 'movieFinishedPlaying' quando l'app viene messa in secondo piano? Se non lo sai, imposta un breakpoint (o usa un NSLog sulla console) e scoprilo. –
quando passo tra viewControllers si. compiler mi mostra il messaggio NSLog –