Merge pull request #697 from tsareg/fix_two_gum_error_dialogs
Fixing various edge-cases when two gUM error dialogs might be shown and other possible bugs
This commit is contained in:
commit
1f942aa13d
|
@ -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,
|
||||
|
@ -1283,6 +1289,12 @@ UI.showDeviceErrorDialog = function (micError, cameraError) {
|
|||
input.prop("checked");
|
||||
}
|
||||
}
|
||||
},
|
||||
null,
|
||||
function () {
|
||||
// Reset dialog reference to null to avoid memory leaks when
|
||||
// user closed the dialog manually.
|
||||
deviceErrorDialog = null;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -113,9 +113,10 @@ var messageHandler = {
|
|||
* @param submitFunction function to be called on submit
|
||||
* @param loadedFunction function to be called after the prompt is fully
|
||||
* loaded
|
||||
* @param closeFunction function to be called on dialog close
|
||||
*/
|
||||
openDialog: function (titleString, msgString, persistent, buttons,
|
||||
submitFunction, loadedFunction) {
|
||||
submitFunction, loadedFunction, closeFunction) {
|
||||
if (!popupEnabled)
|
||||
return;
|
||||
|
||||
|
@ -125,11 +126,14 @@ var messageHandler = {
|
|||
buttons: buttons,
|
||||
defaultButton: 1,
|
||||
loaded: loadedFunction,
|
||||
submit: submitFunction
|
||||
submit: submitFunction,
|
||||
close: closeFunction
|
||||
};
|
||||
|
||||
if (persistent) {
|
||||
args.closeText = '';
|
||||
}
|
||||
|
||||
return new Impromptu(msgString, args);
|
||||
},
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue