Webrtc Unity Plugin
Work in progress (Alpha Status)
Cross-platform Webrtc support for Unity apps ☁🎲
We needed a cross-platform webrtc solution for Unity, based on webrtc’s unityplugin example that supports
winuwp (theoretically linux and mac are supported as well, but untested). The ✨ magic ✨ of this repository is threefold:
- We support a winuwp (hololens compatible) binary
- We include a sample signalling implementation
- We provide a working end-to-end example
How to use
Officially supports Unity 2017.4.x (LTS) and Unity 2018.3.x
- Import the latest release package
- Take a look at the
- Run an example to ensure your a/v hardware is working
- A detailed walkthrough describing the managed components is coming soon
Webrtc Basic Signal Example
The basic signal example (
WebrtcBasicSignalExample.unity) is designed to quickly demonstrate what managed code we’d need to write to configure a peer instance using a service to exchange sdp information (handshake) and ice candidates (NAT traversal).
To use it, one needs to set up a few dependencies:
- Clone, setup, and run an instance of node-dss (instructions at link).
- Modify the
WebrtcSignalControlsscript via the inspector, on the
WebrtcSignalControlsobject to point at your
Once the server is running and Unity is configured, both clients should be able to exchange information by device id. The device id is displayed across the top left of the screen, and should be typed into the remote peers input field.
For instance, to connect Peer A (device id: 1) with Peer B (device id: 2) the
targetId input field for Peer A should have the value
2. For Peer B, it should have the value
1. A connection can not succeed unless both peers have the input field populated.
targetId field is filled on both peers, either peer can begin the connection by clicking the
At this point, sdp messages (handshake data) and ice candidates (NAT traversal data) should be sent via the server, and the clients should be able to connect successfully.
To better understand the API space of this solution, take a look at the hosted API docs.
For more information, check out the brief overview video.
Win32 is supported - this means if you’re on Windows and you hit “Play” in the Unity Editor, your application should just work. For other platforms, one must produce a Unity Player build in order to fully test.
No contributing guidelines at this time. However, to produce a new
unitypackage when a new Release is needed, one must use Unity and select these fields: