Browse Source

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

master
tsareg 9 years ago
parent
commit
8b528b582f
2 changed files with 13 additions and 5 deletions
  1. 7
    1
      modules/UI/UI.js
  2. 6
    4
      modules/devices/mediaDeviceHelper.js

+ 7
- 1
modules/UI/UI.js View File

39
 
39
 
40
 let followMeHandler;
40
 let followMeHandler;
41
 
41
 
42
+let deviceErrorDialog;
43
+
42
 const TrackErrors = JitsiMeetJS.errors.track;
44
 const TrackErrors = JitsiMeetJS.errors.track;
43
 
45
 
44
 const JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP = {
46
 const JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP = {
1267
 
1269
 
1268
     message = `${message}${doNotShowWarningAgainSection}`;
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
         titleMsg,
1277
         titleMsg,
1272
         message,
1278
         message,
1273
         false,
1279
         false,

+ 6
- 4
modules/devices/mediaDeviceHelper.js View File

194
             return createLocalTracks(
194
             return createLocalTracks(
195
                     ['audio', 'video'], cameraDeviceId, micDeviceId)
195
                     ['audio', 'video'], cameraDeviceId, micDeviceId)
196
                     // If we fail to do this, try to create them separately.
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
                         if (audioTrackError || videoTrackError) {
202
                         if (audioTrackError || videoTrackError) {
201
                             APP.UI.showDeviceErrorDialog(
203
                             APP.UI.showDeviceErrorDialog(
202
                                 audioTrackError, videoTrackError);
204
                                 audioTrackError, videoTrackError);
203
                         }
205
                         }
204
 
206
 
205
-                        return (audioTracks || []).concat(videoTracks || []);
207
+                        return tracks.filter(t => typeof t !== 'undefined');
206
                     });
208
                     });
207
         } else if (videoRequested && !audioRequested) {
209
         } else if (videoRequested && !audioRequested) {
208
             return createVideoTrack();
210
             return createVideoTrack();

Loading…
Cancel
Save