Skip to content

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

fix(remotecontrol): Disable the keyboard shortcuts during remote control

hristoterezov5d269ad0aadb
diff --git a/modules/keyboardshortcut/keyboardshortcut.js b/modules/keyboardshortcut/keyboardshortcut.js
index 53497347a2..1eac7b6bf5 100644
--- a/modules/keyboardshortcut/keyboardshortcut.js
+++ b/modules/keyboardshortcut/keyboardshortcut.js
@@ -65,6 +65,12 @@ function showKeyboardShortcutsPanel(show) {
*/
let _shortcuts = {};
+/**
+ * True if the keyboard shortcuts are enabled and false if not.
+ * @type {boolean}
+ */
+let enabled = true;
+
/**
* Maps keycode to character, id of popover for given function and function.
*/
@@ -74,6 +80,9 @@ var KeyboardShortcut = {
var self = this;
window.onkeyup = function(e) {
+ if(!enabled) {
+ return;
+ }
var key = self._getKeyboardKey(e).toUpperCase();
var num = parseInt(key, 10);
if(!($(":focus").is("input[type=text]") ||
@@ -93,6 +102,9 @@ var KeyboardShortcut = {
};
window.onkeydown = function(e) {
+ if(!enabled) {
+ return;
+ }
if(!($(":focus").is("input[type=text]") ||
$(":focus").is("input[type=password]") ||
$(":focus").is("textarea"))) {
@@ -105,6 +117,14 @@ var KeyboardShortcut = {
};
},
+ /**
+ * Enables/Disables the keyboard shortcuts.
+ * @param {boolean} value - the new value.
+ */
+ enable: function (value) {
+ enabled = value;
+ },
+
/**
* Registers a new shortcut.
*
diff --git a/modules/remotecontrol/Controller.js b/modules/remotecontrol/Controller.js
index e10356a019..72f478976d 100644
--- a/modules/remotecontrol/Controller.js
+++ b/modules/remotecontrol/Controller.js
@@ -167,6 +167,7 @@ export default class Controller extends RemoteControlParticipant {
_start() {
if(!this.enabled)
return;
+ APP.keyboardshortcut.enable(false);
APP.conference.addConferenceListener(
ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
this._stopListener);
@@ -207,6 +208,7 @@ export default class Controller extends RemoteControlParticipant {
if(!this.controlledParticipant) {
return;
}
+ APP.keyboardshortcut.enable(true);
APP.conference.removeConferenceListener(
ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
this._stopListener);