I am trying to build the back button with functionality that on click of that button the video that is playing should stop.
In my case it removes from the superview but the video is still playing in the background.
I am doing as below but it is not working
-(IBAction)backButtonPressed
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieDidExitFullScreen:) name:MPMoviePlayerPlaybackDidFinishNotification object:player];
[self.navigationController popViewControllerAnimated:YES];
}
- (void) movieDidExitFullScreen:(NSNotification*)notification
{
[[NSNotificationCenter defaultCenter] removeObserver: self
name:MPMoviePlayerPlaybackDidFinishNotification
object: [notification object]];
MPMoviePlayerController *theMovie1 = [notification object];
[self.navigationController popViewControllerAnimated:YES];
[theMovie1 release];
}
Replace your back button Action event to below.
This will stop player and release it before going back. Hope this help.