Placeholder-Software / Dissonance

Unity Voice Chat Asset
69 stars 5 forks source link

[help] Followed the tutorial for WebRTC connection, can connect two computers, but no audio is being played #202

Closed Apolotary closed 3 years ago

Apolotary commented 4 years ago

Context

Followed the Dissonance tutorial for WebRTC video chat. I have the right plugins, and when I start editor on two different machines (macOS and Win 10 PC), I can see a client connecting to a server. I can also see microphone levels change in real-time.

Supposedly I should hear the voice chat working, but no voices are recorded/reproduced on both sides. Am I missing something?

Expected Behavior

Voice chat working

Actual Behavior

Voice chat doesn't work :(

Steps to Reproduce

Provide a detailed set of steps to reproduce the problem

  1. Import WebRTC videochat
  2. Import Dissonance + Dissonance WebRTC integration
  3. Follow the WebRTC tutorial
  4. Start server (in the editor) on one machine, and client (also in the editor) on the other

Your Environment

martindevans commented 4 years ago

Have you tried the demo included in the integration package (Assets/Dissonance/Integrations/PureP2P/Demo)? There's a readme included in that folder that explaining the steps to run the demo. Testing that will confirm if it's a problem with Dissonance, or just something missing in your own test scene :)

Apolotary commented 4 years ago

Thanks for the advice! I just tried the steps in readme file on several setups:

Not quite sure what the problem yet, but is this expected behavior across devices/platforms?

martindevans commented 4 years ago

Native app (macOS) ... permissions

I think you're correct about permissions. We have a section in the docs explaining what changes you need to make for MacOS apps to have mic permission.

Windows 10 editor pauses the whole application for microphone input

I'm not quite sure what you mean by this? Sorry.

I've definitely had this demo scene working in Win10+editor - that's where I developed and tested it!

native app (iOS) ... I get a black screen

Do you have any logs from the device indicating what it's doing when it's showing th black screen? e.g. which scene it has loaded.


Sorry that this is all broken for you - none of this is expected behaviour at all! Could you perhaps quickly try out a different integration (e.g. Mirror should be quite easy to set up). That will just eliminate the possibility that something with the third party network backend is causing some/all of these issues. There's a demo scene included with every integration, so testing it should be very easy.

Apolotary commented 4 years ago

I did a quick recording on Win 10 issue https://www.dropbox.com/s/cck1snfghhm9otr/Dissonance_Win10.mp4?dl=0

Basically what's happening is the editor "pausing" the scene, the only message I see is for microphone input. I'm attaching a developer log just in case.

I'll check the iOS issue and will try other integrations and will report back. devlog.txt

martindevans commented 4 years ago

Aha, I think I might see the issue there. The log shows this message:

ArgumentException: Input Axis GlobalChat is not setup.

This is being thrown by the VoiceBroadcastTrigger in the demo scene which uses the GlobalChat axis as a trigger for Push-To-Talk.

If you have "Pause On Error" turned on then the scene will be pausing every time that message shows up, which is every frame! The readme in the demo folder has details on how to add this input axis.

Apolotary commented 4 years ago

Thank you for the suggestion! That fixed the axis error, but now I'm getting this on Win 10 (in attachment). Since this is on the same machine, I'm not sure if the network is at fault, might be something with WebRTC. Would be happy to hear any suggestions though.

Also I'm still looking into the issue on iOS at the moment, will post logs later. dissonance_crash.txt

martindevans commented 4 years ago

That's a networking error, indicating that the Win10 peer can't connect directly to the "server" peer (it's a p2p session, but there's still a "master" peer which coordinates the session). Normally you'd use a TURN server to act as a relay in this case, but that's not set up for the demo (for the simple reason of hosting costs).

Apolotary commented 4 years ago

Got it! I managed to get it working on Win 10 by starting a clean project (not sure what happened, maybe WebRTC got mangled when using version control, not sure). Let me check the iOS bug and if a clean install works, we can close the issue

Apolotary commented 4 years ago

The iOS problem still persists, here is the log from the Xcode (I just installed the app, copied the ID and pressed "create" button) xcode_log.txt

martindevans commented 4 years ago

Well there's definitely something wrong with the UI in that log, there's a lot of constraint errors:

2020-06-25 23:24:24.564826+0900 DissonanceCleanTest[24435:10567783] [LayoutConstraints] Unable to simultaneously satisfy constraints.

I assume Unity is trying to map it's GUILayout UI into the iOS constraint based UI and something is going wrong. This is odd as it's an extremely simple UI, the entire "menu" UI for the P2P demo is

            // Assets/Dissonance/Integrations/PureP2P/Demo/StateManager.cs Line 74
            using (new GUILayout.AreaScope(new Rect(20, 20, 400, 200)))
            {
                using (new GUILayout.HorizontalScope())
                {
                    GUILayout.Label("Session ID:", GUILayout.Width(75));
                    _sessionId = GUILayout.TextField(_sessionId, GUILayout.Width(310));
                }

                GUILayout.Space(10);

                if (GUILayout.Button("Create"))
                    < Change state >

                if (GUILayout.Button("Connect"))
                    < Change state >
            }

I would suggest removing some of these constraints (e.g. get rid of the AreaScope, remove the Width hints, get rid of the Space) and seeing if the layout system can solve that.

If you have this in an easily reproducible form, could you also submit this as a bug to Unity? Thanks.

Apolotary commented 4 years ago

I tried removing anything with *Scope in it as well as removing Space and Width, but the problem still persists. I'll try to integrate Dissonance directly into my app interface and see if I encounter the same issue. Just in case I'm attaching Xcode logs and StateManager.cs StateManagercs.txt dissonance_noscope_xcode_log.txt

martindevans commented 3 years ago

Hi @Apolotary did you ever manage to get this working? I'll close this issue for now since it's been a while but feel free to re-open it if you still need help :)