In my app where I use AVFoundation
I call function showCurrentAudioProgress()
using NSTimer.scheduledTimerWithTimeInterval(0.1, target: self, selector: "showCurrentAudioProgress", userInfo: nil, repeats: true)
in viewDidLoad
. I would like to return this kind of time format 00:00:00 but I have a big problem with it. Whole function looks like this:
var musicPlayer = AVAudioPLayer()
func showCurrentAudioProgress() {
self.totalTimeOfAudio = self.musicPlayer.duration
self.currentTimeOfAudio = self.musicPlayer.currentTime
let progressToShow = Float(self.currentTimeOfAudio) / Float(self.totalTimeOfAudio)
self.audioProgress.progress = progressToShow
var totalTime = self.musicPlayer.duration
totalTime -= self.currentTimeOfAudio
self.currentTimeTimer.text = "\(currentTimeOfAudio)"
self.AudioDurationTime.text = "\(totalTime)"
}
how can I convert time which I recive using AVAudioPlayer
to 00:00:00?