Selaa lähdekoodia

Fixing various edge-cases when two gUM error dialogs might be shown and other possible bugs

master
tsareg 9 vuotta sitten
vanhempi
commit
8b528b582f
2 muutettua tiedostoa jossa 13 lisäystä ja 5 poistoa
  1. 7
    1
      modules/UI/UI.js
  2. 6
    4
      modules/devices/mediaDeviceHelper.js

+ 7
- 1
modules/UI/UI.js Näytä tiedosto

@@ -39,6 +39,8 @@ let sharedVideoManager;
39 39
 
40 40
 let followMeHandler;
41 41
 
42
+let deviceErrorDialog;
43
+
42 44
 const TrackErrors = JitsiMeetJS.errors.track;
43 45
 
44 46
 const JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP = {
@@ -1267,7 +1269,11 @@ UI.showDeviceErrorDialog = function (micError, cameraError) {
1267 1269
 
1268 1270
     message = `${message}${doNotShowWarningAgainSection}`;
1269 1271
 
1270
-    messageHandler.openDialog(
1272
+    // To make sure we don't have multiple error dialogs open at the same time,
1273
+    // we will just close the previous one if we are going to show a new one.
1274
+    deviceErrorDialog && deviceErrorDialog.close();
1275
+
1276
+    deviceErrorDialog = messageHandler.openDialog(
1271 1277
         titleMsg,
1272 1278
         message,
1273 1279
         false,

+ 6
- 4
modules/devices/mediaDeviceHelper.js Näytä tiedosto

@@ -194,15 +194,17 @@ export default {
194 194
             return createLocalTracks(
195 195
                     ['audio', 'video'], cameraDeviceId, micDeviceId)
196 196
                     // If we fail to do this, try to create them separately.
197
-                    .catch(() => Promise.all(
198
-                        [createAudioTrack(false), createVideoTrack(false)]))
199
-                    .then((audioTracks, videoTracks) => {
197
+                    .catch(() => Promise.all([
198
+                        createAudioTrack(false).then(([stream]) => stream),
199
+                        createVideoTrack(false).then(([stream]) => stream)
200
+                    ]))
201
+                    .then(tracks => {
200 202
                         if (audioTrackError || videoTrackError) {
201 203
                             APP.UI.showDeviceErrorDialog(
202 204
                                 audioTrackError, videoTrackError);
203 205
                         }
204 206
 
205
-                        return (audioTracks || []).concat(videoTracks || []);
207
+                        return tracks.filter(t => typeof t !== 'undefined');
206 208
                     });
207 209
         } else if (videoRequested && !audioRequested) {
208 210
             return createVideoTrack();

Loading…
Peruuta
Tallenna