2

I'm looking to use WebRTC in a project where I need to livestream video from one computer, a robot with a wifi hotspot and USB camera, over a local network to another computer, a controller for the robot. Both computers in this case are single board computers and the video stream is one-way. I'd also like the two computers to communicate data to each other in both directions. I found WebRTC in my research and it seems to have both of these functionalities that I'm looking for.

From initial testing with the demo NodeJS programs, WebRTC seems to be almost exactly what I'm looking for. One big bump I've been trying to get over though is that it seems to require by default an online signaling server to be used between the two clients. I researched and found that it's possible to create the signaling server within the local network with a third computer, but such a setup isn't appropriate for my project.

I've looked into other solutions and came across OpenVidu which implements WebRTC but allows the signaling server to be built into one of the client computers (at least that's what I've read in another stack overflow post). I have yet to test this tool to see if it resolves my issue, but I'm blocked currently by the docker image used by the project not supporting ARM processors, which are employed by my single board computers, and thus requiring special installation.

Before I go through that process which may or may not work, I wanted to ask if there's another simpler solution to running WebRTC without internet access and without needing a third computer as a signaling server or if there were any suggestions for tools other than WebRTC that would be better for my application. I'm very new to the technology and could definitely be missing an easy or existing solution. Any help on this matter would be greatly appreciated.

For those curious, the single board computers being used are NVidia Jetson Nanos.

  • You don't _need_ a signalling server, though it makes things easier. You can run the server on either one of the 2 devices - there's no need for a 3rd pc. There are lots of examples on the web using NodeJS to create signaling server. You can then use the webrtc connection to send video and data. – 001 May 27 '20 at 12:17
  • Could you provide a link to one of these examples? – Andrew Euredjian May 27 '20 at 17:48

2 Answers2

1

You can run a local TURN server on your LAN. It is very easy and straightforward. For e.g. turnserver, from coturn project.

After install, just run

turnserver -p 19302

Now your config file:

const config = {
  iceServers: [
    {urls: ["stun:<<YOUR HOST IP>>:19302"]}
  ]
}
double-beep
  • 5,031
  • 17
  • 33
  • 41
M.Hefny
  • 2,677
  • 1
  • 26
  • 30
  • 1
    Thanks for the note! I wasn't aware that there was a built in turn server tool. A couple months after this post I found myself needing a local turn server and ended up going with [coturn](https://github.com/coturn/coturn) which worked perfectly. – Andrew Euredjian Dec 01 '20 at 06:14
  • You should not need a TURN server in a LAN. – jch Dec 01 '20 at 19:40
  • I use revision 72 .. the issue started with Chrome & mDNS. I need to disable mDNS in Google Chrome which is not longer possible, so I tried turnserver and it worked great. – M.Hefny Dec 01 '20 at 19:53
  • @jch At the moment there's an issue with python's aiortc package where the RTC connection doesn't work without specifying any TURN/STUN servers. I came across this a few months ago so maybe it got patched by now. As far as I know this is only an issue with python's WebRTC library so you are correct for other languages. – Andrew Euredjian Dec 01 '20 at 21:19
  • I am using webrtc in c++ and I had to disable Chrome feature as I mentioned. but after Chrome has been updated disabling this feature is not possible and hence I used turnserver. maybe there is a fix or I should upgrade webrtc to more recent version. I am not sure. I just mention my experience :) – M.Hefny Dec 02 '20 at 01:35
0

Found the solution. Using the Google Codelabs example, the fix involved just removing the default ice server in the config. Essentially, it meant changing

const config = {
  iceServers: [
    {urls: ["stun:stun.l.google.com:19302"]}
  ]
}

to

const config = {
  iceServers: []
}