Exemplo n.º 1
0
        public bool HasMicrophonePermission()
        {
#if UNITY_ANDROID
            return(Permission.HasUserAuthorizedPermission(Permission.Microphone));
#elif UNITY_WEBGL
            return(CustomMicrophone.HasMicrophonePermission());
#else
            return(true);
#endif
        }
Exemplo n.º 2
0
        private void Update()
        {
            permissionStatusText.text = string.Format("Microphone permission: {1} for '{0}'", selectedDevice,
                                                      CustomMicrophone.HasMicrophonePermission() ? "<color=green>granted</color>" : "<color=red>denined</color>");

            if (CustomMicrophone.devices.Length > 0)
            {
                recordingStatusText.text = string.Format("Microphone status: {0}",
                                                         CustomMicrophone.IsRecording(selectedDevice) ? "<color=green>recording</color>" : "<color=yellow>idle</color>");
            }
        }
Exemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        var voice = GameObject.Find("[PeerJS]VoiceChat");

        if (voice != null)
        {
            Destroy(voice);
        }

        var microphone = GameObject.Find("[FG]Microphone");

        if (microphone != null)
        {
            if (CustomMicrophone.IsRecording(CustomMicrophone.devices[0]))
            {
                CustomMicrophone.End(CustomMicrophone.devices[0]);
            }
            Destroy(microphone);
        }



        // request microphone permissions at the start of the menu
        if (!CustomMicrophone.HasMicrophonePermission())
        {
            CustomMicrophone.RequestMicrophonePermission();
        }
        if (!CustomMicrophone.HasConnectedMicrophoneDevices())
        {
            CustomMicrophone.RefreshMicrophoneDevices();
        }
        //Debug.Log(CustomMicrophone.devices.Length + " microphone devices found");

        // destroys game tracker from previous game
        if (GameObject.FindGameObjectWithTag("GameTracker") != null)
        {
            Destroy(GameObject.FindGameObjectWithTag("GameTracker"));
        }

        // disconnects the player if they were already connected
        if (PhotonNetwork.IsConnected)
        {
            PhotonNetwork.Disconnect();
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible   = true;
        }
        PhotonNetwork.ConnectUsingSettings();
        //Debug.Log(PhotonNetwork.PhotonServerSettings);
    }
Exemplo n.º 4
0
 private void Update()
 {
     permissionStatusText.text = string.Format("Microphone permission: {0}",
                                               CustomMicrophone.HasMicrophonePermission() ? "<color=green>granted</color>" : "<color=red>denined</color>");
 }