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

RemoteControl.js 1.7KB

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