Using Photon Voice with self hosted Photon Server

Hello guys,
I want to use Photon Voice in combination with my self hosted Photon Server. Is this even possible? I tried to figure it out yet, but failed to make it work. Im using Photon Voice1 and Photon Server 4.0.28...
Best regards,
Philipp

Comments

  • Hi @fanatix,

    Thank you for choosing Photon!

    Yes, you can.
    What did you try exactly?
  • Hello John,
    I'm trying to set up Photon Voice1 to work with my self hosted Server. For some reason it appears to not work correctly, i will attach the Log aswell. I'm connected to the server as you can see in the log. I'm printing out isPlaying and isTransmitting to see if something happens - istransmitting is true but isplaying never gets true.

    My instantiated Object has photon view and photon voice speaker / recorder on it - voice recorder source set to microphone, microphone type set to Photon (tried with Unity aswell - didn't work).
    I have a Photon Voice setting component in the scene with auto transmit true and mic type set to Photon aswell.

    I don't know where to look anymore, since it looks like I'm connected to the voice server and transmitting.
    Best regards,
    Phil

    https://imgur.com/a/qRIjdBN log

  • Hi @fanatix,

    What do you expect? Do you get the same behaviour when connecting to Photon Cloud?
    Are you using our demos?
    What Photon Voice version is this?

    Are you testing from one client or from two?
    If you test with one client and want to hear yourself taking then you need to set PhotonVoiceRecorder.DebugEchoMode = true.
  • Hello John,
    thanks for your reply and sorry for not submitting all the information u need right away.

    -I didn't check it with connecting to the cloud yet - since I need to set up a own server, this is not really a choice (i get it for debug purpose).

    -I tried the p2t and the other voice demo, what happened was that as soon another player connects to the server, Im not able to talk anymore.

    -It is Photon Voice 1 (again, sorry for missing information)

    -I'm testing from 2 separate clients in the same network ( sometimes with just 1 clients - 2 executables)

    I'ma check out the debug mode and see if it works on just one client.

    When u check the log i posted above, is it normal to get debug logs every second of this "LastRoundTripTime is suspicious"?

    Best regards,
    Phil
  • JohnTubeJohnTube mod
    edited February 19
    Hi @fanatix,

    Maybe the volume is too low OR because characters are far away from each other they can't hear each other. Use first person camera or set AudioSource.spatialBlend to 0 or move characters close to each other.
    Also, try connecting to Photon Cloud to see if it works there.

    Can you make sure clients have a UserId before connecting try to set one, example:

    PhotonVoiceNetwork.Client.UserId = Guid.NewGuid().ToString();

    To avoid the "LastRoundtripTime is suspicious" log spam update to latest Photon Voice 1 (1.18) which should have the Photon3Unity3D,.dll with version 4.1.2.9.

  • fanatixfanatix
    edited March 4
    Hello John,
    I've updated to the latest version so the LastRoundTripTime wont get spammed any longer.

    When im connecting with one client (its the master then), the debug works (I can hear myself talking), but as soon as another client connects to the server the client gets stuck in a connect / disconnect loop (check Log). I've disabled auto connect / disconnect - but it's still trying to connect / disconnect

    Im connecting to PUN like this:
      void Awake()
            {
                if (!PhotonNetwork.connecting && !PhotonNetwork.connected)
                {
                    PhotonNetwork.autoJoinLobby = false;    // we join randomly. always. no need to join a lobby to get the list of rooms.
                    PhotonNetwork.automaticallySyncScene = false;
                    PhotonNetwork.logLevel = Loglevel;
                    PhotonNetwork.AuthValues = new AuthenticationValues(Random.Range(0, 1000).ToString());
                    PhotonNetwork.sendRate = 10;
                    PhotonNetwork.sendRateOnSerialize = 5;
                    PhotonNetwork.ConnectUsingSettings(gameVersion);
                }
            }
    I actually dont really know why he's trying to connect / disconnect everytime since i've disabled auto connect / disconnect. But I think that this is the reason Voice communication is not working for me. Like I said before - when im in DebugMode, I can hear myself talking, so it appears I'm using the right Mic settings


    Log:
    https://imgur.com/dY8cUT9
  • Hi @fanatix,

    since i've disabled auto connect / disconnect
    How? Do you have an instance of PhotonVoiceSettings in the scene or via code? Maybe the issue is in here.

    Could you get the stacktrace from:
    PUNVoice: OpJoinRoom()


    The Voice client tries to join a voice room once PUN client is joined to a PUN room.
    Somehow it fails to and returns to master server.
    Then it repeats trying to join a voice room...
    Infinite loop.

    It can be a UserId issue but we made sure that Voice client uses the same UserId from PUN and you are setting one so...

    Check the server logs for clues on why the join operation is failing.
  • Hello John,
    I will check the logs and give you a reply.

    I disabled the Auto Connect / Disconnect in the inspector, not via code or anything.

    It can be a UserId issue but we made sure that Voice client uses the same UserId from PUN and you are setting one so...


    So should i not set the UserID? I just did this because I saw a workaround in some older thread (altough it was stated that the issue was fixed in the newer version.)

    Thanks for your time,
    Philipp
  • fanatixfanatix
    edited March 5
    Hello John,
    so I've checked the Server Log (GSGame.log) and it appears that

    2019-03-05 08:29:16,984 [13] WARN Photon.Hive.HiveGame - JoinApplyGameStateChanges: Game 'Star_voice_' userId '' failed to join. msg:Join failed: UserId is not set, checkUserIdOnJoin=true expects a UserId. -- peer:GameClientPeer: PID 1252, IsConnected: True, IsDisposed: False, Last Activity: Operation 226 at UTC 05.03.2019 07:29:16 in Room Star_voice_, IP 192.168.103.73:56385,



    The UserId is not set and therefor its getting disconnected. I think that this could be the problem then, right? So I've got to set another PhotonVoice-UserId? Because I've already set the UserID to be able to join PUN at all, do i have to set another "PhotonVoiceNetwork.UserID type of ID?


    EDIT: I seem to have it figured out.

    The workaround mentioned here: https://forum.photonengine.com/discussion/11866/setting-userid-for-photon-voice-on-self-hosted-windows-server worked for me aswell. I had to set the return in line 149 tho, since I'm connecting to a self hosted server and not via cloud.
  • JohnTubeJohnTube mod
    edited March 5
    Hi @fanatix,

    I see.
    The old fix I made was not working properly.
    PhotoNetwork.player.UserId remains null even if PhotoNetwork.AuthValues.UserId was set unless RoomOptions.PublishUserId is set to true and PUN joins a room.

    New proper fix, will be added to next version:
    Replace line 149 in PhotonVoiceNetwork (version 1.18):
    return instance.client.Connect(voiceMasterAddress, null, null, PhotoNetwork.player.Nickname, new LoadBalancing.AuthenticationValues(PhotoNetwork.player.UserId));
    With:
    string userId = Guid.NewGuid().ToString();
                if (PhotonNetwork.AuthValues != null && !string.IsNullOrEmpty(PhotonNetwork.AuthValues.UserId))
                {
                    userId = PhotonNetwork.AuthValues.UserId;
                }
                return instance.client.Connect(voiceMasterAddress, null, null, null, new LoadBalancing.AuthenticationValues(userId));
    This still does not explain why PhotonVoiceSettings.Instance.AutoConnect is set to true.
Sign In or Register to comment.