Quantcast
Channel: Photon Voice — Photon Engine
Viewing all articles
Browse latest Browse all 671

Detect when user is talking with VoiceDetection

$
0
0
I've activated VoiceDetection and regulated the threshold accordingly. It works well, I can clearly hear my voice being transmitted when talking and transmission being put on hold during silence. However, I need to fire some events connected to when the user is talking and I'm not able to do so.

These are my current Recorder settings --> https://ibb.co/K6wHLmg

And this is the code I'm using to detect when the user is talking:
public class VoiceEvents : MonoBehaviour
{
    Recorder recorder;
    PhotonVoiceView voiceView;

    // Start is called before the first frame update
    void Start()
    {
        // Audio is not transmitted by default
        recorder = GetComponent<Recorder>();
        voiceView = GetComponent<PhotonVoiceView>();
        // recorder.TransmitEnabled = false;
    }

    // Update is called once per frame
    void Update()
    {

        if (recorder.TransmitEnabled) {
            Debug.Log("Talking");
        } else {
            Debug.Log("Silence");
        }
    }
}

My log is showing "Talking" all the time even during silence.

My Stack:
- Unity3D 2019.3
- Oculus Quest
- PUN2 Free - 2.17.1
- Photon Voice FREE 1.23


Viewing all articles
Browse latest Browse all 671

Trending Articles