您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

RemoteControl.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 || this.initialized
  25. || !APP.conference.isDesktopSharingEnabled) {
  26. return;
  27. }
  28. logger.log("Initializing remote control.");
  29. this.initialized = true;
  30. this.controller.enable(true);
  31. this.receiver = new Receiver();
  32. }
  33. /**
  34. * Checks whether the passed user supports remote control or not
  35. * @param {JitsiParticipant} user the user to be tested
  36. * @returns {Promise<boolean>} the promise will be resolved with true if
  37. * the user supports remote control and with false if not.
  38. */
  39. checkUserRemoteControlSupport(user) {
  40. return user.getFeatures().then(features =>
  41. features.has(DISCO_REMOTE_CONTROL_FEATURE), () => false
  42. );
  43. }
  44. }
  45. export default new RemoteControl();