     
     func play() {
         print("play")
-        addTimer()
+        setupTimer()
         player?.play()
+//        uiView.fadeOut()
+    }
+    
+    func seek(to seconds: TimeInterval) {
+        let draggedTime = CMTimeMake(Int64(seconds), 1)
+        player?.seek(to: draggedTime, toleranceBefore: kCMTimeZero, toleranceAfter: kCMTimeZero, completionHandler: { (finished) in
+            self.setupTimer()
+            self.play()
+        })
+    }
+    
+    func durationSliderBegan(_ sender: UISlider) {
+        
+    }
+    
+    func durationSliderMove(_ sender: UISlider) {
+        uiCurrentDurationLabel.text = convert(duration: sender.value * Float(duration))
+        seek(to: Double(sender.value) * duration)
+    }
+    
+    func durationSliderEnd(_ sender: UISlider) {
+        
     }
 }
 

}

extension Player {
    func addTimer() {
        timer?.invalidate()
        timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(Player.timerInterval), userInfo: nil, repeats: true)
        timer?.fireDate = Date()
    }
    
    func removeTimer() {
        
    }
    
    func timerInterval() {
        if let playerItem = playerItem {
            if playerItem.duration.timescale != 0 {
                let currentTime = CMTimeGetSeconds(self.player!.currentTime())
                let totalTime = TimeInterval(playerItem.duration.value) / TimeInterval(playerItem.duration.timescale)
                currentDuration = (Float(currentTime), Float(totalTime))
            }
        }
    }
}

        }
    }
    
    var currentDuration: Float! {
        didSet {
            uiCurrentDurationLabel.text = convert(duration: currentDuration)
            uiDurationSlider.value = currentDuration / Float(duration!)
        }
    }
    
