Skip to content

Commit cfa14d0

Browse files
committed
fix: electron 7
1 parent 74dd71a commit cfa14d0

File tree

3 files changed

+83
-132
lines changed

3 files changed

+83
-132
lines changed

package-lock.json

Lines changed: 62 additions & 122 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jitsi-meet-electron-utils",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "Utilities for jitsi-meet-electron project",
55
"main": "index.js",
66
"scripts": {
@@ -29,7 +29,8 @@
2929
"nan": "^2.14.0",
3030
"postis": "^2.2.0",
3131
"prebuild-install": "^5.3.0",
32-
"robotjs": "jitsi/robotjs#jitsi-electron6"
32+
"robotjs": "0.6.0",
33+
"semver": "7.1.1"
3334
},
3435
"devDependencies": {
3536
"eslint": ">=3",

screensharing/index.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
/* global process */
2+
13
const electron = require("electron");
4+
const semver = require('semver');
5+
26
module.exports = function setupScreenSharingForWindow(iframe) {
37
// make sure that even after reload/redirect the screensharing will be
48
// available
@@ -20,15 +24,21 @@ module.exports = function setupScreenSharingForWindow(iframe) {
2024
* 150px.
2125
*/
2226
obtainDesktopStreams(callback, errorCallback, options = {}) {
23-
electron.desktopCapturer.getSources(options,
24-
(error, sources) => {
25-
if (error) {
26-
errorCallback(error);
27-
return;
28-
}
27+
if (semver.lt(process.versions.electron, '5.0.0')) {
28+
electron.desktopCapturer.getSources(options,
29+
(error, sources) => {
30+
if (error) {
31+
errorCallback(error);
32+
return;
33+
}
2934

30-
callback(sources);
31-
});
35+
callback(sources);
36+
});
37+
} else {
38+
electron.desktopCapturer.getSources(options)
39+
.then(sources => callback(sources))
40+
.catch(error => errorCallback(error));
41+
}
3242
}
3343
};
3444
});

0 commit comments

Comments
 (0)