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! Your search result can be found below. Plus, we offer support via 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.

Muting a specific player with photon voice

NINOCUNI
2021-10-12 01:28:49

I want each client connected to the voice server to be able to choose who they hear talking or to put it another way I want each player to be able to mute other players by pushing a button next to their player name.

I can't find anything in the documentation on how this is achieved. Is it by manipulating the voicerecorder on the local instantiated network prefabs that contain the voicerecorder and voicespeaker scripts? Is it as simple as setting voicerecorder.transmit to false in the local instantiation of the network player?

Comments

JohnTube
2021-10-13 07:04:52

Hi @NINOCUNI,

Thank you for choosing Photon!

In general to mute we use AudioSource.mute or AudioSource.volume as we rely on Unity's AudioSource component for playback.

So you can have a method to mute using Speaker component of a player:

If you don't know which Speaker belongs to which player, you can brute force (not recommended):

If you use PUN integration, this makes it easier, you can mute by player like this:

NINOCUNI
2021-10-15 05:31:33

Thank you. I solved this problem~!

Pihicin
2023-07-27 12:00:13

Hello,

We tried the same method, put a debug log to confirm that in here:

public bool ToggleMuteSpeaker(Speaker speaker, bool mute) {

AudioSource audioSource = speaker.GetComponent();

if(audioSource){

Debug.Log("To mute: " + mute);

audioSource.mute = mute;

}

}

We tried that on PlayStation 5, but it does not work. The log has output correctly. Is there any workarounds?

Back to top