'An AVPlayerItem cannot be associated with more than one instance of AVPlayer'

前端 未结 6 1250
醉酒成梦
醉酒成梦 2020-12-21 11:20

I know this question is all over Stack Overflow but still, most of them are old and not related with what I\'m going to ask here.

So I\'ve got an array with AV

6条回答
  •  旧时难觅i
    2020-12-21 11:58

    The problem is that you're creating a new player object when you update the array of items with this line (in tableView:commitEditingStyle:forRowAtIndexPath:),

    audioPlayer = AVQueuePlayer(items: mediaArray)
    

    It seems that the player items are still associated with the original player when you do this. You should be able to delete that line, to make it work properly. Inserting or deleting items from mediaArray should be enough to do what you want; you don't need to create a new player.

提交回复
热议问题