You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RemoteControl.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* global APP, config */
  2. import { DISCO_REMOTE_CONTROL_FEATURE }
  3. from '../../service/remotecontrol/Constants';
  4. import Controller from './Controller';
  5. import Receiver from './Receiver';
  6. const logger = require('jitsi-meet-logger').getLogger(__filename);
  7. /**
  8. * Implements the remote control functionality.
  9. */
  10. class RemoteControl {
  11. /**
  12. * Constructs new instance. Creates controller and receiver properties.
  13. * @constructor
  14. */
  15. constructor() {
  16. this.controller = new Controller();
  17. this.initialized = false;
  18. }
  19. /**
  20. * Initializes the remote control - checks if the remote control should be
  21. * enabled or not.
  22. */
  23. init() {
  24. if(config.disableRemoteControl
  25. || this.initialized
  26. || !APP.conference.isDesktopSharingEnabled) {
  27. return;
  28. }
  29. logger.log("Initializing remote control.");
  30. this.initialized = true;
  31. this.controller.enable(true);
  32. this.receiver = new Receiver();
  33. }
  34. /**
  35. * Checks whether the passed user supports remote control or not
  36. * @param {JitsiParticipant} user the user to be tested
  37. * @returns {Promise<boolean>} the promise will be resolved with true if
  38. * the user supports remote control and with false if not.
  39. */
  40. checkUserRemoteControlSupport(user) {
  41. return user.getFeatures().then(
  42. features => features.has(DISCO_REMOTE_CONTROL_FEATURE),
  43. () => false);
  44. }
  45. }
  46. export default new RemoteControl();