Fixed deprecated API warnings
This commit is contained in:
parent
0f06d99c3d
commit
3552f85d17
@ -71,7 +71,7 @@ class AudioTranscriptionManager: ObservableObject {
|
||||
|
||||
// Get audio duration
|
||||
let audioAsset = AVURLAsset(url: url)
|
||||
let duration = CMTimeGetSeconds(audioAsset.duration)
|
||||
let duration = CMTimeGetSeconds(try await audioAsset.load(.duration))
|
||||
|
||||
// Create permanent copy of the audio file
|
||||
let recordingsDirectory = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)[0]
|
||||
@ -185,4 +185,4 @@ enum TranscriptionError: Error, LocalizedError {
|
||||
return "Transcription was cancelled"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ class AudioTranscriptionService: ObservableObject {
|
||||
|
||||
// Get audio duration
|
||||
let audioAsset = AVURLAsset(url: url)
|
||||
let duration = CMTimeGetSeconds(audioAsset.duration)
|
||||
let duration = CMTimeGetSeconds(try await audioAsset.load(.duration))
|
||||
|
||||
// Create a permanent copy of the audio file
|
||||
let recordingsDirectory = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)[0]
|
||||
|
||||
@ -285,7 +285,7 @@ class WhisperState: NSObject, ObservableObject, AVAudioRecorderDelegate {
|
||||
|
||||
// Get the actual audio duration from the file
|
||||
let audioAsset = AVURLAsset(url: url)
|
||||
let actualDuration = CMTimeGetSeconds(audioAsset.duration)
|
||||
let actualDuration = CMTimeGetSeconds(try await audioAsset.load(.duration))
|
||||
logger.notice("📊 Audio file duration: \(actualDuration) seconds")
|
||||
|
||||
// Ensure we're using the most recent prompt from UserDefaults
|
||||
@ -441,4 +441,4 @@ private class TaskDelegate: NSObject, URLSessionTaskDelegate {
|
||||
|
||||
extension Notification.Name {
|
||||
static let toggleMiniRecorder = Notification.Name("toggleMiniRecorder")
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user