feat(player): audio focus, interruptions & becoming-noisy

The Flutter client had no audio_session integration, so it didn't pause
for phone calls / other media, didn't duck for navigation prompts, and
kept blasting the phone speaker when earbuds were unplugged.

Add audio_session ^0.2.3 and configure AudioSessionConfiguration.music()
in MinstrelAudioHandler (best-effort, fully try-caught):
- becomingNoisy -> pause (no speaker blast on unplug/BT drop)
- interruption begin: duck -> lower volume; pause/unknown -> pause,
  remembering whether we were actively playing
- interruption end: duck -> restore volume; pause -> resume only if we
  paused it and the session isn't torn down (guards the idle-teardown
  -during-long-call edge; re-init is resume-last-session territory);
  unknown -> no auto-resume

pubspec.lock regenerated by build/CI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-18 15:43:52 -04:00
parent 905f05c120
commit 57ce3d2d0a
2 changed files with 75 additions and 0 deletions
+5
View File
@@ -14,6 +14,11 @@ dependencies:
dio: ^5.7.0
just_audio: ^0.10.5
audio_service: ^0.18.15
# Audio focus + interruptions + becoming-noisy. just_audio auto-manages
# session activation once configured; the app must still handle
# interruption/becoming-noisy itself (just_audio does not). Same author
# as just_audio/audio_service so versions track together.
audio_session: ^0.2.3
flutter_secure_storage: ^10.1.0
go_router: ^17.2.3
flutter_svg: ^2.0.16