/ Published in: Objective C
- include MediaPlayer framework in the project
- in the view controller header file,
- declare the player instance in the controller header file: MPMoviePlayerViewController *playerViewController;
Expand |
Embed | Plain Text
{ playerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:url]]; addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:[playerViewController moviePlayer]]; [self.view addSubview:playerViewController.view]; //play movie MPMoviePlayerController *player = [playerViewController moviePlayer]; [player play]; } // The call back MPMoviePlayerController *player = [aNotification object]; removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player]; //player.initialPlaybackTime = -1; //[player pause]; [player stop]; [player.view removeFromSuperview]; [player release]; // call autorelease the analyzer says call too many times // call release the analyzer says incorrect decrement }
You need to login to post a comment.
