From 48b219111df37b442eedd4122a639c6143d8553d Mon Sep 17 00:00:00 2001 From: tsareg Date: Wed, 25 May 2016 15:04:48 +0300 Subject: [PATCH 1/4] Use special JitsiTrackError object instead just strings for various types of errors that may happen to JitsiTrack --- conference.js | 7 +++++-- nwjs-integration/index.html | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/conference.js b/conference.js index 858093133..c65e86dca 100644 --- a/conference.js +++ b/conference.js @@ -977,18 +977,21 @@ export default { this.videoSwitchInProgress = false; this.toggleScreenSharing(false); - if(err === TrackErrors.CHROME_EXTENSION_USER_CANCELED) + if (err.name === TrackErrors.CHROME_EXTENSION_USER_CANCELED) { return; + } console.error('failed to share local desktop', err); - if (err === TrackErrors.FIREFOX_EXTENSION_NEEDED) { + if (err.name === TrackErrors.FIREFOX_EXTENSION_NEEDED) { APP.UI.showExtensionRequiredDialog( config.desktopSharingFirefoxExtensionURL ); return; } + // TODO: handle Permission error + // Handling: // TrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR // TrackErrors.GENERAL diff --git a/nwjs-integration/index.html b/nwjs-integration/index.html index f345d0e4c..fce912d88 100644 --- a/nwjs-integration/index.html +++ b/nwjs-integration/index.html @@ -36,7 +36,10 @@ }; navigator.webkitGetUserMedia({ audio: false, video: vid_constraint - }, callback, errorCallback); + }, callback, function (error) { + errorCallback && + errorCallback(error, vid_constraint); + }); } ); } From 448fcf36b6c9351b8176f58aede21fa7ed6dba06 Mon Sep 17 00:00:00 2001 From: tsareg Date: Thu, 26 May 2016 11:53:02 +0300 Subject: [PATCH 2/4] Show dialog for GUM errors --- conference.js | 111 +++++++++++++----- lang/main.json | 14 ++- modules/UI/UI.js | 95 ++++++++++++++- .../UI/side_pannels/settings/SettingsMenu.js | 22 ++++ 4 files changed, 211 insertions(+), 31 deletions(-) diff --git a/conference.js b/conference.js index c65e86dca..c2de11ff3 100644 --- a/conference.js +++ b/conference.js @@ -375,17 +375,39 @@ export default { }; } + let audioAndVideoError, audioOnlyError; + return JitsiMeetJS.init(config).then(() => { return Promise.all([ // try to retrieve audio and video createLocalTracks(['audio', 'video']) // if failed then try to retrieve only audio - .catch(() => createLocalTracks(['audio'])) + .catch(err => { + audioAndVideoError = err; + return createLocalTracks(['audio']); + }) // if audio also failed then just return empty array - .catch(() => []), + .catch(err => { + audioOnlyError = err; + return []; + }), connect(options.roomName) ]); }).then(([tracks, con]) => { + if (audioAndVideoError) { + if (audioOnlyError) { + // If both requests for 'audio' + 'video' and 'audio' only + // failed, we assume that there is some problems with user's + // microphone and show corresponding dialog. + APP.UI.showDeviceErrorDialog('microphone', audioOnlyError); + } else { + // If request for 'audio' + 'video' failed, but request for + // 'audio' only was OK, we assume that we had problems with + // camera and show corresponding dialog. + APP.UI.showDeviceErrorDialog('camera', audioAndVideoError); + } + } + console.log('initialized with %s local tracks', tracks.length); APP.connection = connection = con; this._createRoom(tracks); @@ -541,9 +563,11 @@ export default { } function createNewTracks(type, cameraDeviceId, micDeviceId) { + let audioOnlyError, videoOnlyError; + return createLocalTracks(type, cameraDeviceId, micDeviceId) .then(onTracksCreated) - .catch(() => { + .catch((err) => { // if we tried to create both audio and video tracks // at once and failed, let's try again only with // audio. Such situation may happen in case if we @@ -553,16 +577,21 @@ export default { && type.indexOf('video') !== -1) { return createLocalTracks(['audio'], null, micDeviceId); + } else if (type.indexOf('audio') !== -1) { + audioOnlyError = err; + } else if (type.indexOf('video') !== -1) { + videoOnlyError = err; } }) .then(onTracksCreated) - .catch(() => { + .catch((err) => { // if we tried to create both audio and video tracks // at once and failed, let's try again only with // video. Such situation may happen in case if we // granted access only to camera, but not to // microphone. + audioOnlyError = err; if (type.indexOf('audio') !== -1 && type.indexOf('video') !== -1) { return createLocalTracks(['video'], @@ -571,8 +600,18 @@ export default { } }) .then(onTracksCreated) - .catch(() => { - // can't do anything in this case, so just ignore; + .catch((err) => { + videoOnlyError = err; + + if (videoOnlyError) { + APP.UI.showDeviceErrorDialog( + 'camera', videoOnlyError); + } + + if (audioOnlyError) { + APP.UI.showDeviceErrorDialog( + 'microphone', audioOnlyError); + } }); } @@ -896,13 +935,13 @@ export default { this.isSharingScreen = stream.videoType === 'desktop'; APP.UI.addLocalStream(stream); + + stream.videoType === 'camera' && APP.UI.enableCameraButton(); } else { this.videoMuted = false; this.isSharingScreen = false; } - stream.videoType === 'camera' && APP.UI.enableCameraButton(); - APP.UI.setVideoMuted(this.localId, this.videoMuted); APP.UI.updateDesktopSharingButtons(); @@ -990,21 +1029,22 @@ export default { return; } - // TODO: handle Permission error - // Handling: + // TrackErrors.PERMISSION_DENIED // TrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR // TrackErrors.GENERAL // and any other - let dialogTxt = APP.translation - .generateTranslationHTML("dialog.failtoinstall"); - let dialogTitle = APP.translation - .generateTranslationHTML("dialog.error"); - APP.UI.messageHandler.openDialog( - dialogTitle, - dialogTxt, - false - ); + let dialogTxt = APP.translation.generateTranslationHTML( + err.name === TrackErrors.PERMISSION_DENIED + ? "dialog.screenSharingPermissionDeniedError" + : "dialog.failtoinstall"); + + let dialogTitle = APP.translation.generateTranslationHTML( + err.name === TrackErrors.PERMISSION_DENIED + ? "dialog.permissionDenied" + : "dialog.error"); + + APP.UI.messageHandler.openDialog(dialogTitle, dialogTxt, false); }); } else { createLocalTracks(['video']).then( @@ -1016,6 +1056,8 @@ export default { this.useVideoStream(null); this.videoSwitchInProgress = false; console.error('failed to share local video', err); + + APP.UI.showDeviceErrorDialog('camera', err); }); } }, @@ -1357,22 +1399,32 @@ export default { APP.UI.addListener( UIEvents.VIDEO_DEVICE_CHANGED, (cameraDeviceId) => { - APP.settings.setCameraDeviceId(cameraDeviceId); - createLocalTracks(['video']).then(([stream]) => { - this.useVideoStream(stream); - console.log('switched local video device'); - }); + createLocalTracks(['video']) + .then(([stream]) => { + this.useVideoStream(stream); + console.log('switched local video device'); + APP.settings.setCameraDeviceId(cameraDeviceId); + }) + .catch((err) => { + APP.UI.showDeviceErrorDialog('camera', err); + APP.UI.setSelectedCameraFromSettings(); + }); } ); APP.UI.addListener( UIEvents.AUDIO_DEVICE_CHANGED, (micDeviceId) => { - APP.settings.setMicDeviceId(micDeviceId); - createLocalTracks(['audio']).then(([stream]) => { - this.useAudioStream(stream); - console.log('switched local audio device'); - }); + createLocalTracks(['audio']) + .then(([stream]) => { + this.useAudioStream(stream); + console.log('switched local audio device'); + APP.settings.setMicDeviceId(micDeviceId); + }) + .catch((err) => { + APP.UI.showDeviceErrorDialog('microphone', err); + APP.UI.setSelectedMicFromSettings(); + }); } ); @@ -1383,6 +1435,7 @@ export default { .then(() => console.log('changed audio output device')) .catch((err) => { console.error('failed to set audio output device', err); + APP.UI.setSelectedAudioOutputFromSettings(); }); } ); diff --git a/lang/main.json b/lang/main.json index 62539cad0..0007c544f 100644 --- a/lang/main.json +++ b/lang/main.json @@ -222,7 +222,19 @@ "stopStreamingWarning": "Are you sure you would like to stop the live streaming?", "stopRecordingWarning": "Are you sure you would like to stop the recording?", "stopLiveStreaming": "Stop live streaming", - "stopRecording": "Stop recording" + "stopRecording": "Stop recording", + "doNotShowWarningAgain": "Don't show this warning again", + "permissionDenied": "Permission Denied", + "screenSharingPermissionDeniedError": "You have not granted permission to share your screen.", + "cameraUnsupportedResolutionError": "Your camera does not support required video resolution.", + "cameraUnknownError": "Cannot use camera for a unknown reason.", + "cameraPermissionDeniedError": "You have not granted permission to use your camera.", + "cameraNotFoundError": "Requested camera was not found.", + "cameraConstraintFailedError": "Yor camera does not satisfy some of required constraints.", + "micUnknownError": "Cannot use microphone for a unknown reason.", + "micPermissionDeniedError": "You have not granted permission to use your microphone.", + "micNotFoundError": "Requested microphone was not found.", + "micConstraintFailedError": "Yor microphone does not satisfy some of required constraints." }, "email": { diff --git a/modules/UI/UI.js b/modules/UI/UI.js index 612f407c8..89e1589d0 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -1,4 +1,4 @@ -/* global APP, $, config, interfaceConfig, toastr */ +/* global APP, JitsiMeetJS, $, config, interfaceConfig, toastr */ /* jshint -W101 */ var UI = {}; @@ -38,6 +38,32 @@ let sharedVideoManager; let followMeHandler; +const TrackErrors = JitsiMeetJS.errors.track; + +const JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP = { + microphone: {}, + camera: {} +}; + +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.UNSUPPORTED_RESOLUTION] + = "dialog.cameraUnsupportedResolutionError"; +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.GENERAL] + = "dialog.cameraUnknownError"; +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.PERMISSION_DENIED] + = "dialog.cameraPermissionDeniedError"; +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.NOT_FOUND] + = "dialog.cameraNotFoundError"; +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.CONSTRAINT_FAILED] + = "dialog.cameraConstraintFailedError"; +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.GENERAL] + = "dialog.micUnknownError"; +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.PERMISSION_DENIED] + = "dialog.micPermissionDeniedError"; +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.NOT_FOUND] + = "dialog.micNotFoundError"; +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.CONSTRAINT_FAILED] + = "dialog.micConstraintFailedError"; + /** * Prompt user for nickname. */ @@ -1078,6 +1104,28 @@ UI.onAvailableDevicesChanged = function (devices) { SettingsMenu.changeDevicesList(devices); }; +/** + * Sets microphone's element to select camera ID from settings. + */ +UI.setSelectedCameraFromSettings = function () { + SettingsMenu.setSelectedCameraFromSettings(); +}; + +/** + * Sets audio outputs's + + `; + + messageHandler.openDialog( + title, + message, + false, + {Ok: true}, + function () { + let form = $.prompt.getPrompt(), + input = form.find("#doNotShowWarningAgain"); + + window.localStorage[type + "DoNotShowErrorAgain-" + error.name] + = input.prop("checked"); + } + ); + + APP.translation.translateElement($(".jqibox")); +}; + UI.updateDevicesAvailability = function (id, devices) { VideoLayout.setDeviceAvailabilityIcons(id, devices); }; diff --git a/modules/UI/side_pannels/settings/SettingsMenu.js b/modules/UI/side_pannels/settings/SettingsMenu.js index bee62594f..58c78b3e3 100644 --- a/modules/UI/side_pannels/settings/SettingsMenu.js +++ b/modules/UI/side_pannels/settings/SettingsMenu.js @@ -203,6 +203,28 @@ export default { $('#avatar').attr('src', avatarUrl); }, + /** + * Sets microphone's element to select camera ID from settings. + */ + setSelectedCameraFromSettings () { + $('#selectCamera').val(Settings.getCameraDeviceId()); + }, + + /** + * Sets audio outputs's - - `; + message = "

" + + (!JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP[type][error.name] + && error.message + ? "
" + error.message + "
" + : "") + + ""; messageHandler.openDialog( title, @@ -1188,11 +1194,16 @@ UI.showDeviceErrorDialog = function (type, error) { false, {Ok: true}, function () { - let form = $.prompt.getPrompt(), - input = form.find("#doNotShowWarningAgain"); + let form = $.prompt.getPrompt(); - window.localStorage[type + "DoNotShowErrorAgain-" + error.name] - = input.prop("checked"); + if (form) { + let input = form.find("#doNotShowWarningAgain"); + + if (input.length) { + window.localStorage[type + "DoNotShowErrorAgain-" + + error.name] = input.prop("checked"); + } + } } ); From f574dbe056c2241ca1ced7a2e3b2a698cfbaaf94 Mon Sep 17 00:00:00 2001 From: tsareg Date: Fri, 27 May 2016 18:49:26 +0300 Subject: [PATCH 4/4] Changes after code review --- conference.js | 143 ++++++++++++++++++++++++++++------------------- lang/main.json | 2 + modules/UI/UI.js | 129 ++++++++++++++++++++++++++++++++---------- 3 files changed, 186 insertions(+), 88 deletions(-) diff --git a/conference.js b/conference.js index 09d33d011..95de0ae20 100644 --- a/conference.js +++ b/conference.js @@ -399,12 +399,12 @@ export default { // If both requests for 'audio' + 'video' and 'audio' only // failed, we assume that there is some problems with user's // microphone and show corresponding dialog. - APP.UI.showDeviceErrorDialog('microphone', audioOnlyError); + APP.UI.showDeviceErrorDialog(audioOnlyError, null); } else { // If request for 'audio' + 'video' failed, but request for // 'audio' only was OK, we assume that we had problems with // camera and show corresponding dialog. - APP.UI.showDeviceErrorDialog('camera', audioAndVideoError); + APP.UI.showDeviceErrorDialog(null, audioAndVideoError); } } @@ -563,56 +563,78 @@ export default { } function createNewTracks(type, cameraDeviceId, micDeviceId) { - let audioOnlyError, videoOnlyError; + let audioTrackCreationError; + let videoTrackCreationError; + let audioRequested = type.indexOf('audio') !== -1; + let videoRequested = type.indexOf('video') !== -1; + let promise; - return createLocalTracks(type, cameraDeviceId, micDeviceId) - .then(onTracksCreated) - .catch((err) => { - // if we tried to create both audio and video tracks - // at once and failed, let's try again only with - // audio. Such situation may happen in case if we - // granted access only to microphone, but not to - // camera. - if (type.indexOf('audio') !== -1 - && type.indexOf('video') !== -1) { - return createLocalTracks(['audio'], null, - micDeviceId); - } else if (type.indexOf('audio') !== -1) { - audioOnlyError = err; - } else if (type.indexOf('video') !== -1) { - videoOnlyError = err; - } + if (audioRequested && micDeviceId !== null) { + if (videoRequested && cameraDeviceId !== null) { + promise = createLocalTracks( + type, cameraDeviceId, micDeviceId) + .catch(() => { + return Promise.all([ + createAudioTrack(false), + createVideoTrack(false)]); + }) + .then((audioTracks, videoTracks) => { + if (audioTrackCreationError) { + if (videoTrackCreationError) { + APP.UI.showDeviceErrorDialog( + audioTrackCreationError, + videoTrackCreationError); + } else { + APP.UI.showDeviceErrorDialog( + audioTrackCreationError, + null); + } + } else if (videoTrackCreationError) { + APP.UI.showDeviceErrorDialog( + null, + videoTrackCreationError); + } - }) - .then(onTracksCreated) - .catch((err) => { - // if we tried to create both audio and video tracks - // at once and failed, let's try again only with - // video. Such situation may happen in case if we - // granted access only to camera, but not to - // microphone. - audioOnlyError = err; - if (type.indexOf('audio') !== -1 - && type.indexOf('video') !== -1) { - return createLocalTracks(['video'], - cameraDeviceId, - null); - } - }) - .then(onTracksCreated) - .catch((err) => { - videoOnlyError = err; + return audioTracks.concat(videoTracks); + }); + } else { + promise = createAudioTrack(); + } + } else if (videoRequested && cameraDeviceId !== null) { + promise = createVideoTrack(); + } else { + promise = Promise.resolve([]); + } - if (videoOnlyError) { - APP.UI.showDeviceErrorDialog( - 'camera', videoOnlyError); - } + return promise + .then(onTracksCreated); - if (audioOnlyError) { - APP.UI.showDeviceErrorDialog( - 'microphone', audioOnlyError); - } - }); + function createAudioTrack(showError) { + return createLocalTracks(['audio'], null, micDeviceId) + .catch(err => { + audioTrackCreationError = err; + + if (showError) { + APP.UI.showDeviceErrorDialog(err, null); + } + + return []; + }); + } + + function createVideoTrack(showError) { + return createLocalTracks( + ['video'], cameraDeviceId, null) + .catch(err => { + videoTrackCreationError = err; + + if (showError) { + APP.UI.showDeviceErrorDialog(null, err); + } + + return []; + }); + } } function onTracksCreated(tracks) { @@ -1034,15 +1056,20 @@ export default { // TrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR // TrackErrors.GENERAL // and any other - let dialogTxt = APP.translation.generateTranslationHTML( - err.name === TrackErrors.PERMISSION_DENIED - ? "dialog.screenSharingPermissionDeniedError" - : "dialog.failtoinstall"); + let dialogTxt; + let dialogTitle; - let dialogTitle = APP.translation.generateTranslationHTML( - err.name === TrackErrors.PERMISSION_DENIED - ? "dialog.permissionDenied" - : "dialog.error"); + if (err.name === TrackErrors.PERMISSION_DENIED) { + dialogTxt = APP.translation.generateTranslationHTML( + "dialog.screenSharingPermissionDeniedError"); + dialogTitle = APP.translation.generateTranslationHTML( + "dialog.error"); + } else { + dialogTxt = APP.translation.generateTranslationHTML( + "dialog.failtoinstall"); + dialogTitle = APP.translation.generateTranslationHTML( + "dialog.permissionDenied"); + } APP.UI.messageHandler.openDialog(dialogTitle, dialogTxt, false); }); @@ -1404,7 +1431,7 @@ export default { APP.settings.setCameraDeviceId(cameraDeviceId); }) .catch((err) => { - APP.UI.showDeviceErrorDialog('camera', err); + APP.UI.showDeviceErrorDialog(null, err); APP.UI.setSelectedCameraFromSettings(); }); } @@ -1420,7 +1447,7 @@ export default { APP.settings.setMicDeviceId(micDeviceId); }) .catch((err) => { - APP.UI.showDeviceErrorDialog('microphone', err); + APP.UI.showDeviceErrorDialog(err, null); APP.UI.setSelectedMicFromSettings(); }); } diff --git a/lang/main.json b/lang/main.json index 0007c544f..2cc4ab304 100644 --- a/lang/main.json +++ b/lang/main.json @@ -226,6 +226,8 @@ "doNotShowWarningAgain": "Don't show this warning again", "permissionDenied": "Permission Denied", "screenSharingPermissionDeniedError": "You have not granted permission to share your screen.", + "micErrorPresent": "There was an error connecting to your microphone.", + "cameraErrorPresent": "There was an error connecting to your camera.", "cameraUnsupportedResolutionError": "Your camera does not support required video resolution.", "cameraUnknownError": "Cannot use camera for a unknown reason.", "cameraPermissionDeniedError": "You have not granted permission to use your camera.", diff --git a/modules/UI/UI.js b/modules/UI/UI.js index 40b12180d..8b50f3041 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -1155,41 +1155,93 @@ UI.showExtensionRequiredDialog = function (url) { }; /** - * Shows dialog with information about camera or microphone error. - * @param {'microphone'|'camera'} type - * @param {JitsiTrackError} error + * Shows dialog with combined information about camera and microphone errors. + * @param {JitsiTrackError} micError + * @param {JitsiTrackError} cameraError */ -UI.showDeviceErrorDialog = function (type, error) { - if (type !== "microphone" && type !== "camera") { - throw new Error("Invalid device type"); +UI.showDeviceErrorDialog = function (micError, cameraError) { + let localStoragePropName = "doNotShowErrorAgain"; + let isMicJitsiTrackErrorAndHasName = micError && micError.name && + micError instanceof JitsiMeetJS.JitsiTrackError; + let isCameraJitsiTrackErrorAndHasName = cameraError && cameraError.name && + cameraError instanceof JitsiMeetJS.JitsiTrackError; + let showDoNotShowWarning = false; + + if (micError && cameraError && isMicJitsiTrackErrorAndHasName && + isCameraJitsiTrackErrorAndHasName) { + showDoNotShowWarning = true; + } else if (micError && isMicJitsiTrackErrorAndHasName && !cameraError) { + showDoNotShowWarning = true; + } else if (cameraError && isCameraJitsiTrackErrorAndHasName && !micError) { + showDoNotShowWarning = true; } - if (error.name && error instanceof JitsiMeetJS.JitsiTrackError && - window.localStorage[type + "DoNotShowErrorAgain-" + error.name] - === "true") { - return; + if (micError) { + localStoragePropName += "-mic-" + micError.name; } - let titleKey = error.name === TrackErrors.PERMISSION_DENIED - ? "dialog.permissionDenied" - : "dialog.error", - errorMsg = JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP[type][error.name] || - JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP[type][TrackErrors.GENERAL], - title = ``, - message = "

" + - (!JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP[type][error.name] - && error.message - ? "
" + error.message + "
" - : "") + - ""; + if (cameraError) { + localStoragePropName += "-camera-" + cameraError.name; + } + + if (showDoNotShowWarning) { + if (window.localStorage[localStoragePropName] === "true") { + return; + } + } + + let title = getTitleKey(); + let titleMsg = ``; + let cameraJitsiTrackErrorMsg = cameraError + ? JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[cameraError.name] + : undefined; + let micJitsiTrackErrorMsg = micError + ? JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[micError.name] + : undefined; + let cameraErrorMsg = cameraError + ? cameraJitsiTrackErrorMsg || + JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.GENERAL] + : ""; + let micErrorMsg = micError + ? micJitsiTrackErrorMsg || + JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.GENERAL] + : ""; + let additionalCameraErrorMsg = !cameraJitsiTrackErrorMsg && cameraError && + cameraError.message + ? `
${cameraError.message}
` + : ``; + let additionalMicErrorMsg = !micJitsiTrackErrorMsg && micError && + micError.message + ? `
${micError.message}
` + : ``; + let doNotShowWarningAgainSection = showDoNotShowWarning + ? `` + : ``; + let message = ''; + + if (micError) { + message = ` + ${message} +

+

+ ${additionalMicErrorMsg}`; + } + + if (cameraError) { + message = ` + ${message} +

+

+ ${additionalCameraErrorMsg}`; + } + + message = `${message}${doNotShowWarningAgainSection}`; messageHandler.openDialog( - title, + titleMsg, message, false, {Ok: true}, @@ -1200,14 +1252,31 @@ UI.showDeviceErrorDialog = function (type, error) { let input = form.find("#doNotShowWarningAgain"); if (input.length) { - window.localStorage[type + "DoNotShowErrorAgain-" - + error.name] = input.prop("checked"); + window.localStorage[localStoragePropName] = + input.prop("checked"); } } } ); APP.translation.translateElement($(".jqibox")); + + function getTitleKey() { + let title = "dialog.error"; + + if (micError && micError.name === TrackErrors.PERMISSION_DENIED) { + if (cameraError && cameraError.name === TrackErrors.PERMISSION_DENIED) { + title = "dialog.permissionDenied"; + } else if (!cameraError) { + title = "dialog.permissionDenied"; + } + } else if (cameraError && + cameraError.name === TrackErrors.PERMISSION_DENIED) { + title = "dialog.permissionDenied"; + } + + return title; + } }; UI.updateDevicesAvailability = function (id, devices) {