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
It is required to check that the player item can be inserted into the player’s queue. Then add, remove or replace the player item based on the conditions as below:
if player.canInsert(playerItem, after: nil) == true {
player = AVQueuePlayer(playerItem: playerItem)
} else {
player.remove(self.playerItem)
player.replaceCurrentItem(with: playerItem)
}