Error about using AVQueuePlayer

134 views Asked by At

I init a AVQueuePlayer like :

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]];

and I want to show it by AVPlayerViewController so I init a AVPlayerViewController like :

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

...

...

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

now I want to play it:

[player play];

Question: It always crashes at main when the first AVPlayerItem end play. Did I do something wrong or wrong way to show it? (AVPlayer is OK by this way)

0

There are 0 answers