Browse Source

feat(external-api) Forward non participant message to iframe (#13440)

* Forward non-participant-message-received to iFrame API

* Updated comment

* Fix lint errors
factor2
garysmith058 2 years ago
parent
commit
277ca23c52
No account linked to committer's email address
3 changed files with 22 additions and 1 deletions
  1. 4
    1
      conference.js
  2. 17
    0
      modules/API/API.js
  3. 1
    0
      modules/API/external/external_api.js

+ 4
- 1
conference.js View File

2029
 
2029
 
2030
         room.on(
2030
         room.on(
2031
             JitsiConferenceEvents.NON_PARTICIPANT_MESSAGE_RECEIVED,
2031
             JitsiConferenceEvents.NON_PARTICIPANT_MESSAGE_RECEIVED,
2032
-            (...args) => APP.store.dispatch(nonParticipantMessageReceived(...args)));
2032
+            (...args) => {
2033
+                APP.store.dispatch(nonParticipantMessageReceived(...args));
2034
+                APP.API.notifyNonParticipantMessageReceived(...args);
2035
+            });
2033
 
2036
 
2034
         room.on(
2037
         room.on(
2035
             JitsiConferenceEvents.LOCK_STATE_CHANGED,
2038
             JitsiConferenceEvents.LOCK_STATE_CHANGED,

+ 17
- 0
modules/API/API.js View File

2027
         });
2027
         });
2028
     }
2028
     }
2029
 
2029
 
2030
+    /**
2031
+     * Notify external application (if API is enabled) if non participant message
2032
+     * is received.
2033
+     *
2034
+     * @param {string} id - The resource id of the sender.
2035
+     * @param {Object} json - The json carried by the message.
2036
+     * @returns {void}
2037
+     */
2038
+    notifyNonParticipantMessageReceived(id, json) {
2039
+        this._sendEvent({
2040
+            name: 'non-participant-message-received',
2041
+            id,
2042
+            message: json
2043
+        });
2044
+    }
2045
+
2046
+
2030
     /**
2047
     /**
2031
      * Notify the external application (if API is enabled) if the connection type changed.
2048
      * Notify the external application (if API is enabled) if the connection type changed.
2032
      *
2049
      *

+ 1
- 0
modules/API/external/external_api.js View File

128
     'mouse-enter': 'mouseEnter',
128
     'mouse-enter': 'mouseEnter',
129
     'mouse-leave': 'mouseLeave',
129
     'mouse-leave': 'mouseLeave',
130
     'mouse-move': 'mouseMove',
130
     'mouse-move': 'mouseMove',
131
+    'non-participant-message-received': 'nonParticipantMessageReceived',
131
     'notification-triggered': 'notificationTriggered',
132
     'notification-triggered': 'notificationTriggered',
132
     'outgoing-message': 'outgoingMessage',
133
     'outgoing-message': 'outgoingMessage',
133
     'p2p-status-changed': 'p2pStatusChanged',
134
     'p2p-status-changed': 'p2pStatusChanged',

Loading…
Cancel
Save