Bladeren bron

feat(browser-support): Add support for WKWebview based browsers.

Apple added getUserMedia support for WkWebview based browsers like chrome and Firefox on iOS 14.3. These browsers behave as Safari does on iOS. Therefore, extend the Safari checks to these webkit based browsers as well.
dev1
Jaya Allamsetty 4 jaren geleden
bovenliggende
commit
e60f09b189

+ 2
- 2
JitsiConference.js Bestand weergeven

@@ -439,7 +439,7 @@ JitsiConference.prototype._init = function(options = {}) {
439 439
 
440 440
     // Disable VAD processing on Safari since it causes audio input to
441 441
     // fail on some of the mobile devices.
442
-    if (config.enableTalkWhileMuted && !browser.isSafari()) {
442
+    if (config.enableTalkWhileMuted && !browser.isWebKitBased()) {
443 443
 
444 444
         // If VAD processor factory method is provided uses VAD based detection, otherwise fallback to audio level
445 445
         // based detection.
@@ -463,7 +463,7 @@ JitsiConference.prototype._init = function(options = {}) {
463 463
 
464 464
     // Disable noisy mic detection on safari since it causes the audio input to
465 465
     // fail on Safari on iPadOS.
466
-    if (config.enableNoisyMicDetection && !browser.isSafari()) {
466
+    if (config.enableNoisyMicDetection && !browser.isWebKitBased()) {
467 467
         if (config.createVADProcessor) {
468 468
             if (!this._audioAnalyser) {
469 469
                 this._audioAnalyser = new VADAudioAnalyser(this, config.createVADProcessor);

+ 3
- 3
modules/RTC/RTCUtils.js Bestand weergeven

@@ -175,7 +175,7 @@ function getConstraints(um, options = {}) {
175 175
     // @see https://github.com/jitsi/lib-jitsi-meet/pull/136
176 176
     const isNewStyleConstraintsSupported
177 177
         = browser.isFirefox()
178
-            || browser.isSafari()
178
+            || browser.isWebKitBased()
179 179
             || browser.isReactNative();
180 180
 
181 181
     if (um.indexOf('video') >= 0) {
@@ -383,7 +383,7 @@ function newGetConstraints(um = [], options = {}) {
383 383
         // https://bugs.webkit.org/show_bug.cgi?id=210932
384 384
         // Camera doesn't start on older macOS versions if min/max constraints are specified.
385 385
         // TODO: remove this hack when the bug fix is available on Mojave, Sierra and High Sierra.
386
-        if (browser.isSafari()) {
386
+        if (browser.isWebKitBased()) {
387 387
             if (constraints.video.height && constraints.video.height.ideal) {
388 388
                 constraints.video.height = { ideal: clonedeep(constraints.video.height.ideal) };
389 389
             } else {
@@ -412,7 +412,7 @@ function newGetConstraints(um = [], options = {}) {
412 412
         }
413 413
 
414 414
         // Use the standard audio constraints on non-chromium browsers.
415
-        if (browser.isFirefox() || browser.isSafari()) {
415
+        if (browser.isFirefox() || browser.isWebKitBased()) {
416 416
             constraints.audio = {
417 417
                 deviceId: options.micDeviceId,
418 418
                 autoGainControl: !disableAGC && !disableAP,

+ 1
- 1
modules/RTC/TPCUtils.js Bestand weergeven

@@ -448,7 +448,7 @@ export class TPCUtils {
448 448
      * @returns {void}
449 449
      */
450 450
     updateEncodingsResolution(parameters) {
451
-        if (!(browser.isSafari() && parameters.encodings && Array.isArray(parameters.encodings))) {
451
+        if (!(browser.isWebKitBased() && parameters.encodings && Array.isArray(parameters.encodings))) {
452 452
             return;
453 453
         }
454 454
         const allEqualEncodings

+ 2
- 2
modules/RTC/TraceablePeerConnection.js Bestand weergeven

@@ -879,7 +879,7 @@ TraceablePeerConnection.prototype._createRemoteTrack = function(
879 879
     // Delete the existing track and create the new one because of a known bug on Safari.
880 880
     // RTCPeerConnection.ontrack fires when a new remote track is added but MediaStream.onremovetrack doesn't so
881 881
     // it needs to be removed whenever a new track is received for the same endpoint id.
882
-    if (existingTrack && browser.isSafari()) {
882
+    if (existingTrack && browser.isWebKitBased()) {
883 883
         this._remoteTrackRemoved(existingTrack.getOriginalStream(), existingTrack.getTrack());
884 884
     }
885 885
 
@@ -2761,7 +2761,7 @@ TraceablePeerConnection.prototype.getStats = function(callback, errback) {
2761 2761
     // TODO (brian): After moving all browsers to adapter, check if adapter is
2762 2762
     // accounting for different getStats apis, making the browser-checking-if
2763 2763
     // unnecessary.
2764
-    if (browser.isSafari() || browser.isFirefox() || browser.isReactNative()) {
2764
+    if (browser.isWebKitBased() || browser.isFirefox() || browser.isReactNative()) {
2765 2765
         // uses the new Promise based getStats
2766 2766
         this.peerconnection.getStats()
2767 2767
             .then(callback)

+ 8
- 8
modules/browser/BrowserCapabilities.js Bestand weergeven

@@ -33,7 +33,7 @@ export default class BrowserCapabilities extends BrowserDetection {
33 33
      * strategy or <tt>false</tt> otherwise.
34 34
      */
35 35
     doesVideoMuteByStreamRemove() {
36
-        return this.isChromiumBased() || this.isSafari();
36
+        return this.isChromiumBased() || this.isWebKitBased();
37 37
     }
38 38
 
39 39
     /**
@@ -100,7 +100,7 @@ export default class BrowserCapabilities extends BrowserDetection {
100 100
         return (this.isChromiumBased() && this._getChromiumBasedVersion() >= MIN_REQUIRED_CHROME_VERSION)
101 101
             || this.isFirefox()
102 102
             || this.isReactNative()
103
-            || (this.isSafari() && !this.isVersionLessThan('12.1'));
103
+            || this.isWebKitBased();
104 104
     }
105 105
 
106 106
     /**
@@ -120,7 +120,7 @@ export default class BrowserCapabilities extends BrowserDetection {
120 120
      * otherwise.
121 121
      */
122 122
     supportsVideoMuteOnConnInterrupted() {
123
-        return this.isChromiumBased() || this.isReactNative() || this.isSafari();
123
+        return this.isChromiumBased() || this.isReactNative() || this.isWebKitBased();
124 124
     }
125 125
 
126 126
     /**
@@ -131,7 +131,7 @@ export default class BrowserCapabilities extends BrowserDetection {
131 131
     supportsBandwidthStatistics() {
132 132
         // FIXME bandwidth stats are currently not implemented for FF on our
133 133
         // side, but not sure if not possible ?
134
-        return !this.isFirefox() && !this.isSafari();
134
+        return !this.isFirefox() && !this.isWebKitBased();
135 135
     }
136 136
 
137 137
     /**
@@ -146,7 +146,7 @@ export default class BrowserCapabilities extends BrowserDetection {
146 146
 
147 147
             // this is not working on Safari because of the following bug
148 148
             // https://bugs.webkit.org/show_bug.cgi?id=215567
149
-            && !this.isSafari();
149
+            && !this.isWebKitBased();
150 150
     }
151 151
 
152 152
     /**
@@ -164,7 +164,7 @@ export default class BrowserCapabilities extends BrowserDetection {
164 164
      * candidates through the legacy getStats() API.
165 165
      */
166 166
     supportsLocalCandidateRttStatistics() {
167
-        return this.isChromiumBased() || this.isReactNative() || this.isSafari();
167
+        return this.isChromiumBased() || this.isReactNative() || this.isWebKitBased();
168 168
     }
169 169
 
170 170
     /**
@@ -217,7 +217,7 @@ export default class BrowserCapabilities extends BrowserDetection {
217 217
      * @returns {boolean}
218 218
      */
219 219
     usesSdpMungingForSimulcast() {
220
-        return this.isChromiumBased() || this.isReactNative() || this.isSafari();
220
+        return this.isChromiumBased() || this.isReactNative() || this.isWebKitBased();
221 221
     }
222 222
 
223 223
     /**
@@ -242,7 +242,7 @@ export default class BrowserCapabilities extends BrowserDetection {
242 242
      * @returns {boolean}
243 243
      */
244 244
     usesNewGumFlow() {
245
-        if (this.isChromiumBased() || this.isFirefox() || this.isSafari()) {
245
+        if (this.isChromiumBased() || this.isFirefox() || this.isWebKitBased()) {
246 246
             return true;
247 247
         }
248 248
 

+ 1
- 1
modules/statistics/RTPStatsCollector.js Bestand weergeven

@@ -232,7 +232,7 @@ export default function StatsCollector(
232 232
      * @type {boolean}
233 233
      */
234 234
     this._usesPromiseGetStats
235
-        = browser.isSafari() || browser.isFirefox() || browser.isReactNative();
235
+        = browser.isWebKitBased() || browser.isFirefox() || browser.isReactNative();
236 236
 
237 237
     /**
238 238
      * The function which is to be used to retrieve the value associated in a

Laden…
Annuleren
Opslaan