iphone播发本地视频
iphone播放本地视频- (void)playPreviewVideo {[UIApplication sharedApplication].statusBarHidden YES
iphone播放本地视频
- (void)playPreviewVideo {[UIApplication sharedApplication].statusBarHidden = YES;NSString *urlStr = [[NSBundle mainBundle] pathForResource:@"app" ofType:@"mp4"];NSURL *url = [NSURL fileURLWithPath:urlStr];if (!url) {return;}MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] init];theMovie.view.backgroundColor = [UIColor blackColor];theMovie.movieSourceType = MPMovieSourceTypeFile;theMovie.scalingMode = MPMovieScalingModeAspectFill;theMovie.controlStyle = MPMovieFinishReasonUserExited;theMovie.view.frame = CGRectMake(0, 0, 480, 320);[self.view addSubview:theMovie.view];[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallback:)? name:MPMoviePlayerPlaybackDidFinishNotification? ? object:theMovie];[theMovie setContentURL:url];[theMovie play];}
- (void)myMovieFinishedCallback:(NSNotification *)aNotification {MPMoviePlayerController *theMovie = [aNotification object];[[NSNotificationCenter defaultCenter] removeObserver:self?name:MPMoviePlayerPlaybackDidFinishNotification? ?object:theMovie];[theMovie.view removeFromSuperview];[theMovie release];theMovie = nil;[UIApplication sharedApplication].statusBarHidden = YES;}