jitsi-meet-electron/modules/screensharing/index.js

34 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-12-12 21:46:47 +01:00
const electron = require("electron");
2016-12-12 21:46:47 +01:00
/**
* Get sources available for screensharing. The callback is invoked
* with an array of DesktopCapturerSources.
*
* @param {Function} callback - The success callback.
* @param {Function} errorCallback - The callback for errors.
* @param {Object} options - Configuration for getting sources.
* @param {Array} options.types - Specify the desktop source types to get,
* with valid sources being "window" and "screen".
* @param {Object} options.thumbnailSize - Specify how big the preview
* images for the sources should be. The valid keys are height and width,
* e.g. { height: number, width: number}. By default electron will return
* images with height and width of 150px.
2016-12-12 21:46:47 +01:00
*/
function obtainDesktopStreams(callback, errorCallback, options = {}) {
electron.desktopCapturer.getSources(options,
2016-12-12 21:46:47 +01:00
(error, sources) => {
if (error) {
errorCallback(error);
return;
}
callback(sources);
2016-12-12 21:46:47 +01:00
});
}
module.exports = function setupScreenSharingForWindow(pWindow) {
pWindow.JitsiMeetElectron = {
obtainDesktopStreams
};
2016-12-12 21:46:47 +01:00
};