Only the master client can talk but the client can only hear, how to make both of them talk.

Krishna_jokerTM
edited May 2019 in Photon Voice
Sample script.
public class VoiceController : MonoBehaviour
{
    public Text ConnectionStatus;
    public Text PlayerStatus;
    public GameObject VoicePrefab;
    PhotonVoiceRecorder Rec;
    public Transform Parent;
    int Count = -1;

   public void ClickTOConnect()
   {
       PhotonNetwork.ConnectUsingSettings("0.1");
   }
   public void StartProcess()
   {
        PhotonNetwork.JoinOrCreateRoom("XYZ", null, null);
   }
   void OnJoinedRoom()
   {
        if (PhotonNetwork.isMasterClient == true)
        {
            PlayerStatus.text = "MASTER";
        }
        else
        {
            PlayerStatus.text = "CLIENT";
        }

   }
    private void Update()
    {
        ConnectionStatus.text = PhotonNetwork.connectionStateDetailed.ToString();
    }
    public void StartVoice()
    {
        CALLER();
    }
    public void CALLER()
    {
        Rec = Instantiate(VoicePrefab, Parent).GetComponent<PhotonVoiceRecorder>();
    }
    public void PushTOTalk()
    {
        if (Count == -1)
        {
            Rec.Transmit = true;
            Count = 0;
        }
        else
        {
            Rec.Transmit = false;
            Count = -1;
        }
    }
    
}

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited May 2019
    Hi @Krishna_jokerTM,

    Thank you for choosing Photon!

    I can't help you with this code only.
    I can't see when StartVoice or PushTOTalk are called.
    What do you see in the logs? any errors?

    What Photon Voice Classic version are you using?
    What Unity version are you using?
    How are you testing? from build and from Editor?
    What target platform are you using?
  • Both are button events, push to talk is a toggle and start voice will instantiate a prefab that contains photonview recorder and speaker. I figured out you are creating a prefab in master when a client joins and that has the same photonview with only speaker. How to do that?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Ah I see now.
    replace Instantiate with PhotonNetwork.Instantiate .
  • Wow, Thanks bro!!!