使用AVQueuePlayer时出错

时间:2016-12-15 04:01:18

标签: ios avplayerviewcontroller avqueueplayer avplayeritem

我初始化AVQueuePlayer,如:

AVPlayerItem *item1 = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://XXX.mp4"]];
AVPlayerItem *item2 = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://YYY.mp4"]];
AVQueuePlayer player = [[AVQueuePlayer alloc]initWithItems:@[item1,item2]];

我希望通过AVPlayerViewController展示它,所以我初始化一个AVPlayerViewController:

AVPlayerViewController  *playerController = [[AVPlayerViewController alloc] init];
playerController.player = player;

...

...

[self.view addSubview:_playerController.view];
[self addChildViewController:_playerController];

现在我想玩它:

[player play];

问题: 当第一个AVPlayerItem结束播放时,它总是在main处崩溃。 我做错了什么或错误的方式展示它? (通过这种方式AVPlayer可以)

0 个答案:

没有答案