JeanVt
Posts: 4
Joined: Mon Apr 16, 2018 10:26 am

WebRTC peer without a browser

Mon Apr 16, 2018 10:55 am

Hi,

I have a small project with my Raspberry Pi 3 and WebRTC, I tried searching information, but I'm a bit lost. Could you please guide me to the most appropriate and up to date solution for my needs ?

What I want to do is a kind of intercom system:
- The PI has a USB webcam, speakers and a microphone (but no screen).
- From an external device, using a browser, I want to dispaly a web page hosted on the Pi, see the camera output, and communicate both ways with the microphone/speakers.

I learned about WebRTC, and followed simple tutorials to set up a signaling server and a web page, and I was able to quickly set up a video call between the Pi and my phone, using a browser on both sides.
Now, I would like to have the same thing but without a browser on the Pi side. I want to programmatically join the WebRTC "room", share audio/video, and play other side's audio on the speakers.

I found many messages on forums giving advice for similar situations. They mention UV4L, Janus, EasyRTC, OpenWebRTC, node-webrtc, and other products... But I'm having trouble understanding what each of them does and if they are really what I'm looking for. Also, I'm not sure if I can trust information dated from several years ago.

Could you please help me ?
Thanks.

JeanVt
Posts: 4
Joined: Mon Apr 16, 2018 10:26 am

Re: WebRTC peer without a browser

Mon Apr 16, 2018 9:03 pm

I just tried UV4L, but it doesn't seem to recognize my webcam (although the webcam worked fine in my previous WebRTC tests from the browser).

Code: Select all

$ uv4l --driver uvc --device-id 0ac8:301b
<notice> [core] Trying to loading driver 'uvc' from built-in drivers...
<notice> [core] Loading driver 'uvc' from external plug-in's...
<error> [core] Video functionality not found
<alert> [core] No device detected
I also tried webrtc-streamer (https://github.com/mpromonet/webrtc-streamer/), which works fine for streaming my webcam, but it doesn't look like I can receive audio from the other side using this (correct me if I'm wrong).

EDIT:
So I installed and ran mjpg-streamer, and used it as a source for a "virtual" camera in UV4L. Then, UV4L seems to do exactly what I want (I still need to do deeper tests, but that's enough for today).
I don't like that solution, but it looks okay for now. I'll try like this until I face some issue or someone suggests a better way.

RpiName
Posts: 703
Joined: Sat Jul 06, 2013 3:14 am

Re: WebRTC peer without a browser

Tue Apr 17, 2018 8:11 am

are you sure the webcam is uvc compliant?

in any case, uvc or not uvc, you can make uv4l the kernel driver directly, e.g.:

modprobe uvcvideo (or other video kernel module)

this will register e.g. /dev/video1.

then:

uv4l --external-driver --device-name=video1 --server-option '--port=9000'

JeanVt
Posts: 4
Joined: Mon Apr 16, 2018 10:26 am

Re: WebRTC peer without a browser

Tue Apr 17, 2018 7:06 pm

Yes, that works, thanks!
I didn't know about the --external-driver option. I should have read the docs, sorry.

kentloog
Posts: 1
Joined: Thu Nov 22, 2018 7:23 pm

Re: WebRTC peer without a browser

Thu Nov 22, 2018 7:28 pm

Hi JeanVt,

I have a similar project in mind. How far did you get with your approach and what was your solution to streaming PI video with no browser. If possible, can you share your code too? I would really need your help.

Thanks

vic41
Posts: 1
Joined: Mon Feb 11, 2019 6:12 am

Re: WebRTC peer without a browser

Mon Feb 11, 2019 6:26 am

Hi JeanVt,

did you resolve the problem you described in this post? Does it possible to use WebRTC without a browser?

Thanks,
Victor

JeanVt
Posts: 4
Joined: Mon Apr 16, 2018 10:26 am

Re: WebRTC peer without a browser

Fri Feb 15, 2019 8:21 pm

Hi,

Yes, using UV4L works fine. When you install it, the demo page gives you an example of WebRTC videoconference.
You can also use UV4L to make your Pi join a Janus video room (you can setup the Janus server locally too).

The only problem I have now is the performance. Sometimes it's acceptable, sometimes not.
UV4L is consuming a lot of the Pi's CPU (I'm using a Pi 3 B). But maybe it's my Wifi connection that has something to do with the performance too.
I also tried using an old Pi 1 B to join the conference, but in this case the performance is completely unacceptable.

decades
Posts: 4
Joined: Wed Jan 17, 2018 7:30 pm

Re: WebRTC peer without a browser

Mon Feb 25, 2019 12:26 pm

IMHO all these UV4L projects are WebRTC streamer only, exposing a signalling server interface via HTML. This requires the PI to be publicly available on the Internet, which is mostly not possible. What would be required, would be a solution, which would be able to do the SDP and ICE interchange with a publicly available server on demand (e.g. https://appr.tc/) in order to "book" a meeting room and organise the meta data exchange, so that the video/audio is flowing peer to peer then. Anyone aware of such a solution?

RpiName
Posts: 703
Joined: Sat Jul 06, 2013 3:14 am

Re: WebRTC peer without a browser

Mon Feb 25, 2019 2:55 pm

decades wrote:
Mon Feb 25, 2019 12:26 pm
IMHO all these UV4L projects are WebRTC streamer only, exposing a signalling server interface via HTML. This requires the PI to be publicly available on the Internet, which is mostly not possible.
It would be good to nothing if this were true. UV4L supports STUN/TURN servers for NAT traversal when used for bidirectional audio/video p2p, or can connect as a client to a Janus SFU videoroom on the Internet. In both cases there is no need to expose the rpi (except the HTTP port only in the first case).

Return to “Beginners”