Skip to content

Commit

Permalink
fix(browser) detect WebRTC APIs and mark browser unsupported if not
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
saghul committed Dec 10, 2024
1 parent 144b0ca commit 1ab4ae5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/browser/BrowserCapabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1ab4ae5

Please sign in to comment.