Преглед на файлове

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

* Expose raise hand event to external application

* Fix linting issues

* fix the app non existing issue
master
Asif преди 4 години
родител
ревизия
cd29f10fa8
No account linked to committer's email address
променени са 4 файла, в които са добавени 24 реда и са изтрити 1 реда
  1. 15
    0
      modules/API/API.js
  2. 1
    0
      modules/API/external/external_api.js
  3. 4
    0
      react/features/base/participants/middleware.js
  4. 4
    1
      react/features/toolbox/components/web/Toolbox.js

+ 15
- 0
modules/API/API.js Целия файл

@@ -1022,6 +1022,21 @@ class API {
1022 1022
         });
1023 1023
     }
1024 1024
 
1025
+    /**
1026
+     * Notify external application (if API is enabled) that user updated their hand raised.
1027
+     *
1028
+     * @param {string} id - User id.
1029
+     * @param {boolean} handRaised - Whether user has raised hand.
1030
+     * @returns {void}
1031
+     */
1032
+    notifyRaiseHandUpdated(id: string, handRaised: boolean) {
1033
+        this._sendEvent({
1034
+            name: 'raise-hand-updated',
1035
+            handRaised,
1036
+            id
1037
+        });
1038
+    }
1039
+
1025 1040
     /**
1026 1041
      * Disposes the allocated resources.
1027 1042
      *

+ 1
- 0
modules/API/external/external_api.js Целия файл

@@ -79,6 +79,7 @@ const events = {
79 79
     'participant-role-changed': 'participantRoleChanged',
80 80
     'password-required': 'passwordRequired',
81 81
     'proxy-connection-event': 'proxyConnectionEvent',
82
+    'raise-hand-updated': 'raiseHandUpdated',
82 83
     'video-ready-to-close': 'readyToClose',
83 84
     'video-conference-joined': 'videoConferenceJoined',
84 85
     'video-conference-left': 'videoConferenceLeft',

+ 4
- 0
react/features/base/participants/middleware.js Целия файл

@@ -448,6 +448,10 @@ function _raiseHandUpdated({ dispatch, getState }, conference, participantId, ne
448 448
         raisedHand
449 449
     }));
450 450
 
451
+    if (typeof APP !== 'undefined') {
452
+        APP.API.notifyRaiseHandUpdated(participantId, raisedHand);
453
+    }
454
+
451 455
     if (raisedHand) {
452 456
         dispatch(showNotification({
453 457
             titleArguments: {

+ 4
- 1
react/features/toolbox/components/web/Toolbox.js Целия файл

@@ -470,6 +470,7 @@ class Toolbox extends Component<Props, State> {
470 470
      */
471 471
     _doToggleRaiseHand() {
472 472
         const { _localParticipantID, _raisedHand } = this.props;
473
+        const newRaisedStatus = !_raisedHand;
473 474
 
474 475
         this.props.dispatch(participantUpdated({
475 476
             // XXX Only the local participant is allowed to update without
@@ -480,8 +481,10 @@ class Toolbox extends Component<Props, State> {
480 481
 
481 482
             id: _localParticipantID,
482 483
             local: true,
483
-            raisedHand: !_raisedHand
484
+            raisedHand: newRaisedStatus
484 485
         }));
486
+
487
+        APP.API.notifyRaiseHandUpdated(_localParticipantID, newRaisedStatus);
485 488
     }
486 489
 
487 490
     /**

Loading…
Отказ
Запис