         oldValue.removeObserver(self, forKeyPath: #keyPath(AVPlayer.volume))
         oldValue.removeObserver(self, forKeyPath: #keyPath(AVPlayer.currentItem.loadedTimeRanges))
         oldValue.removeObserver(self, forKeyPath: #keyPath(AVPlayer.currentItem.duration))
+        oldValue.removeObserver(self, forKeyPath: #keyPath(AVPlayer.currentItem.currentMediaSelection))
     }
     
     public override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {

        player.addObserver(self, forKeyPath: #keyPath(AVPlayer.rate), options: [.initial, .new], context: nil)
        player.addObserver(self, forKeyPath: #keyPath(AVPlayer.currentItem.loadedTimeRanges), options: [.initial, .new], context: nil)
        player.addObserver(self, forKeyPath: #keyPath(AVPlayer.currentItem.duration), options: [.initial, .new], context: nil)
        
        asset?.loadValuesAsynchronously(forKeys: ["tracks"], completionHandler: metadataBecameAvailable)
        

                self.updatePlayingState()
            } else if keyPath == #keyPath(AVPlayer.currentItem.duration) {
                self.metadataBecameAvailable()
            } else if keyPath == #keyPath(AVPlayer.currentItem.currentMediaSelection) {
                self.updateMediaSelection()
            } else {
                super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
            }
