Examples

All examples listed below are based on a specific use case / scenario. To keep them minimal they are created with a few restrictions in mind to reduce complexity, make testing easier and encourage experimentation.

Most examples are created without UI and instead focus on logging the progress using the Unity log. Although they all use network they will connect to themselves instead of to another application. This is done to allow the testing of a full scenario using a single machine and to avoid having to build & copy the app to different systems after each change. It also allows you to see both sides of a scenario within a single file e.g. the server and the client that connects to it. The examples still create network connections, encode & decode audio/video data and require internet to run (due to the use if the signaling server). Note that as the result of this you might hear an echo. One part of the the application will record the microphone and then send it to the second part which will replay it. It is recommended to test with speakers set to a low volume first. If the speakers volume is high the microphone can record the audio the speakers replayed thus creating a loop. Once you hear your own voice you can confirm the connection has been established and audio is being sent / received.

Ensure you create your Unity project with a unique name. The examples use the project name as an address to connect. If another project is using the same name you might end up connecting to someone else instead ( a rather awkward experience 😉 )

You can read and comment the examples below or find it in the subfolder “examples” in the WebRTC Video Chat Asset (starting with version 0.981).