3

Is it possible to stream the Desktop Information using webrtc in a webapplication. Would an application like that be a security issue if that is possible, currently we built an application which can stream using the Webcam with webrtc. But I have no real idea of how to stream the actual Desktop of the Computer to someone, I only know of native application like Skype or TeamViewer which can do something like this, but a webapplication?

jib
  • 34,243
  • 11
  • 80
  • 138
Jon not doe xx
  • 413
  • 3
  • 6
  • 14

1 Answers1

2

Yes it's possible. To stream the user's desktop instead of their camera, replace

const stream = await navigator.mediaDevices.getUserMedia({video: true});

with

const stream = await navigator.mediaDevices.getDisplayMedia({video: true});

This will prompt the user to share an application window or desktop surface of their choice.

Note that browser support is limited at the moment. getDisplayMedia is implemented in Chrome 72, Firefox 66, Edge 17, and behind a flag in Safari 11.

It is also available using the adapter.js polyfill on older versions of Firefox and Chrome, though this requires installing a web extension in Chrome.

Would an application like that be a security issue

Yes, there are significant security issues related to screen sharing.

The obvious risk of letting a web site record your desktop is it may reveal private information.

A nonobvious risk is that sharing your browser or the entire desktop when your browser is visible on it, is dangerous, and should only be done with sites you trust.

This is because a malicious web site present on such web surfaces may effectively browse on your behalf and record the results, circumventing important cross-origin protections in the browser.

jib
  • 34,243
  • 11
  • 80
  • 138