From 8a5c1ddab16a1a07aab9fc789687b2759170922d Mon Sep 17 00:00:00 2001 From: Daniel McAssey Date: Thu, 23 Jan 2025 12:14:05 +0000 Subject: [PATCH] fix(ScreenObtainer): allow Electron to use getDisplayMedia, hidden behind a flag for now (#2605) --- 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 5d883ca291..cfb29a9d85 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());