So I have a login page that has a video looping in the background and I have done this with the following code:
videoPlayer.play()
NotificationCenter.default.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: videoPlayer.currentItem, queue: .main) { [weak self] _ in
self?.videoPlayer?.seek(to: CMTime.zero)
self?.videoPlayer?.play()
}
Question is do I have to remove this observer at deinit or something and if so how do I go about removing the .AVPlayerItemDidPlayToEndTime observer. Not sure of the syntax when it comes to removing these built in observers.