使用MPMoviePlayerViewController播放视频

MPMoviePlayerViewController是苹果提供的播放视频的控制器,可以直接从当前的控制器中推出即可。

 NSBundle *bundle = [NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:@"Movie" ofType:@"m4v"];
NSURL *movieURL = [NSURL fileURLWithPath:moviePath];

MPMoviePlayerViewController *moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];


moviePlayerViewController.moviePlayer.controlStyle = MPMovieControlStyleFullscreen;

[self presentMoviePlayerViewControllerAnimated:moviePlayerViewController];



posted @ 2012-04-06 21:15  FoxBabe  阅读(872)  评论(0编辑  收藏  举报