diff options
author | 2022-04-29 13:38:19 +0200 | |
---|---|---|
committer | 2022-04-29 07:57:25 -0500 | |
commit | f6d086bc3da5312c7eeb9fa6834312ede795d1dc (patch) | |
tree | 8553f94693750b39d28d648cc0f2e9ffcb954c8f /src/webview/screenshare.ts | |
parent | Update submodules, browserslist data updates and linter fixes [skip ci] (diff) | |
download | ferdium-app-f6d086bc3da5312c7eeb9fa6834312ede795d1dc.tar.gz ferdium-app-f6d086bc3da5312c7eeb9fa6834312ede795d1dc.tar.zst ferdium-app-f6d086bc3da5312c7eeb9fa6834312ede795d1dc.zip |
fix: desktopCapturer in electron 17+ (fixes #59)
Since electron 17, desktopCapturer is only available in the main
process:
https://www.electronjs.org/blog/electron-17-0#desktopcapturergetsources-in-the-renderer
This patch adds a new IPC message from the service renderer to the main
process so it can still invoke desktopCapturer.getSources
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'src/webview/screenshare.ts')
-rw-r--r-- | src/webview/screenshare.ts | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/webview/screenshare.ts b/src/webview/screenshare.ts index dbc23d62c..e631ce52f 100644 --- a/src/webview/screenshare.ts +++ b/src/webview/screenshare.ts | |||
@@ -1,11 +1,9 @@ | |||
1 | import { desktopCapturer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | 2 | ||
3 | const CANCEL_ID = 'desktop-capturer-selection__cancel'; | 3 | const CANCEL_ID = 'desktop-capturer-selection__cancel'; |
4 | 4 | ||
5 | export async function getDisplayMediaSelector() { | 5 | export async function getDisplayMediaSelector() { |
6 | const sources = await desktopCapturer.getSources({ | 6 | const sources = await ipcRenderer.invoke('get-desktop-capturer-sources'); |
7 | types: ['screen', 'window'], | ||
8 | }); | ||
9 | return `<div class="desktop-capturer-selection__scroller"> | 7 | return `<div class="desktop-capturer-selection__scroller"> |
10 | <ul class="desktop-capturer-selection__list"> | 8 | <ul class="desktop-capturer-selection__list"> |
11 | ${sources | 9 | ${sources |