Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat: emit raise hand event to external API (#8312)

Asifcd29f10fa8fa
diff --git a/modules/API/API.js b/modules/API/API.js
index 87c7f6f950..4cdfaddd8b 100644
--- a/modules/API/API.js
+++ b/modules/API/API.js
@@ -1022,6 +1022,21 @@ class API {
});
}
+ /**
+ * Notify external application (if API is enabled) that user updated their hand raised.
+ *
+ * @param {string} id - User id.
+ * @param {boolean} handRaised - Whether user has raised hand.
+ * @returns {void}
+ */
+ notifyRaiseHandUpdated(id: string, handRaised: boolean) {
+ this._sendEvent({
+ name: 'raise-hand-updated',
+ handRaised,
+ id
+ });
+ }
+
/**
* Disposes the allocated resources.
*
diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js
index e6d3296de1..bc0b11133d 100644
--- a/modules/API/external/external_api.js
+++ b/modules/API/external/external_api.js
@@ -79,6 +79,7 @@ const events = {
'participant-role-changed': 'participantRoleChanged',
'password-required': 'passwordRequired',
'proxy-connection-event': 'proxyConnectionEvent',
+ 'raise-hand-updated': 'raiseHandUpdated',
'video-ready-to-close': 'readyToClose',
'video-conference-joined': 'videoConferenceJoined',
'video-conference-left': 'videoConferenceLeft',
diff --git a/react/features/base/participants/middleware.js b/react/features/base/participants/middleware.js
index 376f57c476..55872c41ac 100644
--- a/react/features/base/participants/middleware.js
+++ b/react/features/base/participants/middleware.js
@@ -448,6 +448,10 @@ function _raiseHandUpdated({ dispatch, getState }, conference, participantId, ne
raisedHand
}));
+ if (typeof APP !== 'undefined') {
+ APP.API.notifyRaiseHandUpdated(participantId, raisedHand);
+ }
+
if (raisedHand) {
dispatch(showNotification({
titleArguments: {
diff --git a/react/features/toolbox/components/web/Toolbox.js b/react/features/toolbox/components/web/Toolbox.js
index f8ec7f1f22..3fd18c9cc3 100644
--- a/react/features/toolbox/components/web/Toolbox.js
+++ b/react/features/toolbox/components/web/Toolbox.js
@@ -470,6 +470,7 @@ class Toolbox extends Component<Props, State> {
*/
_doToggleRaiseHand() {
const { _localParticipantID, _raisedHand } = this.props;
+ const newRaisedStatus = !_raisedHand;
this.props.dispatch(participantUpdated({
// XXX Only the local participant is allowed to update without
@@ -480,8 +481,10 @@ class Toolbox extends Component<Props, State> {
id: _localParticipantID,
local: true,
- raisedHand: !_raisedHand
+ raisedHand: newRaisedStatus
}));
+
+ APP.API.notifyRaiseHandUpdated(_localParticipantID, newRaisedStatus);
}
/**