Accomplish screen sharing using WebRTC

mkd156 picture mkd156 · Jul 9, 2013 · Viewed 18.4k times · Source

I need to implement screen sharing using WebRTC. I know that WebRTC supports sharing of tab content but I need to share the whole screen. A solution I am thinking of is to frequently take screenshots and using WebRTC data channel transfer the image to other party. The other party will then update the image each time a new image is received.

Is this possible to accomplish? Particularly I am wondering if it is possible to transfer image using WebRTC data channel?

Thank you in advance.

Answer

Sam Dutton picture Sam Dutton · Jul 10, 2013

getUserMedia supports screensharing of the whole screen, not just the tab content.

I've done a screen capture demo (using the mandatory constraint chromeMediaSource: 'screen') which pipes the stream into an RTCPeerConnection: https://simpl.info/screencapture.

The chrome.tabCapture API gets tab content, but of course that's not what you want: example here (though the code is now broken).

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