Room of multiple people

adityakadityak
edited February 7 in Photon Voice
Hi,

I am trying to create rooms of around 4 people or more.

E.g.:
1) First 4 people will join Room 1
2) Next 4 people will join Room 2
and so on.

The demo works fine, but everyone can listen to everyone else.

My use case is, that people in Room 1 should not be able to listen to people in Room 2 and vice versa.

Am not clear how to proceed. Advice would be great.

Comments

  • Hi @adityak,

    Thank you for choosing Photon!

    When you say "room" do you mean Photon room or something else?
    if you mean Photon room they by design only users joined to the same room will be able to hear each other.
    By default, Photon Voice is used to hear everyone inside the room and talk to everyone inside the room. This is done via AudioGroup 0 which is the special default group everyone is subscribed to.
    You can change this.
    Read more about Audio Groups (v1 here) (v2 here).

    What Photon Voice version are you using?
  • adityakadityak
    edited February 7
    We are using socket.io to create multiplayer rooms for our users to play poker together. We just want to add a voice chat feature to our existing setup.

    From what I understood (i may be wrong), photon voice only supports private voicegroups for 2 people at a time. So to have a room of 4 people talking to each other, i need to have all of them subscribed to 6 audio groups.

    Is there a simpler way? We have unique room ids in socket.io and an easier way would be to create the groups with the same ids in photon and just subscribe all users in the same room to subscribe to their respective room ids and they would be able to voice chat with people in their room?

    Tried both photon voice and photon voice 2, though v2 is more clearer but the amplitude / volume is also lower there.
  • Photon Voice is Unity only for the time being.
    photon voice only supports private voicegroups for 2 people at a time.
    No this is not correct.
    There is no limit for the number of people subscribed to a single group.
    Is there a simpler way? We have unique room ids in socket.io and an easier way would be to create the groups with the same ids in photon and just subscribe all users in the same room to subscribe to their respective room ids and they would be able to voice chat with people in their room?
    I don't understand how you are planning to integrate socket.io with Photon Voice. You can have Photon Voice rooms' names equal to socket.io room IDs.
  • Tried doing this:

    Apk 1:
    // unsubscribe from all groups
    PhotonVoiceNetwork.Client.ChangeAudioGroups(new byte[0], null);

    // set target AudioGroup
    photonVoiceRecorder.AudioGroup = 2;

    Apk 2:
    // unsubscribe from all groups
    PhotonVoiceNetwork.Client.ChangeAudioGroups(new byte[0], null);

    // set target AudioGroup
    photonVoiceRecorder.AudioGroup = 3;

    2 phones use apk 1 and others use apk 2. But everyone is still able to listen to everyone else, despite the audio groups being different.

    What am i missing?
  • Hi @adityak,

    The code you have provided should result in no one is listening to no one because you are transmitting to audio groups 2 and 3 and no one is subscribed to these groups.
    My explanation is that you are not properly setting the audio group of the recorder, try to do it when joined to the room and before starting the transmission.
    Also, subscribe to the proper groups as shown below:

    Apk1:
    // Subscribe to group 2 only!
    PhotonVoiceNetwork.Client.ChangeAudioGroups(new byte[0], new byte[1] { (byte)2 });
    or
    // Subscribe to group 2 only!
    PhotonVoiceNetwork.Client.GlobalAudioGroup = (byte)2;
    Apk 2:
    // Subscribe to group 3 only!
    PhotonVoiceNetwork.Client.ChangeAudioGroups(new byte[0], new byte[1] { (byte)3 });
    or
    // Subscribe to group 3 only!
    PhotonVoiceNetwork.Client.GlobalAudioGroup = (byte)3;
    Tried both photon voice and photon voice 2, though v2 is more clearer but the amplitude / volume is also lower there.
    weird. How? maybe the player speaking is far in the scene and due to 3D positioning, you can't hear him well. Could you check the value of AudioSource.spatialBlend maybe set it to 0f?
Sign In or Register to comment.