IPhone applicationsUsing MPMoviePlayerControllerVideo PlaybackThis article focuses on how to use MPMoviePlayerController Based on code.Video PlaybackFor details,
- -(Void) openMovie :( id) sender
- {
- NSString * path = [[NSBundle mainBundle] pathForResource: @ "movie" ofType: @ "m4v"];
- MPMoviePlayerController * movieController = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL fileURLWithPath: path];
- // Set the position of the video to be played
- [[Nsicationcenter center defacenter center] addObserver: self selector: @ selector (movieFinish :) name:
- MPMoviePlayerPlaybackDidFinishNotification object: movieController]; // sets the callback processing after the video is played.
- [MovieController play]; // video playback
- }
- -(Void) movieFinish :( NSNotification *) notification
- MPMoviePlayerController * movieController = [notification object];
- [[Nsnotifcenter center defacenter center] removeObserver: self name: MPMoviePlayerPlaybackDidFinishNotification object: movieController];
- [MovieController release]; // release resources
- MovieController = nil;
- [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationPortrait animated: YES];
Summary:IPhone applicationsUsing MPMoviePlayerControllerVideo PlaybackI hope this article will help you!