I have a UISlider and AvAudioPlayer, currently I am able to set the UISlider to the currentTime of a AvAudioPlayer like so:
timer = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: (#selector(RecordController.updateTimer)), userInfo: nil, repeats: true)
@objc func updateTimer() {
if(audio != nil) {
audioSlider.setValue(Float((self.audio?.currentTime)! / (self.audio?.duration)!), animated: false)
}
}
But how would I set the currentTime of the AVAudioPlayer when changing the value of the UISlider?
@IBAction func audioSliderUpdated(_ sender: Any) {
}