Ich benutze MPMoviePlayerController, um ein kleines Video als ein Intro-Video meiner App zu spielen. Ich habe den folgenden Code verwendet und das funktioniert gut. Aber das Video spielt weiter. Ende und startet erneut. Und selbst wenn ich auf die Schaltfläche "Fertig" klicke, wird die Superansicht nicht entfernt. Ich möchte auch, dass meine Statusleiste sichtbar ist und ich es durchscheinend immer noch nicht ergebnis. Ich habe auf Google und Stack Overflow gesucht aber immer noch keine Hilfe. Jede Hilfe wäre sehr spürbar.MPMoviePlayerController verhält sich nicht richtig
Ich habe [self playMovie]
Methode in viewDidAppear
-(void)playMovie
{
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"avc_intro" ofType:@"mp4"]];
moviePlayer = [[MPMoviePlayerController alloc]
initWithContentURL:url];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
name:MPMoviePlayerWillExitFullscreenNotification
object:moviePlayer];
moviePlayer.controlStyle = MPMovieControlStyleDefault;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES animated:YES];
}
- (void) moviePlayBackDidFinish:(NSNotification*)notification
{
MPMoviePlayerController *videoplayer = [notification object];
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:videoplayer];
if ([videoplayer
respondsToSelector:@selector(setFullscreen:animated:)])
{
[videoplayer.view removeFromSuperview];
}
}
Wenn ich es in ViewDidLoad aufrufen, spielt es nicht – iDeveloper
Überprüfen Sie mein Update in Antwort – Lion
Danke Kumpel :) @Lion – iDeveloper