How to change volume of voice chat?

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Voice.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

How to change volume of voice chat?

carlordvr
2022-11-11 20:30:31

Hi, I am looking to allow a player to adjust their voice chat volume using a volume slider, so other players in the scene will louder or quieter. I am also looking for a way to simultaneously mute all players in a scene. I was thinking I could just iterate through all the speakers in a scene to apply these settings, but the logic for this will get a little weird when new player join the scene. I feel like this question had to have been answered on this forum before, but I couldn't find anything. Any suggestions?

Comments

vadim
2022-11-14 09:49:37

Remote streams are played via AudioSource. Changing its volume is the easiest way to change the volume of the stream. Of course you can use anything that Unity audio subsystem provides, e.g. mixers.

Subscribe to VoiceConnection.SpeakerLinked event to adjust AudioSource's parameters right before playback starts. If you know the volume beforehand, you can set it in Editor.

Back to top