I want to play an <audio> while I still have the access to the microphone. However, the iPhone 12 pro automatically decreases the sound level of <audio>.
Actually I don't want to play an <audio> and record microphone at the same time. I want to keep having access to the microphone taken by navigator.mediaDevices.getUserMedia({audio:true}) and play audio with full level of sound. In this way, I don't need to prompt for permission if I need the microphone again.
Also, I like to mention that sound level is ok if the user uses airbods.
What I tried:
When I don't need the microphone I can easily set the enabled property of audio track to false. stream.getTracks()[0].enable = false makes the microphone silent but does not increase the sound level of <audio>. This reaction sounds a bit strange because while the microphone track is silent nothing can be recorded. So decreasing the sound of audio is unnecessary.
I also tried to set the level of audio to 1 but it doesn't have any effect because it is already 1.
My conclusion until now:
It looks like iPhone reduces the sound to stop the possible noise on the microphone. However, It is unnecessary to happen if you have disabled the microphone track.
In Safari if you need the permission again and the time difference between the two permission is more than 90 seconds, user is prompted for permission.
is there any suggestion?