Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

Add OGG support and dynamically query supported audio formats

Daniel Demmela4ea86f5f1ef
diff --git a/Sources/Fluid/Services/MeetingTranscriptionService.swift b/Sources/Fluid/Services/MeetingTranscriptionService.swift
index e17c5ed3..f376c1a7 100644
--- a/Sources/Fluid/Services/MeetingTranscriptionService.swift
+++ b/Sources/Fluid/Services/MeetingTranscriptionService.swift
@@ -2,6 +2,7 @@ import AVFoundation
import Combine
import CoreMedia
import Foundation
+import UniformTypeIdentifiers
/// Result of a transcription operation
struct TranscriptionResult: Identifiable, Sendable, Codable {
@@ -67,6 +68,24 @@ final class MeetingTranscriptionService: ObservableObject {
@Published var error: String?
@Published var result: TranscriptionResult?
+ // MARK: - Supported Formats
+
+ /// File extensions the OS can actually decode, queried dynamically from AVFoundation.
+ static let supportedFileExtensions: Set<String> = {
+ let avTypes = AVURLAsset.audiovisualTypes()
+ let extensions = avTypes.compactMap { UTType($0.rawValue)?.preferredFilenameExtension }
+ return Set(extensions)
+ }()
+
+ /// Content types accepted by the file picker — broad categories so the OS filters naturally.
+ static let allowedContentTypes: [UTType] = [.audio, .movie]
+
+ /// User-facing description of supported formats (curated for readability).
+ static let supportedFormatsDescription = "Supported: WAV, MP3, M4A, OGG, MP4, MOV, and more"
+
+ /// Error copy shown when a dropped file is not accepted.
+ static let dropErrorCopy = "Accepted file types: WAV, MP3, M4A, OGG, MP4, MOV, and more."
+
/// Share the ASR service instance to avoid loading models twice
private let asrService: ASRService
@@ -159,11 +178,10 @@ final class MeetingTranscriptionService: ObservableObject {
// Check file extension
let fileExtension = fileURL.pathExtension.lowercased()
- let supportedFormats = ["wav", "mp3", "m4a", "ogg", "aac", "flac", "aiff", "caf", "mp4", "mov"]
- guard supportedFormats.contains(fileExtension) else {
+ guard Self.supportedFileExtensions.contains(fileExtension) else {
throw TranscriptionError
- .fileNotSupported("Format .\(fileExtension) not supported. Supported: \(supportedFormats.joined(separator: ", "))")
+ .fileNotSupported("Format .\(fileExtension) not supported. \(Self.supportedFormatsDescription)")
}
// Get audio duration for progress display
diff --git a/Sources/Fluid/UI/MeetingTranscriptionView.swift b/Sources/Fluid/UI/MeetingTranscriptionView.swift
index 78a520c0..bea63c77 100644
--- a/Sources/Fluid/UI/MeetingTranscriptionView.swift
+++ b/Sources/Fluid/UI/MeetingTranscriptionView.swift
@@ -192,7 +192,7 @@ struct MeetingTranscriptionView: View {
Text("Choose Audio or Video File")
.font(.headline)
- Text("Supported: WAV, MP3, M4A, OGG, MP4, MOV, and more")
+ Text(MeetingTranscriptionService.supportedFormatsDescription)
.font(.caption)
.foregroundColor(.secondary)
}
@@ -221,15 +221,7 @@ struct MeetingTranscriptionView: View {
}
.fileImporter(
isPresented: self.$showingFilePicker,
- allowedContentTypes: [
- .audio,
- .movie,
- .mpeg4Movie,
- UTType(filenameExtension: "wav") ?? .audio,
- UTType(filenameExtension: "mp3") ?? .audio,
- UTType(filenameExtension: "m4a") ?? .audio,
- UTType(filenameExtension: "ogg") ?? .audio,
- ],
+ allowedContentTypes: MeetingTranscriptionService.allowedContentTypes,
allowsMultipleSelection: false
) { result in
switch result {
@@ -545,9 +537,9 @@ struct MeetingTranscriptionView: View {
// MARK: - Helper Functions
- private static let supportedFileExtensions = ["wav", "mp3", "m4a", "ogg", "aac", "flac", "aiff", "caf", "mp4", "mov"]
+ private static let supportedFileExtensions = MeetingTranscriptionService.supportedFileExtensions
- private static let dropErrorCopy = "Accepted file types: WAV, MP3, M4A, OGG, MP4, MOV, and more."
+ private static let dropErrorCopy = MeetingTranscriptionService.dropErrorCopy
private func handleDrop(providers: [NSItemProvider]) -> Bool {
guard let provider = providers.first else { return false }