Rafael Viscarra, one of our engineers, wrote a blog post about using WebRTC to stream a remote server screen. Here’s how it works:
- The service starts and listens on port 9000 by default. We can change this with a flag.
- The service exposes two endpoints: (1)
POST /session
starts a session and (2)GET /screens
gets the available screens from the remote server. - Once a screen is chosen, an SDP offer is created in the browser. For simplicity, there is a workaround in place to avoid trickle ICE.
- Once all ICE candidates have been gathered, a
POST /session
request is made with the selected screen and browser’s SDP. - The backend inspects the offer and checks to see if the browser supports h264 baseline 3.1. If everything goes well, the server responds with an SDP answer.
- The browser should receive and show the video stream.
Check out Rafael’s blog post to learn how to replicate this and get around a known bug in Firefox. Keep an eye out for more WebRTC tips on his blog soon!