You've already forked element-x-android
mirror of
https://github.com/element-hq/element-x-android.git
synced 2026-10-23 18:49:00 +03:00
* Request media audio focus when playing a voice message Voice message playback asked for audio focus with USAGE_VOICE_COMMUNICATION, the same bucket as Element Call and voice message recording, while the player itself renders on the media stream. Audio policy layers act on the declared usage, so a car head unit switches to its call audio context and routes the playback away while the player keeps running. Declare USAGE_MEDIA (and STREAM_MUSIC on the legacy path) for playback, which is what the player actually renders. Recording and Element Call keep asking for voice communication focus. * Keep playing a voice message through a short sound from another app A notification, a navigation prompt or any other app taking focus for a moment sends AUDIOFOCUS_LOSS_TRANSIENT or AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK, and DefaultMediaPlayer pauses on it. The voice message stops part way through and the user has to find it again and restart it. Recording already ignores those two, because the capture path is not affected by focus. Give voice message playback the same treatment, moving the requester test into a named function rather than growing the inline condition. A permanent AUDIOFOCUS_LOSS, a real phone call, still pauses, and the media viewer is untouched.