|
@@ -37,7 +37,7 @@ class NCAudioRecorderViewController: UIViewController, NCAudioRecorderDelegate {
|
|
|
|
|
|
open weak var delegate: NCAudioRecorderViewControllerDelegate?
|
|
|
var recording: NCAudioRecorder!
|
|
|
- var recordDuration: TimeInterval = 0
|
|
|
+ var startDate: Date = Date()
|
|
|
var fileName: String = ""
|
|
|
|
|
|
@IBOutlet weak var contentContainerView: UIView!
|
|
@@ -93,7 +93,7 @@ class NCAudioRecorderViewController: UIViewController, NCAudioRecorderDelegate {
|
|
|
|
|
|
if recording.state == .record {
|
|
|
|
|
|
- recordDuration = 0
|
|
|
+ startDate = Date()
|
|
|
recording.stop()
|
|
|
voiceRecordHUD.update(0.0)
|
|
|
|
|
@@ -103,7 +103,6 @@ class NCAudioRecorderViewController: UIViewController, NCAudioRecorderDelegate {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- recordDuration = 0
|
|
|
do {
|
|
|
try recording.record()
|
|
|
startStopLabel.text = NSLocalizedString("_voice_memo_stop_", comment: "")
|
|
@@ -149,8 +148,11 @@ class NCAudioRecorderViewController: UIViewController, NCAudioRecorderDelegate {
|
|
|
|
|
|
voiceRecordHUD.update(CGFloat(rate))
|
|
|
voiceRecordHUD.fillColor = UIColor.green
|
|
|
- recordDuration += 1
|
|
|
- durationLabel.text = String().formatSecondsToString(recordDuration/60)
|
|
|
+
|
|
|
+ let formatter = DateComponentsFormatter()
|
|
|
+ formatter.allowedUnits = [.second]
|
|
|
+ formatter.unitsStyle = .full
|
|
|
+ durationLabel.text = formatter.string(from: startDate, to: Date())
|
|
|
}
|
|
|
}
|
|
|
|