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

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.

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 can I detect the speaker audio group?

2022-06-23 16:17:13


I'm using Photon Voice in Unity. I did something simple: I display a message when someone is talking.

This is easy, on the Update method I just check for the Speaker class with Speaker.IsPlaying and then I update a text saying whether that person is speaking or not based on that value.

The issue arises when that player is in multiple audio groups. I get his speaker.isplaying = true when he is talking but he is talking to an audio group that I didn't subscribe to. This means, I get a isplaying = true but I cannot hear him.

We share a common "room", something like a world chat that everybody can talk and listen to. And then, we also have a private room, where I don't listen to what he is saying. But I keep getting his IsPlaying values. So it seems that I get notified that he is talking in the private room, but obviously, I cannot hear him.

What I want to do:

Detect to which audio group he is talking to. If it is to one that I'm not subscribed, ignore it. But there is no Speaker.AudioGroup variable or anything that tells me to which audio group he is talking to.

I'm guessing photon should not send me his isplaying status if he is not talking to one of my groups. But anything that works would help. Any ideas?


2022-06-24 08:17:51


thank you for chosing Photon Voice.

The described behaviour is really odd, using AudioGroup (InterestGroup respectively as AudioGroup is deprecated) should ensure, that players not subscribed to the InterestGroup would not receive the voice data.

Could you please post some snippets, on how you set the interest groups to the voice recorder and how you do subscribe on the "listening" side?

Also, regarding displaying the IsSpeaking icon, you can refer to DemoVoicePun included in the SDK package.

2022-06-24 15:59:01

The issue is not with the isspeaking icon, the problem is that it gets activated when the person is speaking on a different group. It only happens when you share at least one group. Example:

  1. World interest group. Everybody subscribes to this one. Me and the other person.

  2. Private interest group of that person with some of his friends. I don't subscribe to it.

  3. The other person speaks in private with his private interest group. I hear nothing, but I get the "isspeaking" icon displayed.

This is a problem because everybody has the same problem and everybody begins saying "we can't hear you", thinking their mic is broken. But they are just speaking in a private room to which they have no access.

As for the code, it's very simple. The person decides in which room they want to speak and it just calls

recorder.InterestGroup = targetGroup;

When I join myself and create the connection, I have:

voiceConnection.Client.GlobalInterestGroup = worldRoom; // subscribe to world room

voiceConnection.Client.OpChangeGroups(null, new byte[1] { privateTeamgroup }); // subscribe to my private team group

2022-06-26 21:16:46


the behaviour, you describe, is very odd - it simply does not work this way, when an interest group other than 0 is used, the relay does not send voice frames to players that are not subscribed to this group. So you should not hear them nor know, they are speaking...

Can you please check, if you have the same behaviour, when you try the same in DemoProximityVoiceChat (it is one of demos, that is contained in PhotonVoice2 package). In this demo, there are interest groups based on proximity to other players - only players really close to others can hear them and SEE they are speaking.

Back to top