how to dismiss MPMoviePlayer ? properly from one ViewController to another
Now when the video is playing and reaches the end. the Notification works
great. This is what I have
NSURL * url = [[NSURL alloc]
initWithString:@"http://INFINITECREATIVEUNIVERSE.COM/Media/module_1_Dec/c_January27AffactPerfect.mov"];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[moviePlayer.view setFrame:CGRectMake(0, 0, 500, 260)];
[self.view addSubview:moviePlayer.view];
//Some addiontal customization
moviePlayer.fullscreen = YES;
moviePlayer.allowsAirPlay = YES;
moviePlayer.shouldAutoplay = YES;
moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
//moviePlayer.endPlaybackTime = NO;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playMovieFinished:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
// this part of Notification Works great. It finds the Segue no problem
-(void)playMovieFinished:(NSNotification*)theNotification {
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; //
Change Segue ID Here
[self performSegueWithIdentifier:@"VC_5" sender:self];
}
But when I click next while the video is playing and my next
ViewController has no video I can hear the video still playing from the
previous ViewController.
My question is this. To properly dismiss the View Controller and the
MPMoviePlayer. how do I do that? I am lost. I did download the file from
Apple to MoviePlayer. But it is now old and it will not work properly. I
am lost on how to make this work. So, how do I click the button for the
Next ViewController that has no Video. I am crossing my fingers that I
have answered the question correctly. Please have mercy on my novice
question. Thank you robert
No comments:
Post a Comment