     }
   }
 
-  open override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
-    guard let change = change, let value = change[.newKey] as? Float , keyPath == AVAudioSessionOutputVolumeKey else { return }
-
-    updateVolume(Double(value), animated: true)
-  }
-
   deinit {
-    AVAudioSession.sharedInstance().removeObserver(self, forKeyPath: AVAudioSessionOutputVolumeKey, context: nil)
     NotificationCenter.default.removeObserver(self)
   }
-
-}
+}

  fileprivate let volume = MPVolumeView(frame: CGRect.zero)
  fileprivate let overlay = UIView()
  public fileprivate(set) var volumeLevel = Double(0)
  fileprivate let AVAudioSessionOutputVolumeKey = "outputVolume"
  open static let DefaultVolumeStep: Double = 0.05

  @objc convenience public init(style: SubtleVolumeStyle, frame: CGRect) {
    self.init(frame: frame)


    // If user opted out of animation, toggle observation for the duration of the change
    if !animated {
      reenableOutputVolumeObservationWorkItem?.cancel()
      audioSessionOutputVolumeObserver = nil
      
      updateVolume()
      
      reenableOutputVolumeObservationWorkItem = DispatchWorkItem { [weak self] in
        guard let `self` = self else { return }
        self.audioSessionOutputVolumeObserver = AVAudioSession.sharedInstance().observe(\.outputVolume) { [weak self] (audioSession, _) in
          guard let `self` = self else { return }
          self.updateVolume(Double(audioSession.outputVolume), animated: true)
        }
      }
      
      DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1, execute: reenableOutputVolumeObservationWorkItem!)
    } else {
      updateVolume()
    }
