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

  • JohnTube
    JohnTube ✭✭✭✭✭
    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

  • JohnTube
    JohnTube ✭✭✭✭✭
    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
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited February 2019
    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.

  • fanatix
    fanatix
    edited March 2019
    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
  • JohnTube
    JohnTube ✭✭✭✭✭
    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
  • fanatix
    fanatix
    edited March 2019
    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.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited March 2019
    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.
  • Hello,

    I'm also having trouble using Photon Voice with self hosted server.

    I get these errors when trying the DemoVoice-PushToTalk-Scene from PUNVoice with self hosted server and internet disabled:

    Failed to connect to server after testing each known IP. Error(s):
    UnityEngine.Debug:LogError(Object)
    NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Vendor/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1622)
    ExitGames.Client.Photon.<>c__DisplayClass104_0:b__0() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:923)
    ExitGames.Client.Photon.TPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/TPeer.cs:291)
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1598)
    PhotonHandler:Update() (at Assets/Vendor/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:161)


    and


    Cause: ExceptionOnConnect
    UnityEngine.Debug:LogError(Object)
    ConnectAndJoinRandom:OnFailedToConnectToPhoton(DisconnectCause) (at Assets/Vendor/Photon Unity Networking/UtilityScripts/ConnectAndJoinRandom.cs:65)
    UnityEngine.GameObject:SendMessage()
    NetworkingPeer:SendMonoMessage(PhotonNetworkingMessage, Object[]) (at Assets/Vendor/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2887)
    NetworkingPeer:OnStatusChanged(StatusCode) (at Assets/Vendor/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2270)
    ExitGames.Client.Photon.<>c__DisplayClass105_0:b__0() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:931)
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:431)
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1598)
    PhotonHandler:Update() (at Assets/Vendor/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:161)



    The photon server settings scriptable object is as follows:
    - Self Hosted
    - Server Address 127.0.0.1
    - Server Port 5055
    - Protocol: Udp

    Photon Voice settings
    - Server Port UDP: 5055

    PUN version: 1.101 (current)(14 nov 2019)
    Photon Voice Classic: v1.23(18 nov 2019)



    I have Photon Control (v 4.0.28.2962) installed and Load Ballancing (MyCloud) running as Application

    I'm sure I'm missing something but this does not seem to work.

    Again, the internet connection is disabled so I can make sure it works without connecting to online cloud.

    Thanks for the great support on the forums.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @troglodescu,

    Thank you for choosing Photon!

    PUN version: 1.101 (current)(14 nov 2019)

    You mean 12 November 2019.

    I just tested locally and I could not reproduce.

    Make sure you the local server is up and running (PhotonControl icon is blue or check logs)
    also, make sure the client can reach the server.
  • Thanks for the quick reply.

    Have you tried with the internet disabled ? With internet enabled, it works normally for me too.

    Also, what should I start in photon control ?

    Is the localhost ip 127.0.0.1 alright to put in photon settings ?

    I also started LoadBallancing->Run Test Client and got these:

    C:\Projects\atmis-aio\photon\server\Photon-OnPremise-Server-SDK_v4-0-29-11263\deploy\bin_tools\stardust.client\
    Test case: Master
    Settings: 5 games per process, 3 players per game, game server at 127.0.0.1:5055
    Sending reliable operation every 100 ms

    Starting 5 games with 3 players
    [21616] Press Return to End
    Connecting to 192.168.80.157:5056
    21647132: Connect() failed: System.Net.Sockets.SocketException (0x80004005): A socket operation was attempted to an unreachable network 192.168.80.157:5056
    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
    at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
    at System.Net.Sockets.Socket.Connect(IPAddress address, Int32 port)
    at ExitGames.Client.Photon.SocketUdp.DnsAndConnect()
    Waiting: OnPeerStatusCallback: unexpected return code ExceptionOnConnect
    [21616] Started game SIMSOFT104(21616)1 with 3 clients
    Connecting to 192.168.80.157:5056
    31787101: Connect() failed: System.Net.Sockets.SocketException (0x80004005): A socket operation was attempted to an unreachable network 192.168.80.157:5056
    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
    at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
    at System.Net.Sockets.Socket.Connect(IPAddress address, Int32 port)
    at ExitGames.Client.Photon.SocketUdp.DnsAndConnect()
    Waiting: OnPeerStatusCallback: unexpected return code ExceptionOnConnect
    OnOperationReturn: JoinGame failed: ReturnCode: 32758 (Game does not exists). Disconnecting...
    [21616] Started game SIMSOFT104(21616)2 with 3 clients
    OnOperationReturn: JoinGame failed: ReturnCode: 32758 (Game does not exists). Disconnecting...
    Connecting to 192.168.80.157:5056
    60588784: Connect() failed: System.Net.Sockets.SocketException (0x80004005): A socket operation was attempted to an unreachable network 192.168.80.157:5056
    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
    at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
    at System.Net.Sockets.Socket.Connect(IPAddress address, Int32 port)
    at ExitGames.Client.Photon.SocketUdp.DnsAndConnect()
    Waiting: OnPeerStatusCallback: unexpected return code ExceptionOnConnect
    OnOperationReturn: JoinGame failed: ReturnCode: 32758 (Game does not exists). Disconnecting...
    OnOperationReturn: JoinGame failed: ReturnCode: 32758 (Game does not exists). Disconnecting...
    [21616] Started game SIMSOFT104(21616)3 with 3 clients
    Connecting to 192.168.80.157:5056
    34901639: Connect() failed: System.Net.Sockets.SocketException (0x80004005): A socket operation was attempted to an unreachable network 192.168.80.157:5056
    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
    at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
    at System.Net.Sockets.Socket.Connect(IPAddress address, Int32 port)
    at ExitGames.Client.Photon.SocketUdp.DnsAndConnect()
    Waiting: OnPeerStatusCallback: unexpected return code ExceptionOnConnect
    OnOperationReturn: JoinGame failed: ReturnCode: 32758 (Game does not exists). Disconnecting...
    OnOperationReturn: JoinGame failed: ReturnCode: 32758 (Game does not exists). Disconnecting...
    [21616] Started game SIMSOFT104(21616)4 with 3 clients
    Connecting to 192.168.80.157:5056
    19017213: Connect() failed: System.Net.Sockets.SocketException (0x80004005): A socket operation was attempted to an unreachable network 192.168.80.157:5056
    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
    at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
    at System.Net.Sockets.Socket.Connect(IPAddress address, Int32 port)
    at ExitGames.Client.Photon.SocketUdp.DnsAndConnect()
    Waiting: OnPeerStatusCallback: unexpected return code ExceptionOnConnect
    OnOperationReturn: JoinGame failed: ReturnCode: 32758 (Game does not exists). Disconnecting...
    OnOperationReturn: JoinGame failed: ReturnCode: 32758 (Game does not exists). Disconnecting...
    [21616] Started game SIMSOFT104(21616)5 with 3 clients
    OnOperationReturn: JoinGame failed: ReturnCode: 32758 (Game does not exists). Disconnecting...
    OnOperationReturn: JoinGame failed: ReturnCode: 32758 (Game does not exists). Disconnecting...


    I created a brand new project and just imported PUNVoice and tested it again but the same errors are still reproduced.

    Thx again for the help.
  • Scratch that, I found the problem :)

    The IP when connected to the internet in Photon Control is dynamically set.

    When I test with internet down, I have to close photon control and restart it, then it will have the ip 127.0.0.1 and indeed, it works.

    Thank you very much for the help again, if I find anything else, I'll bug you some more :)

    Best Regards