在我使用AVFoundation
的應用程序中,我使用NSTimer.scheduledTimerWithTimeInterval(0.1, target: self, selector: "showCurrentAudioProgress", userInfo: nil, repeats: true)
在viewDidLoad
中調用功能showCurrentAudioProgress()
。我想返回這種時間格式00:00:00,但我有一個很大的問題。全功能如下:如何以格式00:00:00打印音頻時間使用AVFundation
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)"
}
我如何轉換的時間,我recive使用AVAudioPlayer
00:00:00?
'minues'有些問題,因爲即使是下一分鐘它仍然是相同的值 – PiterPan