views:

9

answers:

0

-(IBAction)play{

NSString *url = [[NSBundle mainBundle] pathForResource:@"mm_v0" ofType:@"mp4"]; NSLog(@"Filepath is: %@",url);

MPMoviePlayerViewController *playerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:url]];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:[playerViewController moviePlayer]];

[self.view addSubview:playerViewController.view];

//---play movie---r MPMoviePlayerController *player = [playerViewController moviePlayer]; [player play]; //[player release];

//[super viewDidLoad];

}

  • (void) movieFinishedCallback:(NSNotification*) aNotification { MPMoviePlayerController *player = [aNotification object]; [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player]; [player stop]; [self.view removeFromSuperview]; [player release];
    }

i trying to make a function to press btn to play video, but after that why i can't go back to may btn layer? ,if video finished or press done btn, it go to blank page. why?THX