audio-focus-multiplayer

Installation
SKILL.md

Audio focus with more than one live player

Android's per-player focus handling assumes one player for the life of the app. A crossfade breaks that assumption: instances are created, promoted and released constantly.

  • Releasing the outgoing instance abandons focus for the whole app.
  • The incoming instance was built with focus handling off, so it never re-requests it.
  • Result: the app is playing with no focus. The system pauses it at the next opportunity — or another app takes over and it never comes back.

The fix is one focus request owned by the component that owns the swap:

ExoPlayer.Builder(context)
    .setAudioAttributes(audioAttributes, /* handleAudioFocus = */ false)  // every instance
    .build()
Installs
2
GitHub Stars
35
First Seen
6 days ago
audio-focus-multiplayer — maxrave-dev/kotlin-footguns