From b8b55a5029fc28742303ece0c91565edb205b0fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 10 Dec 2024 16:09:34 +0100 Subject: [PATCH] fix(browser) detect WebRTC APIs and mark browser unsupported if not Some so called "security" browser extensions override WebRTC APIs so even if the UA string suggests the browser is supported, it won't work. Coincidentally, this should also mark Safari in Lockdown Mode as unsupported, since the WebRTC APIs are not available in that case. --- modules/browser/BrowserCapabilities.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/browser/BrowserCapabilities.js b/modules/browser/BrowserCapabilities.js index 142428a305..24970d7b51 100644 --- a/modules/browser/BrowserCapabilities.js +++ b/modules/browser/BrowserCapabilities.js @@ -71,6 +71,12 @@ export default class BrowserCapabilities extends BrowserDetection { * @returns {boolean} true if the browser is supported, false otherwise. */ isSupported() { + // First check for WebRTC APIs because some "security" extensions are dumb. + if (typeof RTCPeerConnection === 'undefined' + || !navigator?.mediaDevices?.enumerateDevices || !navigator?.mediaDevices?.getUserMedia) { + return false; + } + if (this.isSafari() && this._getSafariVersion() < MIN_REQUIRED_SAFARI_VERSION) { return false; }