2012-10-12 51 views

回答

1

此代码应该添加一个MPMoviePlayerController到您的视图,并自动开始使用已导入到你的项目。

NSString *filepath = [[NSBundle mainBundle] pathForResource:@"filename" ofType:@"mp4"]; 
NSURL *fileURL = [NSURL fileURLWithPath:filepath]; 
player = [[MPMoviePlayerController alloc] initWithContentURL:fileURL]; 
player.frame = CGRectMake(0, 0, 1024, 768); 
[self.view addSubview:player.view]; 
player.fullscreen = NO; 
[player play]; 

*例如我使用的.mp4文件类型

相关问题