- (void)viewDidLoad {
[super viewDidLoad];
NSURL *videoURL = [[NSBundle mainBundle]URLForResource:@"thoughtcastAnimate_v02" withExtension:@"mov"];
// create an AVPlayer
AVPlayer *player = [AVPlayer playerWithURL:videoURL];
// create a player view controller
AVPlayerViewController *controller = [[AVPlayerViewController alloc]init];
controller.player = player;
[player play];
// show the view controller
[self addChildViewController:controller];
[self.view addSubview:controller.view];
controller.view.frame = self.view.frame;
// Do any additional setup after loading the view.
}
这对于mp4文件可以正常工作。但我需要播放.mov文件!这是为了我的应用启动画面。我已将.mov文件添加到资源中,但不确定该怎么做。
addSubview
,然后再调用play
。 - Shebuka