From 349bb2730aab355e7a56d8899fcb96393c06ec43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Thu, 14 Jan 2021 12:44:50 +0100 Subject: [PATCH] Update thumbnails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/webrtc/call.ts | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index 5ee4bc1fb..040562c9a 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -185,6 +185,21 @@ const FALLBACK_ICE_SERVER = 'stun:turn.matrix.org'; /** The length of time a call can be ringing for. */ const CALL_TIMEOUT_MS = 60000; +/** Retrieves sources from desktopCapturer */ +export function getDesktopCapturerSources(): Promise> { + const options: GetSourcesOptions = { + thumbnailSize: { + height: 176, + width: 312, + }, + types: [ + "screen", + "window", + ], + }; + return window.electron.getDesktopCapturerSources(options); +} + export class CallError extends Error { code : string; @@ -342,9 +357,7 @@ export class MatrixCall extends EventEmitter { async placeScreenSharingCall( remoteVideoElement: HTMLVideoElement, localVideoElement: HTMLVideoElement, - selectDesktopCapturerSource: ( - sources: Array, - ) => Promise, + selectDesktopCapturerSource: () => Promise, ) { logger.debug("placeScreenSharingCall"); this.checkForErrorListener(); @@ -355,18 +368,7 @@ export class MatrixCall extends EventEmitter { // We have access to getDesktopCapturerSources() logger.debug("Electron getDesktopCapturerSources() is available..."); try { - const getSourcesOptions: GetSourcesOptions = { - thumbnailSize: { - height: 176, - width: 312, - }, - types: [ - "screen", - "window", - ], - }; - const sources = await window.electron.getDesktopCapturerSources(getSourcesOptions); - const selectedSource = await selectDesktopCapturerSource(sources); + const selectedSource = await selectDesktopCapturerSource(); const getUserMediaOptions: MediaStreamConstraints | DesktopCapturerConstraints = { audio: false, video: {