 public typealias PVPlayerItem = AVPlayerItem
 
 public protocol PlayerViewDelegate: class {
-    func playerVideo(player: PlayerView, statusPlayer: PVStatus, error: NSError?)
-    func playerVideo(player: PlayerView, statusItemPlayer: PVItemStatus, error: NSError?)
+    func playerVideo(player: PlayerView, statusPlayer: PVStatus, error: Error?)
+    func playerVideo(player: PlayerView, statusItemPlayer: PVItemStatus, error: Error?)
     func playerVideo(player: PlayerView, loadedTimeRanges: [PVTimeRange])
     func playerVideo(player: PlayerView, duration: Double)
     func playerVideo(player: PlayerView, currentTime: Double)

        playerItem.addObserver(self, forKeyPath: "loadedTimeRanges", options: [], context: &loadedContext)
        playerItem.addObserver(self, forKeyPath: "duration", options: [], context: &durationContext)
        playerItem.addObserver(self, forKeyPath: "status", options: [], context: &statusItemContext)
        NSNotificationCenter.defaultCenter().addObserver(self, selector: .playerItemDidPlayToEndTime, name: AVPlayerItemDidPlayToEndTimeNotification, object: playerItem)
    }
    func removeObserversVideoItem(playerItem: PVPlayerItem) {
        
        playerItem.removeObserver(self, forKeyPath: "loadedTimeRanges", context: &loadedContext)
        playerItem.removeObserver(self, forKeyPath: "duration", context: &durationContext)
        playerItem.removeObserver(self, forKeyPath: "status", context: &statusItemContext)
        NSNotificationCenter.defaultCenter().removeObserver(self, name: AVPlayerItemDidPlayToEndTimeNotification, object: playerItem)
    }
    
    func removeCurrentTimeObserver() {

        if context == &statusContext {
            
            guard let avPlayer = player else {
                super.observeValue(forKeyPath: keyPath, of: object, change: change , context: context)
                return
            }
            //            self.delegate?.playerVideo(self, statusPlayer: avPlayer.status, error: avPlayer.error)
            self.delegate?.playerVideo(player: self, statusItemPlayer: avPlayer.status, error: avPlayer.error)
            //            self.delegate?.playerVideo(player: self, statusItemPlayer: avPlayer.status, error: avPlayer.error)
            
            
        } else if context == &loadedContext {
