Can you force a MPMoviePlayerPlaybackDidFinishNotification?
I have several movies that are played and presented using this code.
As you can see I also have removed the default movie controls and have added a custom overlay which essentially just stops the video.
Here is my problem... When I stop the movie with my custom overlay button, I don't seem to be getting the 'MPMoviePlayerPlaybackDidFinishNotification'
Note: everything works normal if I let the movie play through and it stop by itself.
Is the any way of 'forcing' the PlaybackDidFinish notification?
Can I do something like this [self moviePlayBackDidFinish:something]
; ?
Thank You!
- (void) playMovie {
NSString *path = [[NSBundle mainBundle] pathForResource:@"movie_frog" ofType:@"m4v"];
NSURL *url = [NSURL fileURLWithPath:path];
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:url];
if(mp) {
self.myMoviePlayer = mp;
[mp release];
//movie view
[self.view addSubview:myMoviePlayer.view];
myMoviePlayer.view.frame = CGRectMake(0.0,0.0,480,320);
self.myMoviePlayer.controlStyle = MPMovieControlStyleNone;
[self.myMoviePlayer play];
//videoNav
_videoNav = [[videoNav alloc] initWithNibName:@"videoNav" bundle:nil];
[self.view addSubview:_videoNav.view];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
开发者_开发问答 object:nil];
}
}
I use
[[NSNotificationCenter defaultCenter] postNotificationName: MPMoviePlayerPlaybackDidFinishNotification object:nil];
精彩评论