         uiDurationSlider.setThumbImage(UIImage(named: "Player_slider_thumb"), for: .normal)
         uiDurationSlider.maximumTrackTintColor = UIColor.clear
         uiDurationSlider.minimumTrackTintColor = UIColor.green
+        uiDurationSlider.addTarget(self, action: #selector(Player.durationSliderBegan(_:)), for: .touchDown)
+        uiDurationSlider.addTarget(self, action: #selector(Player.durationSliderMove(_:)), for: .valueChanged)
+        uiDurationSlider.addTarget(self, action: #selector(Player.durationSliderEnd(_:)), for: [.touchUpInside, .touchUpOutside, .touchCancel])
         
         uiDurationProgressView.tintColor      = UIColor ( red: 1.0, green: 1.0, blue: 1.0, alpha: 0.6 )
         uiDurationProgressView.trackTintColor = UIColor ( red: 1.0, green: 1.0, blue: 1.0, alpha: 0.3 )

        }
    }
    
    var currentDuration: (current: Float, total: Float)! {
        didSet {
            let min = Int(currentDuration.current / 60)
            let sec = Int(currentDuration.current.truncatingRemainder(dividingBy: 60))
            uiCurrentDurationLabel.text = String(format: "%02d:%02d", min, sec)
            uiDurationSlider.value = currentDuration.current / currentDuration.total
        }
    }
    

}

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

extension Player {
    func convert(duration: Float) -> String {
        let min = Int(duration / 60)
        let sec = Int(duration.truncatingRemainder(dividingBy: 60))
        return String(format: "%02d:%02d", min, sec)
    }
}

extension UIView {
    func fadeIn() {
        UIView.animate(withDuration: 1) {
            self.alpha = 1
        }
    }
    
    func fadeOut() {
        UIView.animate(withDuration: 1) {
            self.alpha = 0
        }
    }
}
