 
     private func removeObserver() {
         for keyPath in observedKeyPaths {
-            self.player?.removeObserver(self,
-                                        forKeyPath: keyPath)
+            self.player.removeObserver(self, forKeyPath: keyPath)
         }
     }
 



protocol MoviePlayerViewDataSource: class {
    func playerItem(in view: MoviePlayerView) -> AVPlayerItem
}

private var playerObserveContext = 0

    @IBAction func playButtonDidTap(_ sender: UIButton) {
        if let status = playerView.player?.timeControlStatus {
            switch status {
            case .paused: player.play()
            case .playing: player.pause()
            case .waitingToPlayAtSpecifiedRate: break
            }
        }
