fix(remotecontrol): Logging
This commit is contained in:
parent
0efca9a9a8
commit
e693554961
|
@ -1,4 +1,5 @@
|
|||
/* global $, JitsiMeetJS, APP */
|
||||
const logger = require("jitsi-meet-logger").getLogger(__filename);
|
||||
import * as KeyCodes from "../keycode/keycode";
|
||||
import {EVENT_TYPES, REMOTE_CONTROL_EVENT_TYPE, PERMISSIONS_ACTIONS}
|
||||
from "../../service/remotecontrol/Constants";
|
||||
|
@ -76,6 +77,7 @@ export default class Controller extends RemoteControlParticipant {
|
|||
if(!this.enabled) {
|
||||
return Promise.reject(new Error("Remote control is disabled!"));
|
||||
}
|
||||
logger.debug("Requsting remote control permissions from: " + userId);
|
||||
return new Promise((resolve, reject) => {
|
||||
const clearRequest = () => {
|
||||
this.requestedParticipant = null;
|
||||
|
@ -135,6 +137,8 @@ export default class Controller extends RemoteControlParticipant {
|
|||
switch(remoteControlEvent.action) {
|
||||
case PERMISSIONS_ACTIONS.grant: {
|
||||
this.controlledParticipant = userId;
|
||||
logger.debug("Remote control permissions granted to: "
|
||||
+ userId);
|
||||
this._start();
|
||||
return true;
|
||||
}
|
||||
|
@ -170,6 +174,7 @@ export default class Controller extends RemoteControlParticipant {
|
|||
* listeners. Disables keyboard events.
|
||||
*/
|
||||
_start() {
|
||||
logger.log("Starting remote control controller.");
|
||||
APP.UI.addListener(UIEvents.LARGE_VIDEO_ID_CHANGED,
|
||||
this._largeVideoChangedListener);
|
||||
APP.conference.addConferenceListener(
|
||||
|
@ -191,6 +196,7 @@ export default class Controller extends RemoteControlParticipant {
|
|||
if(!this.enabled || this.isCollectingEvents) {
|
||||
return;
|
||||
}
|
||||
logger.log("Resuming remote control controller.");
|
||||
this.isCollectingEvents = true;
|
||||
APP.keyboardshortcut.enable(false);
|
||||
this.area = $("#largeVideoWrapper");
|
||||
|
@ -230,6 +236,7 @@ export default class Controller extends RemoteControlParticipant {
|
|||
if(!this.controlledParticipant) {
|
||||
return;
|
||||
}
|
||||
logger.log("Stopping remote control controller.");
|
||||
APP.UI.removeListener(UIEvents.LARGE_VIDEO_ID_CHANGED,
|
||||
this._largeVideoChangedListener);
|
||||
APP.conference.removeConferenceListener(
|
||||
|
@ -276,6 +283,7 @@ export default class Controller extends RemoteControlParticipant {
|
|||
if(!this.controlledParticipant) {
|
||||
return;
|
||||
}
|
||||
logger.log("Pausing remote control controller.");
|
||||
this.isCollectingEvents = false;
|
||||
APP.keyboardshortcut.enable(true);
|
||||
this.area.off( "mousemove" );
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* global APP, JitsiMeetJS, interfaceConfig */
|
||||
const logger = require("jitsi-meet-logger").getLogger(__filename);
|
||||
import {DISCO_REMOTE_CONTROL_FEATURE, REMOTE_CONTROL_EVENT_TYPE, EVENT_TYPES,
|
||||
PERMISSIONS_ACTIONS} from "../../service/remotecontrol/Constants";
|
||||
import RemoteControlParticipant from "./RemoteControlParticipant";
|
||||
|
@ -33,12 +34,14 @@ export default class Receiver extends RemoteControlParticipant {
|
|||
this.enabled = enabled;
|
||||
}
|
||||
if(enabled === true) {
|
||||
logger.log("Remote control receiver enabled.");
|
||||
// Announce remote control support.
|
||||
APP.connection.addFeature(DISCO_REMOTE_CONTROL_FEATURE, true);
|
||||
APP.conference.addConferenceListener(
|
||||
ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
|
||||
this._remoteControlEventsListener);
|
||||
} else {
|
||||
logger.log("Remote control receiver disabled.");
|
||||
this._stop(true);
|
||||
APP.connection.removeFeature(DISCO_REMOTE_CONTROL_FEATURE);
|
||||
APP.conference.removeConferenceListener(
|
||||
|
@ -58,6 +61,7 @@ export default class Receiver extends RemoteControlParticipant {
|
|||
if(!this.controller) {
|
||||
return;
|
||||
}
|
||||
logger.log("Remote control receiver stop.");
|
||||
this.controller = null;
|
||||
APP.conference.removeConferenceListener(ConferenceEvents.USER_LEFT,
|
||||
this._userLeftListener);
|
||||
|
@ -114,6 +118,9 @@ export default class Receiver extends RemoteControlParticipant {
|
|||
return;
|
||||
}
|
||||
APP.API.sendRemoteControlEvent(remoteControlEvent);
|
||||
} else if(event.type === REMOTE_CONTROL_EVENT_TYPE) {
|
||||
logger.debug("Remote control event is ignored because remote "
|
||||
+ "control is disabled", event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,6 +135,7 @@ export default class Receiver extends RemoteControlParticipant {
|
|||
APP.conference.addConferenceListener(ConferenceEvents.USER_LEFT,
|
||||
this._userLeftListener);
|
||||
this.controller = userId;
|
||||
logger.debug("Remote control permissions granted to: " + userId);
|
||||
if(!APP.conference.isSharingScreen) {
|
||||
APP.conference.toggleScreenSharing();
|
||||
APP.conference.screenSharingPromise.then(() => {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* global APP, config */
|
||||
const logger = require("jitsi-meet-logger").getLogger(__filename);
|
||||
import Controller from "./Controller";
|
||||
import Receiver from "./Receiver";
|
||||
import {EVENT_TYPES, DISCO_REMOTE_CONTROL_FEATURE}
|
||||
|
@ -28,6 +29,7 @@ class RemoteControl {
|
|||
|| !APP.conference.isDesktopSharingEnabled) {
|
||||
return;
|
||||
}
|
||||
logger.log("Initializing remote control.");
|
||||
this.initialized = true;
|
||||
APP.API.init({
|
||||
forceEnable: true,
|
||||
|
@ -67,11 +69,14 @@ class RemoteControl {
|
|||
* the wrapper application.
|
||||
*/
|
||||
_onRemoteControlSupported() {
|
||||
logger.log("Remote Control supported.");
|
||||
if(!config.disableRemoteControl) {
|
||||
this.enabled = true;
|
||||
if(this.initialized) {
|
||||
this.receiver.enable(true);
|
||||
}
|
||||
} else {
|
||||
logger.log("Remote Control disabled.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* global APP */
|
||||
const logger = require("jitsi-meet-logger").getLogger(__filename);
|
||||
import {REMOTE_CONTROL_EVENT_TYPE}
|
||||
from "../../service/remotecontrol/Constants";
|
||||
|
||||
|
@ -24,12 +25,17 @@ export default class RemoteControlParticipant {
|
|||
* @param {Function} onDataChannelFail handler for data channel failure.
|
||||
*/
|
||||
_sendRemoteControlEvent(to, event, onDataChannelFail = () => {}) {
|
||||
if(!this.enabled || !to)
|
||||
if(!this.enabled || !to) {
|
||||
logger.warn("Remote control: Skip sending remote control event."
|
||||
+ " Params:", this.enable, to);
|
||||
return;
|
||||
}
|
||||
try{
|
||||
APP.conference.sendEndpointMessage(to,
|
||||
{type: REMOTE_CONTROL_EVENT_TYPE, event});
|
||||
} catch (e) {
|
||||
logger.error("Failed to send EndpointMessage via the datachannels",
|
||||
e);
|
||||
onDataChannelFail(e);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue