diff --git a/conference.js b/conference.js index 4fd5ba3da..8bace5891 100644 --- a/conference.js +++ b/conference.js @@ -543,11 +543,11 @@ export default { // if user didn't give access to mic or camera or doesn't have // them at all, we disable corresponding toolbar buttons if (!tracks.find((t) => t.isAudioTrack())) { - APP.UI.disableMicrophoneButton(true); + APP.UI.setMicrophoneButtonEnabled(false); } if (!tracks.find((t) => t.isVideoTrack())) { - APP.UI.disableCameraButton(true); + APP.UI.setCameraButtonEnabled(false); } this._initDeviceList(); @@ -931,7 +931,7 @@ export default { APP.UI.addLocalStream(stream); stream.videoType === 'camera' - && APP.UI.disableCameraButton(false); + && APP.UI.setCameraButtonEnabled(true); } else { this.videoMuted = false; this.isSharingScreen = false; @@ -971,7 +971,7 @@ export default { this.audioMuted = false; } - APP.UI.disableMicrophoneButton(false); + APP.UI.setMicrophoneButtonEnabled(true); APP.UI.setAudioMuted(this.getMyUserId(), this.audioMuted); }); }, diff --git a/modules/UI/UI.js b/modules/UI/UI.js index 701ed256b..8cc5aa5f8 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -1459,23 +1459,23 @@ UI.onSharedVideoStop = function (id, attributes) { }; /** - * Disables camera toolbar button. + * Enables / disables camera toolbar button. * - * @param {boolean} disable indicates if the camera button should be disabled - * or enabled + * @param {boolean} enabled indicates if the camera button should be enabled + * or disabled */ -UI.disableCameraButton = function (disable) { - Toolbar.disableVideoIcon(disable); +UI.setCameraButtonEnabled = function (enabled) { + Toolbar.setVideoIconEnabled(enabled); }; /** - * Disables microphone toolbar button. + * Enables / disables microphone toolbar button. * - * @param {boolean} disable indicates if the microphone button should be - * disabled or enabled + * @param {boolean} enabled indicates if the microphone button should be + * enabled or disabled */ -UI.disableMicrophoneButton = function (disable) { - Toolbar.disableAudioIcon(disable); +UI.setMicrophoneButtonEnabled = function (enabled) { + Toolbar.setAudioIconEnabled(enabled); }; UI.showRingOverLay = function () { diff --git a/modules/UI/recording/Recording.js b/modules/UI/recording/Recording.js index 602f2d325..c0fd74494 100644 --- a/modules/UI/recording/Recording.js +++ b/modules/UI/recording/Recording.js @@ -518,7 +518,7 @@ var Recording = { * or not */ _setToolbarButtonToggled(isToggled) { - ("#toolbar_button_record").toggleClass("toggled", isToggled); + $("#toolbar_button_record").toggleClass("toggled", isToggled); } }; diff --git a/modules/UI/toolbars/Toolbar.js b/modules/UI/toolbars/Toolbar.js index 17368f101..1ba7d5a08 100644 --- a/modules/UI/toolbars/Toolbar.js +++ b/modules/UI/toolbars/Toolbar.js @@ -598,26 +598,28 @@ const Toolbar = { }, /** - * Marks video icon as disabled or not. - * @param {boolean} disabled if icon should look like disabled or not + * Enables / disables audio toolbar button. + * + * @param {boolean} enabled indicates if the button should be enabled + * or disabled */ - disableVideoIcon (disabled) { + setVideoIconEnabled (enabled) { var $btn = $('#toolbar_button_camera'); $btn - .prop("disabled", disabled) - .attr("data-i18n", disabled - ? "[content]toolbar.cameraDisabled" - : "[content]toolbar.videomute") - .attr("shortcut", disabled ? "" : "toggleVideoPopover"); + .prop("disabled", !enabled) + .attr("data-i18n", enabled + ? "[content]toolbar.videomute" + : "[content]toolbar.cameraDisabled") + .attr("shortcut", enabled ? "toggleVideoPopover" : ""); - disabled - ? $btn.attr("disabled", "disabled") - : $btn.removeAttr("disabled"); + enabled + ? $btn.removeAttr("disabled") + : $btn.attr("disabled", "disabled"); APP.translation.translateElement($btn); - disabled && this.toggleVideoIcon(disabled); + !enabled && this.toggleVideoIcon(!enabled); }, /** @@ -633,26 +635,28 @@ const Toolbar = { }, /** - * Marks audio icon as disabled or not. - * @param {boolean} disabled if icon should look like disabled or not + * Enables / disables audio toolbar button. + * + * @param {boolean} enabled indicates if the button should be enabled + * or disabled */ - disableAudioIcon (disabled) { + setAudioIconEnabled (enabled) { var $btn = $('#toolbar_button_mute'); $btn - .prop("disabled", disabled) - .attr("data-i18n", disabled - ? "[content]toolbar.micDisabled" - : "[content]toolbar.mute") - .attr("shortcut", disabled ? "" : "mutePopover"); + .prop("disabled", !enabled) + .attr("data-i18n", enabled + ? "[content]toolbar.mute" + : "[content]toolbar.micDisabled") + .attr("shortcut", enabled ? "mutePopover" : ""); - disabled - ? $btn.attr("disabled", "disabled") - : $btn.removeAttr("disabled"); + enabled + ? $btn.removeAttr("disabled") + : $btn.attr("disabled", "disabled"); APP.translation.translateElement($btn); - disabled && this.toggleAudioIcon(disabled); + !enabled && this.toggleAudioIcon(!enabled); }, /** @@ -823,7 +827,7 @@ const Toolbar = { * @param elementId the element identifier * @param isToggled indicates if the element should be toggled or untoggled */ - _setToggledState(elementId, isToggled) { + _setToggledState(elementId, isToggled) { $("#" + elementId).toggleClass("toggled", isToggled); } }; diff --git a/modules/devices/mediaDeviceHelper.js b/modules/devices/mediaDeviceHelper.js index 671c5ec10..77efeaae6 100644 --- a/modules/devices/mediaDeviceHelper.js +++ b/modules/devices/mediaDeviceHelper.js @@ -58,7 +58,7 @@ function getNewAudioInputDevice(newDevices, localAudio) { // Otherwise we assume that we don't have any audio input devices // to use and that's why disable microphone button on UI. else { - APP.UI.disableMicrophoneButton(true); + APP.UI.setMicrophoneButtonEnabled(false); } } else { // And here we handle case when we already have some device working, @@ -100,7 +100,7 @@ function getNewVideoInputDevice(newDevices, localVideo) { // Otherwise we assume that we don't have any video input devices // to use and that's why disable microphone button on UI. else { - APP.UI.disableCameraButton(true); + APP.UI.setCameraButtonEnabled(false); } } else { // And here we handle case when we already have some device working,