androidfocusexoplayerplayback

Is there a way to make exoplayers not duck each others volume?


I'm making an android app where the user is able to play many sounds simultaneously and set respective volumes. In the code, I make a separate instance of an exo player for every sound playback. The problem is that the exo players seem to influence each other but oddly enough only when i change volumes with a seekbar (system volume seems to be fine). After that some sounds start ducking volume when another instance is playing. Is there any possible way to just let every instance of an exo player play completely independent without influence from another exo player instance ?

I tried setting handleAudioFocus false in the .setAudioAttributes, absolutely no change.

The "false" at the bottom is the "handleAudioFocus:" arg.

val player = ExoPlayer.Builder(context)
    .setAudioAttributes(
        AudioAttributes.Builder()
            .setContentType(C.AUDIO_CONTENT_TYPE_MUSIC)
            .setUsage(C.USAGE_MEDIA)
            .build(),
        false
    )
    .build()

Solution

  • I just found the solution. It was not the code but the dolby atmos option in the sound settings on my samsung phone causing the compression.