Open sureshjoshi opened 1 month ago
As an example, I just scrolled through a handful of videos in a collection view, and when I played my next video, I had about 50 onVideoFinished
queued up and printed 🤯
I'm sure this has to do with my views being cached, but I'm also wiping out the handler during cleanup, so it's all strange 😆
Note: I don't have a full fix yet, but as a quick workaround, I'm manually calling NotificationCenter.default.removeObserver(videoView)
after I reset the videoView, and also when I'm doing any cleanup in prepareForReuse
or elsewhere.
That has mitigated the problem for the most part today. Will come back to this when I get to re-factor that part of my code in the next few months.
I noticed that
registerNotifications
is called every time theplayer
is set, which happens both onplay
and onreset
.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.Every time I close and open/play, I get progressively more logs of
onVideoFinished