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

Ash68
2017-02-20 22:15:27

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

Ash68
2017-02-20 22:32:41

Think I found the answer myself, disabling the audiosource on the network instantiated prefab mutes the player. Is there a nicer way to do it, ~I could turn the volume to zero rather than disabling the audio source. Just wondering if this is the 'correct way'.

Imsoconstipated
2021-03-24 11:05:43

How would you get access to the player's volume when it is instantiated?

stalinfcc96
2021-04-04 01:42:28

Hello I have the same problem, can you help me, how do that

JohnTube
2021-04-04 22:12:40

Hi @Ash68, @Imsoconstipated, @stalinfcc96,

Thank you for choosing Photon!

As @Ash68 already hinted, there are several ways to do this.
If you want to mute locally a player's incoming stream, get it's corresponding Speaker component, then from it get the AudioSource and either disable it or set its volume to zero (audioSource.volume=0f).
You could also stop playback from Speaker via StopPlayback() method or disable it (and set PlaybackOnlyWhenEnable to true).
If you use PUN integration you could get the Speaker from the PhotonVoiceView.SpeakerInUse.

Let us know if you want to mute all Speakers associated to a single player or 'mute' a stream/player by not linking it to a Speaker at all or even try not to receive its audio frames.

Reetika_dev
2022-06-14 11:17:26

@JohnTube Thanks for your response. I want to mute all players inside the room ? Can you please suggest the appropriate way to do so ?

vadim
2022-06-15 10:14:33

Just iterate over all Speakers in the scene and apply any of mentioned techniques to each.

Note that by using interest groups (Recorder.InterestGroup, VoiceClient.OpChangeGroups), you can not only stop playing a stream on the client but also avoid streaming at all, thus saving the bandwidth. See DemoProximityVoiceChat.

Back to top