Voice chat without PUN

Hi there!

I'm trying to implement Voice Chat without PUN, but i'm having several problems.

I've checked the ConnectAndJoin.cs on the examples, as the documentation says it doesn't use PUN. I'm able to connect and get all the "joined" messages and such. The issue is that when I try to connect a second player, I get no messages whatsoever and no voice from the other player. I mean, I don't see any "x user joined to room" callback or anything similar. It seems as if I'm alone all the time.

Any ideas how do I get the other people notification and their voice?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited February 2019
    Hi @creat326,

    Photon Voice 2 uses the next Photon Realtime .Net SDK (which is the case also for PUN2).
    In the new Photon Realtime .Net SDK we have changed how to implement callbacks, we now use interfaces. See ".Net Callbacks" for more information.

    First, go through our "Matchmaking Checklist" to make sure clients can see each other.
    Then, implement the callbacks necessary. In this case, you need IInRoomCallbacks.OnPlayerEnteredRoom(Player). Don't forget to register and deregister callbacks class.
  • creat326
    creat326 ✭✭
    edited February 2019
    Ok I managed to get it to work, but then I have a second problem. How do I change the remote player volume? I want to be able to ignore annoying players. So I found the remote created speaker, but I see no volume option to set it to zero. Is there a way to change volume or disable a particular remote player?

    I tried instead of the volume to zero, just to set the speaker.enabled=0 but then what it does is to make the sound loop to infinity. I don't get new sound from the player but whatever was last said keeps repeating.

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited February 2019
    Hi @creat326,

    You can set the volume using the AudioSource.volume from the AudioSource component attached to the same GameObject as the Speaker.
  • how do I know the gameobject of the speaker? I mean, the remote speaker is created remotely... I have no idea to what audiosource it is talking to and whether it's using the same one for all remote players or each one has independent sound
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @creat326,

    We do not offer an API currently to get Speaker components (or cached remote voices) per player.
    Locally, by default, a GameObject with Speaker and AudioSource is instantiated per remote voice stream.

    What you can do is:

    1. do not use the default SpeakerFactory and use a custom SpeakerFactory
    2. register for remote voice and speaker linking events

    Photon Voice streams are uniquely identified using the pair: PlayerId and VoiceId. So given this pair, you can guess the origin of the remote voice stream: which player and which recorder. You can subscribe to three events for remote streams:

    - VoiceConnection.RemoteVoiceAdded(RemoteVoiceLink): a new remote voice stream is created (started transmission) with information received.
    [...]
    - RemoteVoiceLink.RemoteVoiceRemoved: a remote voice stream has ended and is destroyed (stopped transmission).
    [source]