简体   繁体   English

一个AVPlayerItem不能与多个播放多个视频的AVPlayer错误实例相关联

[英]An AVPlayerItem cannot be associated with more than one instance of AVPlayer error playing multiple videos

So I have searched every posting regarding this error and nothing has worked. 因此,我搜索了有关此错误的所有帖子,但没有任何效果。 What happens is that the first time I open the following view controller, everything works. 发生的事情是,当我第一次打开以下视图控制器时,一切正常。 But when I dismiss the controller and try to play the videos a second time, I get this error. 但是当我解雇控制器并尝试第二次播放视频时,出现此错误。 Not sure why. 不知道为什么。

  NSMutableArray *AVPlayerItems;

 AVQueuePlayer *player ;

  NSURL *url = [NSURL fileURLWithPath:filePath];

  AVPlayerItem *firstItem = [AVPlayerItem playerItemWithURL: url3];



       [AVPlaterItems addObject:firstItem];



        player = [AVQueuePlayer queuePlayerWithItems:AVPlayerItems];


            playerController = [AVPlayerViewController new];
            playerController.delegate = self;
            [self.viewPlayer addSubview:playerController.view];
            playerController.view.frame = self.viewPlayer.frame;

            playerController.showsPlaybackControls = NO;


            playerController.player = player;
            [playerController.player play];
        playerController.player.muted = YES;



        [self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
if(avPlayer==nil)
{

    avPlayer = [AVPlayer playerWithPlayerItem:_avPlayerItem];
}else{
    [avPlayer replaceCurrentItemWithPlayerItem:_avPlayerItem];

}

this will resolve this type of problems 这样可以解决这类问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AVPlayerItem不能与多个AVPlayer实例相关联 - An AVPlayerItem cannot be associated with more than one instance of AVPlayer' nsinvalidargumentexception'reason'avplayeritem无法与多个avplayer实例关联' - nsinvalidargumentexception' reason 'an avplayeritem cannot be associated with more than one instance of avplayer' '一个 AVPlayerItem 不能与多个 AVPlayer 实例相关联' - 'An AVPlayerItem cannot be associated with more than one instance of AVPlayer' AVPlayerItem不能与iOS 8.4中的多个AVPlayer实例相关联 - An AVPlayerItem cannot be associated with more than one instance of AVPlayer in iOS 8.4 应用此错误消息检查网络后,应用程序崩溃:AVPlayerItem无法与多个AVPlayer实例关联 - App crashes after checking network with this error message : An AVPlayerItem cannot be associated with more than one instance of AVPlayer 崩溃 - [AVPlayerItem _attachToPlayer:] AVPlayerItem不能与多个AVPlayer实例关联 - Crash in -[AVPlayerItem _attachToPlayer:] An AVPlayerItem cannot be associated with more than one instance of AVPlayer iOS 8.4 AVFoundation _attachToPlayer或_attachToFigPlayer崩溃| 一个AVPlayerItem不能与一个以上的AVPlayer实例关联 - iOS 8.4 AVFoundation _attachToPlayer or _attachToFigPlayer crash | An AVPlayerItem cannot be associated with more than one instance of AVPlayer 查找与 AVPlayerItem 关联的 AVPlayer - Find the AVPlayer associated with an AVPlayerItem 防止AVPlayer一次播放多个曲目的最佳方法 - Best way to prevent AVPlayer playing more than one track at a time AVPlayer不播放本地视频 - AVPlayer not playing local videos
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM