Describe the Feature/Enhancement
Update the ExoPlayer AudioAttributes configuration in PlayerNotificationService.kt so that incoming notification sounds smoothly duck (lower) the audiobook volume in the background instead of completely pausing and rewinding playback.
Specifically, in PlayerNotificationService.kt (lines 407–412):
val audioAttributes: AudioAttributes =
AudioAttributes.Builder()
.setUsage(C.USAGE_MEDIA)
- .setContentType(C.AUDIO_CONTENT_TYPE_SPEECH)
+ .setContentType(C.AUDIO_CONTENT_TYPE_MUSIC)
.build()
mPlayer.setAudioAttributes(audioAttributes, true)
Why would this be helpful?
- Prevents Abrupt Audio Cuts: Currently, when an incoming notification chime arrives (SMS, email, app ping), ExoPlayer forces a complete pause, cutting the audio into silence for several seconds. With CONTENT_TYPE_MUSIC, ExoPlayer smoothly dips the volume for the split-second chime and restores it without interrupting the stream.
- Prevents Unintended Auto-Rewind: Because transient focus loss is currently treated as a full pause, when the notification sound ends and ExoPlayer resumes, Audiobookshelf's calcPauseSeekBackTime() interprets it as a pause-and-resume event and jumps backward 3–5 seconds, repeating sentences.
- Smooth Listening Experience: Other popular media and audiobook players duck volume during transient system sounds, providing a much smoother listening experience.
Future Implementation (Screenshot)
n/a
Audiobookshelf App Version
Android App - 0.14.0-beta
Current Implementation (Screenshot)
n/a
Describe the Feature/Enhancement
Update the ExoPlayer
AudioAttributesconfiguration inPlayerNotificationService.ktso that incoming notification sounds smoothly duck (lower) the audiobook volume in the background instead of completely pausing and rewinding playback.Specifically, in PlayerNotificationService.kt (lines 407–412):
val audioAttributes: AudioAttributes = AudioAttributes.Builder() .setUsage(C.USAGE_MEDIA) - .setContentType(C.AUDIO_CONTENT_TYPE_SPEECH) + .setContentType(C.AUDIO_CONTENT_TYPE_MUSIC) .build() mPlayer.setAudioAttributes(audioAttributes, true)Why would this be helpful?
Future Implementation (Screenshot)
n/a
Audiobookshelf App Version
Android App - 0.14.0-beta
Current Implementation (Screenshot)
n/a