Player
Player copied to clipboard
Crash when removing playerLayer from superLayer
@piemonte
I have a stories like feed going on and for memory purposes, once a "story" is advanced, I clean up the player in the previous VC by setting player.playerView.playerLayer.player = nil
which works,.
But most important to free up memory I found is to playerLayer.removeFromSuperlayer()
This works fine if I use my own AVPlayer | AVPlayerLayer
instance but removing it from (player.playerView.layer as? AVPlayerLayer)?.removeFromSuperlayer()
produces a crash.
Why is that?