The problem#
I wanted to stream video of myself and my screen at the same time. My plan was to put the video of myself on my screen and stream the entire screen, but I do not have a camera on my desktop. On the other hand, I do have a smartphone with a camera, so I needed a way to show the video from my phone's camera on my desktop's screen.
There are a few Android apps that promise to do so, but none of the ones I tried worked very well. But I know that video chat works just fine on my phone, including in a web browser using WebRTC which supports peer-to-peer video chat between two web browsers, so it should be easy to show the video from my phone's camera in a browser window on my desktop. Unfortunately, I couldn't find any straightforward solution for setting up just a peer-to-peer video link.
The solution#
Open minimal-webrtc
on the computer you
want the video streamed to. A QR code will appear; use your smartphone
to read it and after approving access to the camera, the video should
appear in the first browser window. This is intended to be used for
local connections, so it may not work if the two devices are not on the
same network. Only the signaling to set up the connection goes to the
minimal-webrtc
server, the actual video will be sent peer-to-peer over
the local network.
To get just the video as a bare window with no decorations, use
chromium --app=uri
to get rid of the address
bar, etc., and this script to remove the
rest.
To host it yourself, download the source code1
and use the included run_daphne.sh
script
(which assumes daphne
is installed) and
nginx configuration. As
WebRTC requires HTTPS, to run it on
your local network, you may need to
set up a self-signed certificate.