Parcourir la source

fix(browser-support): Add audio track to pc always on mobile Safari.

On mobile Safari, if a user joins audio and video muted, the browser doesn't decode the incoming audio. Workaround is to always add the audio track to pc and mute it if needed.
dev1
Jaya Allamsetty il y a 4 ans
Parent
révision
b0d27fa8da
2 fichiers modifiés avec 15 ajouts et 1 suppressions
  1. 3
    1
      JitsiConference.js
  2. 12
    0
      modules/browser/BrowserCapabilities.js

+ 3
- 1
JitsiConference.js Voir le fichier

@@ -1092,8 +1092,10 @@ JitsiConference.prototype._fireMuteChangeEvent = function(track) {
1092 1092
  * @returns {Array<JitsiLocalTrack>} - list of local tracks that are unmuted.
1093 1093
  */
1094 1094
 JitsiConference.prototype._getInitialLocalTracks = function() {
1095
+    // Always add the audio track on mobile Safari because of a known issue where audio playout doesn't happen
1096
+    // if the user joins audio and video muted.
1095 1097
     return this.getLocalTracks()
1096
-        .filter(track => (track.getType() === MediaType.AUDIO && !this.isStartAudioMuted())
1098
+        .filter(track => (track.getType() === MediaType.AUDIO && (!this.isStartAudioMuted() || browser.isIosBrowser()))
1097 1099
         || (track.getType() === MediaType.VIDEO && !this.isStartVideoMuted()));
1098 1100
 };
1099 1101
 

+ 12
- 0
modules/browser/BrowserCapabilities.js Voir le fichier

@@ -56,6 +56,18 @@ export default class BrowserCapabilities extends BrowserDetection {
56 56
             && !this.isWebKitBased();
57 57
     }
58 58
 
59
+    /**
60
+     * Checks if the current platform is iOS.
61
+     *
62
+     * @returns {boolean}
63
+     */
64
+    isIosBrowser() {
65
+        const { userAgent, maxTouchPoints, platform } = navigator;
66
+
67
+        return userAgent.match(/iP(ad|hone|od)/i
68
+            || (maxTouchPoints && maxTouchPoints > 2 && /MacIntel/.test(platform)));
69
+    }
70
+
59 71
     /**
60 72
      * Checks if the current browser is WebKit based. It's either
61 73
      * Safari or uses WebKit as its engine.

Chargement…
Annuler
Enregistrer