marek-simonik / record3d-wifi-streaming-and-rgbd-mp4-3d-video-demo

MIT License
29 stars 7 forks source link

Unity and Wifi Streaming #2

Open andybak opened 3 years ago

andybak commented 3 years ago

I've been trying to figure out how to connect Unity to Record3D using Unity's WebRTC package but all their examples use ICE/signalling stuff that I don't fully understand whereas your javascript example seems beautifully simple (albeit requires a known IP on the local network)

I've asked for help at the Unity end of things but do you have any idea where I would begin?

The Unity docs don't mention connecting to a known IP at all: https://docs.unity3d.com/Packages/com.unity.webrtc@2.4/manual/tutorial.html

They seem to imply an ICE server is essential.

marek-simonik commented 3 years ago

In my limited understanding of WebRTC, signaling is done outside the specification (that is: the process of determining which host to connect to). In Record3D, signaling is done by implementing a simple HTTP server, which has endpoints that allow you to ask for WebRTC offer and also to send your computer's WebRTC answer. Please take a look at the README in my simple-wifi-streaming-demo to learn about those endpoints.

I also highly recommend that you thoroughly inspect the source of the demo to learn about the WebRTC communication flow between Record3D on your iPhone and your computer, so that you can then replicate the process using Unity's WebRTC package. The demo is short and there are also comments, which will help to understand how signaling works in this simplified case.

Based on the link you posted, the Unity WebRTC package seems to be able to receive a WebRTC offer and generate a WebRTC answer, so there should be no need for ICE servers. Take a look the The Signaling Process section of the documentation and compare it with my simple-wifi-streaming-demo — it should be possible to replicate my JavaScript demo since the WebRTC standard offers the same methods for both JS and the Unity package.

Please let me know if it was possible to get the streaming going in Unity — I am curious. Thanks!