Ver código fonte

feat(face-landmarks) add API event for providing face landmark data (#11347)

master
Avram Tudor 3 anos atrás
pai
commit
ceb8d3348d
Nenhuma conta vinculada ao e-mail do autor do commit

+ 15
- 0
modules/API/API.js Ver arquivo

@@ -1141,6 +1141,21 @@ class API {
1141 1141
         });
1142 1142
     }
1143 1143
 
1144
+    /**
1145
+     * Notify external application (if API is enabled) that some face landmark data is available.
1146
+     *
1147
+     * @param {Object | undefined} faceBox - Detected face(s) bounding box (left, right, width).
1148
+     * @param {string} faceExpression - Detected face expression.
1149
+     * @returns {void}
1150
+     */
1151
+    notifyFaceLandmarkDetected(faceBox: Object, faceExpression: string) {
1152
+        this._sendEvent({
1153
+            name: 'face-landmark-detected',
1154
+            faceBox,
1155
+            faceExpression
1156
+        });
1157
+    }
1158
+
1144 1159
     /**
1145 1160
      * Notify external application (if API is enabled) that the list of sharing participants changed.
1146 1161
      *

+ 1
- 0
modules/API/external/external_api.js Ver arquivo

@@ -102,6 +102,7 @@ const events = {
102 102
     'email-change': 'emailChange',
103 103
     'error-occurred': 'errorOccurred',
104 104
     'endpoint-text-message-received': 'endpointTextMessageReceived',
105
+    'face-landmark-detected': 'faceLandmarkDetected',
105 106
     'feedback-submitted': 'feedbackSubmitted',
106 107
     'feedback-prompt-displayed': 'feedbackPromptDisplayed',
107 108
     'filmstrip-display-changed': 'filmstripDisplayChanged',

+ 4
- 0
react/features/face-landmarks/actions.js Ver arquivo

@@ -28,6 +28,8 @@ import {
28 28
 } from './functions';
29 29
 import logger from './logger';
30 30
 
31
+declare var APP: Object;
32
+
31 33
 /**
32 34
  * Object containing  a image capture of the local track.
33 35
  */
@@ -125,6 +127,8 @@ export function loadWorker() {
125 127
                     id: localParticipant.id
126 128
                 });
127 129
             }
130
+
131
+            APP.API.notifyFaceLandmarkDetected(faceBox, faceExpression);
128 132
         };
129 133
 
130 134
         const { faceLandmarks } = getState()['features/base/config'];

Carregando…
Cancelar
Salvar