iOS AVAudiolPlayer set max volume

Hi,
I have this code for setting my audio session:
AVAudioSession.SharedInstance().SetCategory("AVAudioSessionCategoryPlayback", AVAudioSessionCategoryOptions.DuckOthers, out err);

With this setting when I increase volume to the max with the hardware buttons I hear the audio really loud.

In order to be able to route audio to Bluetooth I change the settings like this:
AVAudioSession.SharedInstance().SetCategory("AVAudioSessionCategoryPlayAndRecord", AVAudioSessionCategoryOptions.AllowBluetooth | AVAudioSessionCategoryOptions.DuckOthers, out err);

The problem is that in that case with Bluetooth disconnected, audio is re-routed to speaker, the volume is set to the max but the audio is not as loud as in the first case, it is much weaker.
It seems that this happens when
AVAudioSessionCategoryPlayback
is changet to this:
AVAudioSessionCategoryPlayAndRecord
i.e. somehow the max volume in the second case is decreased.
What setting should I set so that audio in "AVAudioSessionCategoryPlayAndRecord" sounds as loud as in "AVAudioSessionCategoryPlayback" for the same volume indicator value?

Thank you

Sign In or Register to comment.