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.

Receiver.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* global APP, JitsiMeetJS */
  2. const ConferenceEvents = JitsiMeetJS.events.conference;
  3. /**
  4. * This class represents the receiver party for a remote controller session.
  5. * It handles "remote-control-event" events and sends them to the
  6. * API module. From there the events can be received from wrapper application
  7. * and executed.
  8. */
  9. class Receiver {
  10. /**
  11. * Creates new instance.
  12. * @constructor
  13. */
  14. constructor() {}
  15. /**
  16. * Attaches listener for ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED events.
  17. */
  18. start() {
  19. APP.conference.addConferenceListener(
  20. ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
  21. this._onRemoteControlEvent);
  22. }
  23. /**
  24. * Removes the listener for ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED
  25. * events.
  26. */
  27. stop() {
  28. APP.conference.removeConferenceListener(
  29. ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
  30. this._onRemoteControlEvent);
  31. }
  32. /**
  33. * Sends "remote-control-event" events to to the API module.
  34. * @param {JitsiParticipant} participant the controller participant
  35. * @param {Object} event the remote control event.
  36. */
  37. _onRemoteControlEvent(participant, event) {
  38. if(event.type === "remote-control-event")
  39. APP.API.sendRemoteControlEvent(event.event);
  40. }
  41. }
  42. export default new Receiver();