audio_waveforms
audio_waveforms copied to clipboard
fix: 🐛 Play mislabeled audio files on iOS/macOS
Description
On iOS/macOS the file extension picks the audio parser. Android often records AAC-in-MP4 but names the file .mp3 or .aac. The extension lies, so AVFoundation grabs the wrong parser and the file fails to load (or silently mis-parses, e.g. a bogus 8ms duration).
What changed
- Before preparing the player, sniff the real container from the file's leading magic bytes.
- If the real container disagrees with the extension, point the player at a temp symlink that carries the correct extension, so the right parser is chosen.
- Detects MP4/M4A, WAV, FLAC, Ogg, MP3, and ADTS AAC.
- Done once in the Dart layer, so iOS, macOS, and the waveform extractor path are all covered without duplicating logic in the native players.
- If the bytes match nothing known, the path is left untouched — no behavior change for files that genuinely can't play.
- No-op on other platforms.
Checklist
- [x] The title of my PR starts with a Conventional Commit prefix (
fix:,feat:,docs:etc). - [x] I have followed the Contributor Guide when preparing my PR.
- [ ] I have updated/added tests for ALL new/updated/fixed functionality.
- [x] I have updated/added relevant documentation in
docsand added dartdoc comments with///. - [ ] I have updated/added relevant examples in
examplesordocs.
Breaking Change?
- [ ] Yes, this PR is a breaking change.
- [x] No, this PR is not a breaking change.
Related Issues
Closes #113