unity-game-enginephoton

How to implement Push To Talk in Voice+Fusion?


As described in the title, I need a reliable way to control the ability to block the outgoing audio stream.

I didn't find how to do this, so I quickly implemented a RPC message that disables / enables the desired sound source for other players .. but this does not affect the audio stream.

But user needs a guarantee that his audio will not be transmitted anywhere until he turns on the appropriate in-game indicator.


Solution

  • Photon Voice and fusion require a Recorder to record the sound. Then, no need to cut the sound over network , just disable its record locally (will also prevent delay)

    public Recorder myRecorder; 
     
    void OnKeyPressed()
    {
        myRecorder.RecordingEnabled = true;
    }
    void OnKeyReleased()
    {
        myRecorder.RecordingEnabled = false;
    }
    

    Something like that