             player?.removeObserver(self, forKeyPath: "currentItem.playbackLikelyToKeepUp")
             player?.removeObserver(self, forKeyPath: "currentItem.playbackBufferEmpty")
             player?.removeObserver(self, forKeyPath: "externalPlaybackActive")
+
+            if let timeObserver = self.timeObserver {
+                player?.removeTimeObserver(observer: timeObserver)
+            }
         }
 
         NotificationCenter.default.removeObserver(self)

    }

    fileprivate func addTimeElapsedCallback() {
        player?.addPeriodicTimeObserver(forInterval: CMTimeMakeWithSeconds(0.2, 600), queue: nil) { [weak self] time in
            self?.timeUpdated(time)
        }
    }

    fileprivate var playerLayer: AVPlayerLayer?
    fileprivate var playerStatus: AVPlayerStatus = .unknown
    fileprivate var currentState = PlaybackState.idle
    fileprivate var timeObserver: Any?
    private var backgroundSessionBackup: String?

    open var url: URL?
