From 928ee2aaf0b4ea1a3508b74f893c0b458ae9e870 Mon Sep 17 00:00:00 2001 From: Daniel McAssey Date: Fri, 6 Dec 2024 15:30:23 +0000 Subject: [PATCH] fix(ScreenObtainer): allow Electron to use getDisplayMedia, hidden behind a flag for now --- modules/RTC/ScreenObtainer.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/RTC/ScreenObtainer.js b/modules/RTC/ScreenObtainer.js index e18d508ef8..353ad0a58d 100644 --- a/modules/RTC/ScreenObtainer.js +++ b/modules/RTC/ScreenObtainer.js @@ -46,11 +46,13 @@ const ScreenObtainer = { * @private */ _createObtainStreamMethod() { - if (browser.isElectron()) { + const supportsGetDisplayMedia = browser.supportsGetDisplayMedia(); + + if (browser.isElectron() && !this.options.electronUseGetDisplayMedia) { return this.obtainScreenOnElectron; - } else if (browser.isReactNative() && browser.supportsGetDisplayMedia()) { + } else if (browser.isReactNative() && supportsGetDisplayMedia) { return this.obtainScreenFromGetDisplayMediaRN; - } else if (browser.supportsGetDisplayMedia()) { + } else if (supportsGetDisplayMedia) { return this.obtainScreenFromGetDisplayMedia; } logger.log('Screen sharing not supported on ', browser.getName());