Skip to content

Commit

Permalink
fix: electron 7
Browse files Browse the repository at this point in the history
  • Loading branch information
hristoterezov committed Jan 15, 2020
1 parent 74dd71a commit cfa14d0
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 132 deletions.
184 changes: 62 additions & 122 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jitsi-meet-electron-utils",
"version": "1.0.3",
"version": "1.0.4",
"description": "Utilities for jitsi-meet-electron project",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -29,7 +29,8 @@
"nan": "^2.14.0",
"postis": "^2.2.0",
"prebuild-install": "^5.3.0",
"robotjs": "jitsi/robotjs#jitsi-electron6"
"robotjs": "0.6.0",
"semver": "7.1.1"
},
"devDependencies": {
"eslint": ">=3",
Expand Down
26 changes: 18 additions & 8 deletions screensharing/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/* global process */

const electron = require("electron");
const semver = require('semver');

module.exports = function setupScreenSharingForWindow(iframe) {
// make sure that even after reload/redirect the screensharing will be
// available
Expand All @@ -20,15 +24,21 @@ module.exports = function setupScreenSharingForWindow(iframe) {
* 150px.
*/
obtainDesktopStreams(callback, errorCallback, options = {}) {
electron.desktopCapturer.getSources(options,
(error, sources) => {
if (error) {
errorCallback(error);
return;
}
if (semver.lt(process.versions.electron, '5.0.0')) {
electron.desktopCapturer.getSources(options,
(error, sources) => {
if (error) {
errorCallback(error);
return;
}

callback(sources);
});
callback(sources);
});
} else {
electron.desktopCapturer.getSources(options)
.then(sources => callback(sources))
.catch(error => errorCallback(error));
}
}
};
});
Expand Down

0 comments on commit cfa14d0

Please sign in to comment.