Allow to record a voice message (#1926)

This commit is contained in:
Nicolas Mauri
2023-10-23 17:47:36 +02:00
committed by GitHub
parent 65b7c1df20
commit 2f57fbc77d
62 changed files with 1805 additions and 342 deletions
@@ -26,9 +26,14 @@ enum AudioPlayerPlaybackState {
case error
}
enum AudioPlayerStateIdentifier {
case timelineItemIdentifier(TimelineItemIdentifier)
case recorderPreview
}
@MainActor
class AudioPlayerState: ObservableObject, Identifiable {
let id = UUID()
let id: AudioPlayerStateIdentifier
let duration: Double
let waveform: EstimatedWaveform
@Published private(set) var playbackState: AudioPlayerPlaybackState
@@ -50,7 +55,8 @@ class AudioPlayerState: ObservableObject, Identifiable {
displayLink != nil
}
init(duration: Double, waveform: EstimatedWaveform? = nil, progress: Double = 0.0) {
init(id: AudioPlayerStateIdentifier, duration: Double, waveform: EstimatedWaveform? = nil, progress: Double = 0.0) {
self.id = id
self.duration = duration
self.waveform = waveform ?? EstimatedWaveform(data: [])
self.progress = progress