我制作了一个 AVQueuePlayer 并添加了一些视频项目。当我运行应用程序时,视频的声音播放但视频没有显示。我知道视频没有显示的原因,那是因为我不知道如何在视图中添加 AVQueuePlayer。请帮我
NSString *firstVideoPath = [[NSBundle mainBundle]
pathForResource:@"3" ofType:@"m4v"];
NSString *secondVideoPath = [[NSBundle mainBundle]
pathForResource:@"2" ofType:@"m4v"];
NSString *thirdVideoPath = [[NSBundle mainBundle]
pathForResource:@"3" ofType:@"m4v"];
AVPlayerItem *firstVideoItem = [AVPlayerItem playerItemWithURL:
[NSURL fileURLWithPath:firstVideoPath]];
AVPlayerItem *secondVideoItem = [AVPlayerItem playerItemWithURL:
[NSURL fileURLWithPath:secondVideoPath]];
AVPlayerItem *thirdVideoItem = [AVPlayerItem playerItemWithURL:
[NSURL fileURLWithPath:thirdVideoPath]];
self.queuePlayer = [AVQueuePlayer queuePlayerWithItems:
[NSArray arrayWithObjects:firstVideoItem,
secondVideoItem,thirdVideoItem,nil]];
[self.playerView setPlayer:self.queuePlayer];
[self.queuePlayer play];