Share screen with WebRTC

I need to implement screen sharing using WebRTC. I know that WebRTC supports tab sharing, but I need to split the whole screen. The solution I think of is to often take screenshots and use the WebRTC data channel to transfer the image to the other side. Then the other side will update the image every time a new image is received.

Can this be done? In particular, I am wondering if it is possible to transmit an image using the WebRTC data channel?

Thanks in advance.

+8
video-streaming webrtc
source share
3 answers

getUserMedia supports screen escaping, not just tab contents.

I did a screen demo (using the mandatory chromeMediaSource: 'screen' constraint) that passes the stream to RTCPeerConnection: https://simpl.info/screencapture .

The chrome.tabCapture API gets the contents of the tab, but of course this is not what you want: the example is here (although the code is now broken).

EDIT: Added HTTPS to links: this is required for screencapture.

+9
source share

Screenshots are available through the experimental getUserMedia restriction in Chrome ( not yet available in Firefox ).

You need to first enable the Enable screen capture support in getUserMedia() flag in chrome://flags .

Here is a good example of how to capture the screen here: https://html5-demos.appspot.com/static/getusermedia/screenshare.html .

+7
source share

Take a look at this Chrome extension, it has implemented desktop sharing, and that's pretty good. https://www.webrtc-experiment.com/Pluginfree-Screen-Sharing/

0
source share

All Articles