fix: 🐛 Prevent crashes and ANR on network loss during playback
Description
Fixes three Android crash/freeze problems in playback and waveform extraction.
1. Crash when the extractor is stopped twice. Stop ran once at end-of-file and again on dispose, hitting an already-released codec (IllegalStateException: codec is released already). Teardown and decode callbacks now share a lock and a released flag, and codec references are cleared on stop. (#477, crash part of #478)
2. Crash on network drop. A lost connection during playback was reported as a hard error. Transient errors on a prepared player now auto-retry from the same position (5 attempts, 3s apart); unrecoverable loss shuts down cleanly and notifies Flutter instead of crashing. A single-reply guard ensures the prepare call responds once.
3. ANR on slow/dead network. Extraction setup ran on the main thread. It now runs on a background thread, and a failed extraction is caught and logged on the Dart side.
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.
- [ ] 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 #488 Closes #477
Partially addresses #478 — this PR fixes the crash on ID3v2.4 files.