Purpose
In order to support screen sharing the client api needs enumerate screens and windows. This api provided a list of screens (each monitor) and list of windows available; providing title, id and thumbnail. This api is essentially equivalent of electron api: https://electron.atom.io/docs/api/desktop-capturer/#desktopcapturergetsourcesoptions-callback
getMediaSources API
getMediaSources(options, callback);
where options (Object) is:
types
String[] - An array of Strings that lists the types of desktop sources to be captured, available types arescreen
andwindow
.thumbnailSize
(optional) - The size that the media source thumbnail should be scaled to. Default is150
x150
.
where callback (function) is:
error
Error- Array of DesktopSource
where DesktopSource (Object) is:
- id (String) - The identifier of a window or screen that can be used as a
chromeMediaSourceId
constraint when calling [navigator.webkitGetUserMedia
]. The format of the identifier will bewindow:XX
orscreen:XX
, whereXX
is a random generated number. - name (String) - A screen source will be named either
Entire Screen
orScreen <index>
, while the name of a window source will match the window title. - thumbnail (String) - Base64 encoded png image.