Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

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

tsareg8b528b582f82
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index 300e00a7ed..c3d6f97a7d 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -39,6 +39,8 @@ let sharedVideoManager;
let followMeHandler;
+let deviceErrorDialog;
+
const TrackErrors = JitsiMeetJS.errors.track;
const JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP = {
@@ -1267,7 +1269,11 @@ UI.showDeviceErrorDialog = function (micError, cameraError) {
message = `${message}${doNotShowWarningAgainSection}`;
- messageHandler.openDialog(
+ // To make sure we don't have multiple error dialogs open at the same time,
+ // we will just close the previous one if we are going to show a new one.
+ deviceErrorDialog && deviceErrorDialog.close();
+
+ deviceErrorDialog = messageHandler.openDialog(
titleMsg,
message,
false,
diff --git a/modules/devices/mediaDeviceHelper.js b/modules/devices/mediaDeviceHelper.js
index 8b68ad838c..8043c93546 100644
--- a/modules/devices/mediaDeviceHelper.js
+++ b/modules/devices/mediaDeviceHelper.js
@@ -194,15 +194,17 @@ export default {
return createLocalTracks(
['audio', 'video'], cameraDeviceId, micDeviceId)
// If we fail to do this, try to create them separately.
- .catch(() => Promise.all(
- [createAudioTrack(false), createVideoTrack(false)]))
- .then((audioTracks, videoTracks) => {
+ .catch(() => Promise.all([
+ createAudioTrack(false).then(([stream]) => stream),
+ createVideoTrack(false).then(([stream]) => stream)
+ ]))
+ .then(tracks => {
if (audioTrackError || videoTrackError) {
APP.UI.showDeviceErrorDialog(
audioTrackError, videoTrackError);
}
- return (audioTracks || []).concat(videoTracks || []);
+ return tracks.filter(t => typeof t !== 'undefined');
});
} else if (videoRequested && !audioRequested) {
return createVideoTrack();