Files
SpotiFLAC-Mobile/lib/utils/mime_utils.dart
T
zarzet b8b670642c feat(audio): add WAV and AIFF support + settings-style metadata menu
WAV/AIFF: library scan, quality probe, native tag read/write via embedded ID3 chunk (RIFF id3 / AIFF ID3), cover art, ReadFileMetadata, ExtractLyrics, and FLAC<->WAV/AIFF conversion (PCM, bit-depth preserved via ffprobe). Treat WAV/AIFF as lossless across all convert sheets (no bitrate picker, Lossless labels) via isLosslessConversionTarget. Native MIME maps for SAF. Redesign the track metadata three-dot menu to a settings-style grouped card with a single divider above Share.
2026-06-12 21:10:37 +07:00

29 lines
633 B
Dart

String audioMimeTypeForPath(String filePath) {
final dotIndex = filePath.lastIndexOf('.');
if (dotIndex == -1 || dotIndex == filePath.length - 1) {
return 'audio/*';
}
final ext = filePath.substring(dotIndex + 1).toLowerCase();
switch (ext) {
case 'flac':
return 'audio/flac';
case 'm4a':
return 'audio/mp4';
case 'mp3':
return 'audio/mpeg';
case 'ogg':
return 'audio/ogg';
case 'wav':
return 'audio/wav';
case 'aiff':
case 'aif':
case 'aifc':
return 'audio/aiff';
case 'aac':
return 'audio/aac';
default:
return 'audio/*';
}
}