From d4e82d6e7a80f2ab49f9afb50e84683509c98598 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 23 May 2024 14:29:56 -0400 Subject: [PATCH] Fix AVPlayer periodic time observers not being removed --- Tusker/Screens/Gallery/VideoControlsViewController.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tusker/Screens/Gallery/VideoControlsViewController.swift b/Tusker/Screens/Gallery/VideoControlsViewController.swift index a7eac5bf3a..f99b52fd3e 100644 --- a/Tusker/Screens/Gallery/VideoControlsViewController.swift +++ b/Tusker/Screens/Gallery/VideoControlsViewController.swift @@ -120,6 +120,15 @@ class VideoControlsViewController: UIViewController { fatalError("init(coder:) has not been implemented") } + deinit { + if let timestampObserverToken { + player.removeTimeObserver(timestampObserverToken) + } + if let scrubberObserverToken { + player.removeTimeObserver(scrubberObserverToken) + } + } + override func viewDidLoad() { super.viewDidLoad()