First check if you are on OS 3.2 or above. If yes, create a movie player the new way:
if (NSClassFromString(@"UISplitViewController") != nil) {
MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:yourURL];
[[mp moviePlayer] prepareToPlay];
[[mp moviePlayer] setShouldAutoplay:YES];
[[mp moviePlayer] setControlStyle:2];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoPlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[self presentMoviePlayerViewControllerAnimated:mp];
} else {
moviePlayer=[[MPMoviePlayerController alloc] initWithContentURL:yourURL];
[self playMovieTheOldWay:moviePlayer];
}
You can close the new movie player like this:
-(void)videoPlayBackDidFinish:(NSNotification*)notification
{
[self dismissMoviePlayerViewControllerAnimated];
}