InterruptionPolicy
What to do when something takes the right to make sound away.
A call arrives, another app starts playing, the headphones come out. Each platform reports these differently and each one expects a player to react. This is the one set of choices behind all of them; the platform guard maps its own signals onto InterruptionEvent and follows what is here.
Properties
On a short loss that allows quiet playback, duck by duckVolume instead of pausing.
The share of the listener's volume that plays while ducked: 0.2 plays at a fifth of it. A duck only ever lowers the sound, and the listener's own volume setting is left alone.
The kind of audio focus to ask for (#451): AudioFocusKind.Permanent for music and films, or a transient kind for a short sound, such as a voice message or a notification, so the music it interrupts resumes after it. Android reads it; the other platforms have no such request and ignore it.
Pause when the sound is gone for good, for example another app took over playback.
Pause when the route stops being audible: wired headphones out, Bluetooth gone.
Play again after a short loss ends, but only when this policy was the one that paused.