【发布时间】:2012-10-13 01:35:00
【问题描述】:
【问题讨论】:
标签: iphone objective-c ios cocoa-touch video
【问题讨论】:
标签: iphone objective-c ios cocoa-touch video
此代码应将 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 文件类型
【讨论】: