浏览代码

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.
tags/v0.0.2
Jaya Allamsetty 4 年前
父节点
当前提交
b0d27fa8da
共有 2 个文件被更改,包括 15 次插入1 次删除
  1. 3
    1
      JitsiConference.js
  2. 12
    0
      modules/browser/BrowserCapabilities.js

+ 3
- 1
JitsiConference.js 查看文件

@@ -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 查看文件

@@ -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.

正在加载...
取消
保存