Company
Date Published
Author
Phil Nash
Word count
1843
Language
English
Hacker News points
None

Summary

To build screen sharing capabilities into a WebRTC video chat application, you need to access the screen capture capabilities of Google Chrome from within a web application. This can be achieved by writing a Chrome extension that allows access to the screen, application windows, and browser tabs. The extension must be installed in Chrome before it can be used. The process involves creating a manifest file, writing the background script, and using the chrome.desktopCapture.chooseDesktopMedia method to pop up the screen sharing choice. Once the user authorizes access to the screen, the extension returns either an unsuccessful response or the ID of the stream to the web page using sendResponse. The web page can then use this stream ID to capture the desktop using the mediaDevices API.