Ver código fonte

fix(tracks) Always add audio track on Safari.

This fixes an issue where Safari users cannot hear remote audio if they join audio/video muted. The browser throws the following error when the application tries to execute play on the audio element: 'NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.' This started happening in Safari 15.
master
Jaya Allamsetty 3 anos atrás
pai
commit
2572ba9a65
1 arquivos alterados com 8 adições e 9 exclusões
  1. 8
    9
      conference.js

+ 8
- 9
conference.js Ver arquivo

@@ -59,7 +59,6 @@ import {
59 59
     setAudioOutputDeviceId,
60 60
     updateDeviceList
61 61
 } from './react/features/base/devices';
62
-import { isIosMobileBrowser } from './react/features/base/environment/utils';
63 62
 import {
64 63
     browser,
65 64
     isFatalJitsiConnectionError,
@@ -835,9 +834,9 @@ export default {
835 834
         this._initDeviceList(true);
836 835
 
837 836
         if (initialOptions.startWithAudioMuted) {
838
-            // Always add the audio track to the peer connection and then mute the track on mobile Safari
839
-            // because of a known issue where audio playout doesn't happen if the user joins audio and video muted.
840
-            if (isIosMobileBrowser()) {
837
+            // Always add the track on Safari because of a known issue where audio playout doesn't happen
838
+            // if the user joins audio and video muted, i.e., if there is no local media capture.
839
+            if (browser.isWebKitBased()) {
841 840
                 this.muteAudio(true, true);
842 841
             } else {
843 842
                 localTracks = localTracks.filter(track => track.getType() !== MEDIA_TYPE.AUDIO);
@@ -1357,8 +1356,8 @@ export default {
1357 1356
                 APP.conference.roomName,
1358 1357
                 this._getConferenceOptions());
1359 1358
 
1360
-        // Filter out the tracks that are muted (except on mobile Safari).
1361
-        const tracks = isIosMobileBrowser() ? localTracks : localTracks.filter(track => !track.isMuted());
1359
+        // Filter out the tracks that are muted (except on Safari).
1360
+        const tracks = browser.isWebKitBased() ? localTracks : localTracks.filter(track => !track.isMuted());
1362 1361
 
1363 1362
         this._setLocalAudioVideoStreams(tracks);
1364 1363
         this._room = room; // FIXME do not use this
@@ -2295,9 +2294,9 @@ export default {
2295 2294
 
2296 2295
             // Remove the tracks from the peerconnection.
2297 2296
             for (const track of localTracks) {
2298
-                // Always add the track on mobile Safari because of a known issue where audio playout doesn't happen
2299
-                // if the user joins audio and video muted.
2300
-                if (audioMuted && track.jitsiTrack?.getType() === MEDIA_TYPE.AUDIO && !isIosMobileBrowser()) {
2297
+                // Always add the track on Safari because of a known issue where audio playout doesn't happen
2298
+                // if the user joins audio and video muted, i.e., if there is no local media capture.
2299
+                if (audioMuted && track.jitsiTrack?.getType() === MEDIA_TYPE.AUDIO && !browser.isWebKitBased()) {
2301 2300
                     promises.push(this.useAudioStream(null));
2302 2301
                 }
2303 2302
                 if (videoMuted && track.jitsiTrack?.getType() === MEDIA_TYPE.VIDEO) {

Carregando…
Cancelar
Salvar