AVPlayer没有播放.mov文件

时间:2017-11-09 17:09:34

标签: ios objective-c avplayer

- (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文件添加到资产中。不知道该怎么做。

1 个答案:

答案 0 :(得分:0)

我只需要将我的mov文件添加到Build Phases