79671673

Date: 2025-06-19 07:36:15
Score: 2
Natty:
Report link

We have encountered similar problem. But slightly different.
In brief, the solution provided by Anthony Manning-Franklin is the best so far.

Detail:

We are using Unity (2022.3 specifically) and enable microphone feature on WebGL (iOS safari specifically).

As turning/acquiring microphone (with default constrain , true of echoCancellation specifically, the audio volume (BGM/audio) becomes noticeable louder.

The device volume can be observed been adjusted by pressing volume button (at the side of mobile device)

After stopping the use of microphone, volume changes again (backward). (Sometimes, the first audio even mute as stopping )

Meanwhile, while the scene is changed (a new scene is loaded), Unity seems reset the device volume (backward), I guess it use the same module on volume.

I tried the solution provided by Alex Under , it doesn't work on my case.

navigator.audioSession.type = 'play-and-record';

As we set echoCancellation to be false as requesting microphone, the problem of raising volume is not there, but a slight reducing volume is observed. ( I guess a switching route of audio is executed according to https://medium.com/@python-javascript-php-html-css/ios-safari-forces-audio-output-to-speakers-when-using-getusermedia-2615196be6fe ) When a new scene is loaded, volume of device is changed backward.

We doesn't want the volume changing. So if there is better solution, please advice.

Reasons:
  • Blacklisted phrase (0.5): medium.com
  • RegEx Blacklisted phrase (2.5): please advice
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: NDark