2016-12-20 22:15:13 +00:00
|
|
|
/* global APP, config */
|
2017-04-17 19:59:24 +00:00
|
|
|
import { DISCO_REMOTE_CONTROL_FEATURE }
|
|
|
|
from '../../service/remotecontrol/Constants';
|
|
|
|
|
|
|
|
import Controller from './Controller';
|
|
|
|
import Receiver from './Receiver';
|
|
|
|
|
|
|
|
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
2016-12-20 22:15:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements the remote control functionality.
|
|
|
|
*/
|
|
|
|
class RemoteControl {
|
|
|
|
/**
|
|
|
|
* Constructs new instance. Creates controller and receiver properties.
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
constructor() {
|
|
|
|
this.controller = new Controller();
|
|
|
|
this.initialized = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the remote control - checks if the remote control should be
|
2017-04-17 19:59:24 +00:00
|
|
|
* enabled or not.
|
2016-12-20 22:15:13 +00:00
|
|
|
*/
|
|
|
|
init() {
|
2017-01-06 01:18:07 +00:00
|
|
|
if(config.disableRemoteControl || this.initialized
|
|
|
|
|| !APP.conference.isDesktopSharingEnabled) {
|
2016-12-20 22:15:13 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-01-19 21:13:05 +00:00
|
|
|
logger.log("Initializing remote control.");
|
2016-12-20 22:15:13 +00:00
|
|
|
this.initialized = true;
|
|
|
|
this.controller.enable(true);
|
2017-04-17 19:59:24 +00:00
|
|
|
this.receiver = new Receiver();
|
2016-12-20 22:15:13 +00:00
|
|
|
}
|
2017-01-06 01:18:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks whether the passed user supports remote control or not
|
|
|
|
* @param {JitsiParticipant} user the user to be tested
|
|
|
|
* @returns {Promise<boolean>} the promise will be resolved with true if
|
|
|
|
* the user supports remote control and with false if not.
|
|
|
|
*/
|
|
|
|
checkUserRemoteControlSupport(user) {
|
|
|
|
return user.getFeatures().then(features =>
|
|
|
|
features.has(DISCO_REMOTE_CONTROL_FEATURE), () => false
|
|
|
|
);
|
|
|
|
}
|
2016-12-20 22:15:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default new RemoteControl();
|