Просмотр исходного кода

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.
release-8443
Saúl Ibarra Corretgé 1 год назад
Родитель
Сommit
1ab4ae5e53
1 измененных файлов: 6 добавлений и 0 удалений
  1. 6
    0
      modules/browser/BrowserCapabilities.js

+ 6
- 0
modules/browser/BrowserCapabilities.js Просмотреть файл

71
      * @returns {boolean} true if the browser is supported, false otherwise.
71
      * @returns {boolean} true if the browser is supported, false otherwise.
72
      */
72
      */
73
     isSupported() {
73
     isSupported() {
74
+        // First check for WebRTC APIs because some "security" extensions are dumb.
75
+        if (typeof RTCPeerConnection === 'undefined'
76
+                || !navigator?.mediaDevices?.enumerateDevices || !navigator?.mediaDevices?.getUserMedia) {
77
+            return false;
78
+        }
79
+
74
         if (this.isSafari() && this._getSafariVersion() < MIN_REQUIRED_SAFARI_VERSION) {
80
         if (this.isSafari() && this._getSafariVersion() < MIN_REQUIRED_SAFARI_VERSION) {
75
             return false;
81
             return false;
76
         }
82
         }

Загрузка…
Отмена
Сохранить