Simplify scrubbing and reset to stopped if scrub to start/end

This commit is contained in:
David Langley
2021-09-22 11:12:45 +01:00
parent 187d1d316c
commit d3c3643098
4 changed files with 27 additions and 62 deletions
@@ -157,19 +157,17 @@ public class VoiceMessageController: NSObject, VoiceMessageToolbarViewDelegate,
}
}
func voiceMessageToolbarViewRequestedFormattedTimestamp(for progress: CGFloat) -> String? {
guard let duration = recordDuration else {
return nil
}
return VoiceMessageController.elapsedTimeFormatter.string(from: Date(timeIntervalSinceReferenceDate: duration * progress))
}
func voiceMessageToolbarViewDidRequestSeek(to progress: CGFloat) {
guard let audioPlayer = audioPlayer,
let duration = recordDuration else {
return
}
guard progress > 0 else {
audioPlayer.stop()
return
}
if audioPlayer.url == nil {
audioPlayer.loadContentFromURL(temporaryFileURL)
}