Explorar el Código

Use unified plan for mobile browsers on iOS

All browsers on iOS use WebKit engine so they use the Unified Plan.
dev1
Jordan Owens hace 4 años
padre
commit
840302192a
Se han modificado 1 ficheros con 19 adiciones y 7 borrados
  1. 19
    7
      modules/browser/BrowserCapabilities.js

+ 19
- 7
modules/browser/BrowserCapabilities.js Ver fichero

@@ -64,6 +64,24 @@ export default class BrowserCapabilities extends BrowserDetection {
64 64
             || this.isOpera();
65 65
     }
66 66
 
67
+    /**
68
+     * Checks if the current browser is WebKit based. It's either
69
+     * Safari or uses WebKit as its engine.
70
+     *
71
+     * This includes Chrome and Firefox on iOS
72
+     *
73
+     * @returns {boolean}
74
+     */
75
+    isWebKitBased() {
76
+        // https://trac.webkit.org/changeset/236144/webkit/trunk/LayoutTests/webrtc/video-addLegacyTransceiver.html
77
+        return this._bowser.isEngine('webkit')
78
+            && typeof navigator.mediaDevices !== 'undefined'
79
+            && typeof navigator.mediaDevices.getUserMedia !== 'undefined'
80
+            && typeof window.RTCRtpTransceiver !== 'undefined'
81
+            // eslint-disable-next-line no-undef
82
+            && Object.keys(RTCRtpTransceiver.prototype).indexOf('currentDirection') > -1;
83
+    }
84
+
67 85
     /**
68 86
      * Checks whether current running context is a Trusted Web Application.
69 87
      *
@@ -208,16 +226,10 @@ export default class BrowserCapabilities extends BrowserDetection {
208 226
      * @returns {boolean}
209 227
      */
210 228
     usesUnifiedPlan() {
211
-        if (this.isFirefox()) {
229
+        if (this.isFirefox() || this.isWebKitBased()) {
212 230
             return true;
213 231
         }
214 232
 
215
-        if (this.isSafari() && typeof window.RTCRtpTransceiver !== 'undefined') {
216
-            // https://trac.webkit.org/changeset/236144/webkit/trunk/LayoutTests/webrtc/video-addLegacyTransceiver.html
217
-            // eslint-disable-next-line no-undef
218
-            return Object.keys(RTCRtpTransceiver.prototype).indexOf('currentDirection') > -1;
219
-        }
220
-
221 233
         return false;
222 234
     }
223 235
 

Loading…
Cancelar
Guardar