 
 // MARK: - KVO
 
-// KVO contexts
-
-private var PlayerObserverContext = 0
-
-// KVO player keys
-
-private let PlayerTimeControlStatusKey = "timeControlStatus"
-
 extension Player {
 
     // MARK: - AVPlayerItemObservers

        })
        
        if #available(iOS 10.0, tvOS 10.0, *) {
            self._avplayer.addObserver(self, forKeyPath: PlayerTimeControlStatusKey, options: [.new, .old], context: &PlayerObserverContext)
        }
    }

    internal func removePlayerObservers() {
        if let observer = self._playerTimeObserver {
            self._avplayer.removeTimeObserver(observer)
        }
        if #available(iOS 10.0, tvOS 10.0, *) {
            self._avplayer.removeObserver(self, forKeyPath: PlayerTimeControlStatusKey, context: &PlayerObserverContext)
        }
    }

    // MARK: -

    override open func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {

        if context == &PlayerObserverContext {
            
            // PlayerTimeControlStatusKey
            
            if #available(iOS 10.0, tvOS 10.0, *) {
                if keyPath == PlayerTimeControlStatusKey {
                    if let rawNewValue = change?[.newKey] as? Int,
                        let newStatus = AVPlayerTimeControlStatus(rawValue: rawNewValue) {
                        if newStatus == .paused {
                            self.playbackState = .paused
                        } else if newStatus == .playing {
                            self.playbackState = .playing
                        }
                    }
                }
            }
            
        }

    }

}

    internal var _avplayer: AVPlayer = AVPlayer()
    internal var _playerItem: AVPlayerItem?
    
    internal var _playerObservers = [NSKeyValueObservation]()
    internal var _playerItemObservers = [NSKeyValueObservation]()
    internal var _playerLayerObserver: NSKeyValueObservation?
    internal var _playerTimeObserver: Any?
