How can I associate an instance AVPlayerItemwith a new one AVPlayerin Swift? When used in an initializer. Every time I try to reassign AVPlayerItemto another AVPlayereven after I set all the links AVPlayerto nil(so that it collects garbage), he complains that AVPlayerItemhe cannot be assigned to more than one object AVPlayer. I understand several ways around this, but I want to know why this method does not work.
let player: AVPlayer = AVPlayer(playerItem: somePlayerItem)
I don’t know what happens during this announcement, but something is installed somewhere to let somePlayerItem know that it has a related player. Does it have some set of observers somewhere or a set of properties that would notice this?
Does anyone know a way to reassign this AVPlayerItemto another AVPlayerafter the original links AVPlayerhave been destroyed? I know that I can just create a new one AVPlayerItemusing the URL, but I want to know if I can save the same object.
source
share