Skip to content

bengreenier/webrtc-unity-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webrtc Unity Plugin

🚨 You probably want Microsoft/MixedReality-WebRTC instead! 🚨

plugin logo

Cross-platform Webrtc support for Unity apps ☁🎲

Why

We needed a cross-platform webrtc solution for Unity, based on webrtc's unityplugin example that supports win32, and winuwp (theoretically linux and mac are supported as well, but untested). The ✨ magic ✨ of this repository is threefold:

  1. We support a winuwp (hololens compatible) binary
  2. We include a sample signalling implementation
  3. We provide a working end-to-end example

How to use

Officially supports Unity 2017.4.x (LTS) and Unity 2018.3.x

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 WebrtcSignalControls script via the inspector, on the WebrtcSignalControls object to point at your node-dss server url.

screenshot showing modifying the server url

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.

Once the targetId field is filled on both peers, either peer can begin the connection by clicking the offerButton.

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.

Reference Docs

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.

Running

In editor, 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.

example v01

Contributing

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:

producing a unitypackage

License

MIT

About

Cross-platform Webrtc support for Unity apps ☁🎲

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published