PhotonVoice one to one chat or group voice chat

Options
Hello Everyone,

we are working on Photon voice global group all user interactions with one another working fine in default group 0.

We want to implement voice chat in zone vise when the user is in specific are than he/she can listen or transmit audio to that group only.

We only transmit to voice on that group only,

we using below code,
we use the personal recorder.

We use two static groups for testing
private void OnTriggerEnter(Collider other)
    {
       // TO LISTEN
       PhotonVoiceNetwork.Instance.Client.OpChangeGroups(new byte[]{0}, new byte[1]{2});
       // TO TALK
       photonVoiceView.RecorderInUse.InterestGroup = 2;
    }
    private void OnTriggerExit(Collider other)
    {
        PhotonVoiceNetwork.Instance.Client.OpChangeGroups(new byte[0], new byte[1]{1});
        photonVoiceView.RecorderInUse.InterestGroup = 0;
    }
It is very helpful to us if any feedback is provided.

Any Other settings are required or whatever thing help regarding this,

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @SanjayChauhan,

    You sent almost the same thing via email.
    Please keep a single support channel at the same time, start with the forum and then email when you don't get help withing 2 work/business days.

    The main difference being the snippet:

    in email:
    private void OnTriggerEnter(Collider other)
        {
           // TO LISTEN      
           PhotonVoiceNetwork.Instance.Client.OpChangeGroups(new byte[0], new byte[1]{2});
           // TO TALK
           photonVoiceView.RecorderInUse.InterestGroup = 2;
        }
    
    private void OnTriggerExit(Collider other)
        {
            PhotonVoiceNetwork.Instance.Client.OpChangeGroups(new byte[0], null);
        }
    

    in forum:
    private void OnTriggerEnter(Collider other)
        {
           // TO LISTEN
           PhotonVoiceNetwork.Instance.Client.OpChangeGroups(new byte[]{0}, new byte[1]{2});
           // TO TALK
           photonVoiceView.RecorderInUse.InterestGroup = 2;
        }
        private void OnTriggerExit(Collider other)
        {
            PhotonVoiceNetwork.Instance.Client.OpChangeGroups(new byte[0], new byte[1]{1});
            photonVoiceView.RecorderInUse.InterestGroup = 0;
        }
    

    So notes:

    - You can't unsubscribe from group 0. (PhotonVoiceNetwork.Instance.Client.OpChangeGroups(new byte[]{0},...)
    - Setting Recorder.InterestGroup back to 0 means everyone will be able to hear you. So maybe you need to change the group to something else in OnTriggerExit (1?).
    - if you use a single recorder locally or want all recorders to transmit to the same group (2), you can use the global interest group:
    PhotonVoiceNetwork.Instance.Client.GlobalInterestGroup = 2;
    

    instead of
    // TO LISTEN      
           PhotonVoiceNetwork.Instance.Client.OpChangeGroups(new byte[0], new byte[1]{2});
           // TO TALK
           photonVoiceView.RecorderInUse.InterestGroup = 2;