I noticed that registerNotifications is called every time the player is set, which happens both on play and on reset.
private var player: AVPlayer? {
didSet {
registerNotifications()
}
}
Should this didSet have an unregisterNotifications for when you set nil maybe?
I'm running into a problem where I incessantly have onVideoFinished called every time reset and play a video.
func play() {
if let player = videoView.playerLayer.player{
player.play()
} else {
// First run
videoView.isLooping = configuration?.shouldLoop ?? videoView.isLooping
videoView.onVideoFinished = {
print("onVideoFinished")
}
videoView.play()
}
Every time I close and open/play, I get progressively more logs of onVideoFinished
I noticed that
registerNotificationsis called every time theplayeris set, which happens both onplayand onreset.Should this didSet have an unregisterNotifications for when you set
nilmaybe?I'm running into a problem where I incessantly have
onVideoFinishedcalled every time reset and play a video.Every time I close and open/play, I get progressively more logs of
onVideoFinished