Can you force a MPMoviePlayerPlaybackDidFinishNotification ?

Posted by Jonathan on Stack Overflow See other posts from Stack Overflow or by Jonathan
Published on 2010-04-04T08:44:39Z Indexed on 2010/04/04 8:53 UTC
Read the original article Hit count: 788

Hi, 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];



}

}

© Stack Overflow or respective owner

Related posts about iphone

Related posts about mpmovieplayercontroller