Photon Voice w/ Selfhosted server

Using Photon Voice 2.3, having an issue getting audio to work. Have a scene, in which I've dropped a stock Voice Connection and Recorder object. There are three sections that may be configured. Most of it is stock, but as I am using a selfhosted server, I've done the following:

Voice Connection Script (checked)
Primary Recorder: Voice Connection and Recorder (Recorder)
User PUN Settings; Unchecked
App ID Voice: Blank
App Version: 1
Use Name Server: Unchecked
Use Fixed Region: Unchecked
Server: Selfhosted Server IP Address
Port: 5055
Protocol: UDP

-----

Photon Voice Network (Script): Checked
Auto Connect and Join: Checked
Auto Leave and Disconnect: Checked
Created Speaker if Not Found: Unchecked
Use Pun Settings: Unchecked
App ID Voice: blank
App Version: 1
Use Name Server: Unchecked
Fixed Region: Unchecked
Server: Selfhosted Server IP Address
Port: 5055
Protocol: UDP

-----

Connect and Join (Script) Checked
Auto Connect: Checked
Version: 1
Auto-Transmit: Unchecked
Random Room: Checked


************************************************************************************
I have included all of the above as I am not sure what will be valuable to those look at this and what will not. Now, when one person enters a multiplayer room, all is well: no exceptions thrown, though of course, because, one person. When another person enters the room, following exception is thrown, and voice does not appear to be working (users cannot hear one another),

On one side, User 1 sees this (he enters first):

InvalidCastException: Specified cast is not valid.
Photon.Pun.PhotonNetwork.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/DownloadedAssets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2033)
Photon.Realtime.LoadBalancingClient.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/DownloadedAssets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2581)
ExitGames.Client.Photon.PeerBase.DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer stream) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:633)
ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:545)
ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1473)
Photon.Pun.PhotonHandler.FixedUpdate () (at Assets/DownloadedAssets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:130)

On the other side, User 2 sees first (he enters second):

InvalidCastException: Specified cast is not valid.
Photon.Voice.VoiceClient.onVoiceEvent (System.Object content0, System.Int32 channelId, System.Int32 playerId, System.Int32 localPlayerId) (at Assets/DownloadedAssets/PhotonVoice/Photon/PhotonVoice/PhotonVoiceApi/Core/VoiceClient.cs:384)
Photon.Voice.LoadBalancingFrontend.onEventActionVoiceClient (ExitGames.Client.Photon.EventData ev) (at Assets/DownloadedAssets/PhotonVoice/Photon/PhotonVoice/PhotonVoiceApi/LoadBalancingFrontend.cs:287)
Photon.Realtime.LoadBalancingClient.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/DownloadedAssets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2581)
ExitGames.Client.Photon.PeerBase.DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer stream) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:633)
ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:545)
ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1473)
Photon.Voice.Unity.VoiceConnection.FixedUpdate () (at Assets/DownloadedAssets/PhotonVoice/Photon/PhotonVoice/Code/VoiceConnection.cs:349)


*****************************************************************************************

So, different exceptions thrown for different users. It should also be noted that the selfhosted server configuration has not really been touched. I set it up with the five minute tutorial, and it worked fine with simply creating and joining rooms. The base settings are still:

Master: 5055
Game: 5056

That's all I can think to add. Any help greatly appreciated!


Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited April 2019
    Hi @ar3k_g,

    I think you have a clash of versions between PUN2 and Photon Voice 2.
    This is probably caused by updated PUN2 after importing Photon Voice 2.

    Remove "Assets\Photon" folder and re-import Photon Voice 2 only.

    Update to latest Photon Voice 2 is recommended.
  • Are you saying to completely remove the Photon asset and then download and install the latest voice? This doesn't grok.
  • JohnTube
    JohnTube ✭✭✭✭✭
    I'm saying remove "Photon" asset yes and re-import it.
    Unity assets you have downloaded are cached on your computer so you can import them without updating or downloading.
    But still, we recommend updating if possible.

    What is the PUN2 version you see in PhotonNetwork.PunVersion or in the PhotonServerSettings inspector?
    Is it 2.6?
    What is the version of the Photon3Unity3d.dll? Can also be obtained from the PhotonServerSettings inspector.

    ---

    Feel free to create a new fresh clean empty Unity project and import Photon Voice there.
    Run or build the demo scenes.
    Use this to test if you can reproduce the issues you have described above.
  • And would you verify something for me? Do the settings look correct as far as using voice and the standalone server as the backend? Also, I am using UDP to port 5055 on the standalone server in the settings on the client side. Port 5055 is the default port for Master: is this a potential reason that we are having issues?

    Also, what in these stack traces leads you to believe that versioning is the problem? I am curious.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited April 2019
    is this a potential reason that we are having issues?
    You are successfully connected to Photon Master and Game servers and joined to a room and started transmitting voice stream frames (raising events).
    Also, what in these stack traces leads you to believe that versioning is the problem? I am curious.
    There is an exception when parsing/deserializing the received voice stream frame event. This issue occurred in a specific Photon3Unity3d.dll version which was fixed already. v4.1.2.11 This was never released in Photon Voice 2 itself but in PUN2 and in Photon Realtime Unity SDK.
  • After updating PUN, the PUN version is 2.8. The lib (I assume this is the Unity3D dll) version is: 4.1.2.10. I have also "updated" PUN Voice, with updated in quotes as the only option available was to do an import. We'll try it out and I will come back and status you. Thank you very much for your help so far, it is greatly appreciated.
  • Ok, updated to PUN 2.10 and Voice 2.6.1. I am at the state now where two players are able to either see one another, or hear one another, but not both at the same time. I connection the game and the voice to the same port: 5055. I will go into greater specifics, if needed, but I want to ask a question first: show the game connect to a different port than that used for voice? For instance, by default the on premise server comes with two applications, master and game, with master on 5055 and game on 5056. I am point to 5055 because after the update, I can't use 5056 anymore: it simply will not connect to the game port.

    If I cannot share a multiplayer and voice connect via the same port, what exactly should I do? Setting up a new UDP listener in the photonserver.exe.config file requires, as far as I can tell, deploying a new application, and then changing settings all over the place, (loadbalancing config., etc).

    What do you think? Thanks as always.
  • JohnTube
    JohnTube ✭✭✭✭✭
    The default configuration should work.
    The self-hosted Photon Server with a single LoadBalancing instance has two applications indeed: Master Server (UDP 5055) and Game Server (UDP 5056).
    Both PUN and Voice clients will connect to the same applications.
    The trick is that Voice uses a different room with a different name.
    So even if the Voice UserId is the same as the PUN UserId both clients can join two different rooms on the same server.

    You should look into the server logs (see GameServer log) to know more about the issues you are encountering.
  • I looked into the server logs, but I got nothing in terms of errors when I attempted to run multiplayer and voice through the same port. It simply didn't work. But we did fix it, though I'd like your opinion on the fix. After exploring the voice and recorder prefab, and the settings for speaker (?) and recorder, I could see that the option to connect using pun settings was ticked. So I changed the settings around, changed how I was connecting to the game server in the app, and tried that. UDP and same ports wouldn't work. What finally did the trick was using TCP for voice and UDP for the game connection. So that's our fix: the game goes to UDP Master, and voice goes to TCP master.

    I've seen reference to this once in a post I read a while back, but at the time, it didn't make much sense to me. Now it does. I am wondering if this is really the way to go in terms of performance.

    On another note, I have a basic understanding of each listener that is opened needs an underlying application. My question is this: what are these applications, Master and Server? My reading doesn't seem to give a good answer. Say I wanted to run more than one game through the same server? Could I simply copy and rename the master and game apps that exist there now to open up new ports? And it seems I have to do a lot of configuration in a lot of different places. Is there some documentation that explains this in some detail? Maybe I am just missing something.