瀏覽代碼

ref(face-expressions) refactor face landmarks namings (#1977)

dev1
Avram Tudor 3 年之前
父節點
當前提交
832d7d35fa
沒有連結到貢獻者的電子郵件帳戶。

+ 5
- 3
JitsiConference.js 查看文件

3749
 };
3749
 };
3750
 
3750
 
3751
 /**
3751
 /**
3752
- * Sends a facial expression with its duration to the xmpp server.
3752
+ * Sends a face landmarks object to the xmpp server.
3753
  * @param {Object} payload
3753
  * @param {Object} payload
3754
  */
3754
  */
3755
-JitsiConference.prototype.sendFacialExpression = function(payload) {
3756
-    this.xmpp.sendFacialExpressionEvent(this.room.roomjid, payload);
3755
+JitsiConference.prototype.sendFaceLandmarks = function(payload) {
3756
+    if (payload.faceExpression) {
3757
+        this.xmpp.sendFaceExpressionEvent(this.room.roomjid, payload);
3758
+    }
3757
 };
3759
 };
3758
 
3760
 
3759
 /**
3761
 /**

+ 3
- 3
JitsiConferenceEvents.spec.ts 查看文件

73
         AV_MODERATION_CHANGED,
73
         AV_MODERATION_CHANGED,
74
         AV_MODERATION_PARTICIPANT_APPROVED,
74
         AV_MODERATION_PARTICIPANT_APPROVED,
75
         AV_MODERATION_PARTICIPANT_REJECTED,
75
         AV_MODERATION_PARTICIPANT_REJECTED,
76
-        FACIAL_EXPRESSION_ADDED,
76
+        FACE_LANDMARK_ADDED,
77
         BREAKOUT_ROOMS_MOVE_TO_ROOM,
77
         BREAKOUT_ROOMS_MOVE_TO_ROOM,
78
         BREAKOUT_ROOMS_UPDATED,
78
         BREAKOUT_ROOMS_UPDATED,
79
         JitsiConferenceEvents,
79
         JitsiConferenceEvents,
150
         expect( AV_MODERATION_CHANGED ).toBe( 'conference.av_moderation.changed' );
150
         expect( AV_MODERATION_CHANGED ).toBe( 'conference.av_moderation.changed' );
151
         expect( AV_MODERATION_PARTICIPANT_APPROVED ).toBe( 'conference.av_moderation.participant.approved' );
151
         expect( AV_MODERATION_PARTICIPANT_APPROVED ).toBe( 'conference.av_moderation.participant.approved' );
152
         expect( AV_MODERATION_PARTICIPANT_REJECTED ).toBe( 'conference.av_moderation.participant.rejected' );
152
         expect( AV_MODERATION_PARTICIPANT_REJECTED ).toBe( 'conference.av_moderation.participant.rejected' );
153
-        expect( FACIAL_EXPRESSION_ADDED ).toBe( 'conference.facial_expression.added' );
153
+        expect( FACE_LANDMARK_ADDED ).toBe( 'conference.face_landmark.added' );
154
         expect( BREAKOUT_ROOMS_MOVE_TO_ROOM ).toBe( 'conference.breakout-rooms.move-to-room' );
154
         expect( BREAKOUT_ROOMS_MOVE_TO_ROOM ).toBe( 'conference.breakout-rooms.move-to-room' );
155
         expect( BREAKOUT_ROOMS_UPDATED ).toBe( 'conference.breakout-rooms.updated' );
155
         expect( BREAKOUT_ROOMS_UPDATED ).toBe( 'conference.breakout-rooms.updated' );
156
 
156
 
225
         expect( JitsiConferenceEvents.AV_MODERATION_CHANGED ).toBe( 'conference.av_moderation.changed' );
225
         expect( JitsiConferenceEvents.AV_MODERATION_CHANGED ).toBe( 'conference.av_moderation.changed' );
226
         expect( JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_APPROVED ).toBe( 'conference.av_moderation.participant.approved' );
226
         expect( JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_APPROVED ).toBe( 'conference.av_moderation.participant.approved' );
227
         expect( JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_REJECTED ).toBe( 'conference.av_moderation.participant.rejected' );
227
         expect( JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_REJECTED ).toBe( 'conference.av_moderation.participant.rejected' );
228
-        expect( JitsiConferenceEvents.FACIAL_EXPRESSION_ADDED ).toBe( 'conference.facial_expression.added' );
228
+        expect( JitsiConferenceEvents.FACE_LANDMARK_ADDED ).toBe( 'conference.face_landmark.added' );
229
         expect( JitsiConferenceEvents.BREAKOUT_ROOMS_MOVE_TO_ROOM ).toBe( 'conference.breakout-rooms.move-to-room' );
229
         expect( JitsiConferenceEvents.BREAKOUT_ROOMS_MOVE_TO_ROOM ).toBe( 'conference.breakout-rooms.move-to-room' );
230
         expect( JitsiConferenceEvents.BREAKOUT_ROOMS_UPDATED ).toBe( 'conference.breakout-rooms.updated' );
230
         expect( JitsiConferenceEvents.BREAKOUT_ROOMS_UPDATED ).toBe( 'conference.breakout-rooms.updated' );
231
     } );
231
     } );

+ 3
- 3
JitsiConferenceEvents.ts 查看文件

451
     AV_MODERATION_PARTICIPANT_REJECTED = 'conference.av_moderation.participant.rejected',
451
     AV_MODERATION_PARTICIPANT_REJECTED = 'conference.av_moderation.participant.rejected',
452
 
452
 
453
     /**
453
     /**
454
-     * A new facial expression is added with its duration for a participant
454
+     * A new face landmark object is added for a participant
455
      */
455
      */
456
-    FACIAL_EXPRESSION_ADDED = 'conference.facial_expression.added',
456
+    FACE_LANDMARK_ADDED = 'conference.face_landmark.added',
457
 
457
 
458
     /**
458
     /**
459
      * Event fired when a participant is requested to join a given (breakout) room.
459
      * Event fired when a participant is requested to join a given (breakout) room.
536
 export const AV_MODERATION_CHANGED = JitsiConferenceEvents.AV_MODERATION_CHANGED;
536
 export const AV_MODERATION_CHANGED = JitsiConferenceEvents.AV_MODERATION_CHANGED;
537
 export const AV_MODERATION_PARTICIPANT_APPROVED = JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_APPROVED;
537
 export const AV_MODERATION_PARTICIPANT_APPROVED = JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_APPROVED;
538
 export const AV_MODERATION_PARTICIPANT_REJECTED = JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_REJECTED;
538
 export const AV_MODERATION_PARTICIPANT_REJECTED = JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_REJECTED;
539
-export const FACIAL_EXPRESSION_ADDED = JitsiConferenceEvents.FACIAL_EXPRESSION_ADDED;
539
+export const FACE_LANDMARK_ADDED = JitsiConferenceEvents.FACE_LANDMARK_ADDED;
540
 export const BREAKOUT_ROOMS_MOVE_TO_ROOM = JitsiConferenceEvents.BREAKOUT_ROOMS_MOVE_TO_ROOM;
540
 export const BREAKOUT_ROOMS_MOVE_TO_ROOM = JitsiConferenceEvents.BREAKOUT_ROOMS_MOVE_TO_ROOM;
541
 export const BREAKOUT_ROOMS_UPDATED = JitsiConferenceEvents.BREAKOUT_ROOMS_UPDATED;
541
 export const BREAKOUT_ROOMS_UPDATED = JitsiConferenceEvents.BREAKOUT_ROOMS_UPDATED;

+ 4
- 4
modules/connectivity/ConnectionQuality.js 查看文件

20
 
20
 
21
 /**
21
 /**
22
  * The value to use for the "type" field for messages sent
22
  * The value to use for the "type" field for messages sent
23
- * over the data channel that contain facial expression.
23
+ * over the data channel that contain a face landmark.
24
  */
24
  */
25
-const FACIAL_EXPRESSION_MESSAGE_TYPE = 'facial_expression';
25
+const FACE_LANDMARK_MESSAGE_TYPE = 'face_landmark';
26
 
26
 
27
 const kSimulcastFormats = [
27
 const kSimulcastFormats = [
28
     { width: 1920,
28
     { width: 1920,
232
         conference.on(
232
         conference.on(
233
             ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
233
             ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
234
             (participant, payload) => {
234
             (participant, payload) => {
235
-                if (payload.type === FACIAL_EXPRESSION_MESSAGE_TYPE) {
235
+                if (payload.type === FACE_LANDMARK_MESSAGE_TYPE) {
236
                     this.eventEmitter.emit(
236
                     this.eventEmitter.emit(
237
-                        ConferenceEvents.FACIAL_EXPRESSION_ADDED,
237
+                        ConferenceEvents.FACE_LANDMARK_ADDED,
238
                         participant.getId(),
238
                         participant.getId(),
239
                         payload);
239
                         payload);
240
                 }
240
                 }

+ 12
- 12
modules/statistics/SpeakerStats.js 查看文件

24
         this.totalDominantSpeakerTime = 0;
24
         this.totalDominantSpeakerTime = 0;
25
         this._dominantSpeakerStart = 0;
25
         this._dominantSpeakerStart = 0;
26
         this._hasLeft = false;
26
         this._hasLeft = false;
27
-        this._facialExpressions = {
27
+        this._faceExpressions = {
28
             happy: 0,
28
             happy: 0,
29
             neutral: 0,
29
             neutral: 0,
30
             surprised: 0,
30
             surprised: 0,
136
     }
136
     }
137
 
137
 
138
     /**
138
     /**
139
-     * Gets the facial expressions of the user.
139
+     * Gets the face expressions of the user.
140
      *
140
      *
141
      * @returns {Object}
141
      * @returns {Object}
142
      */
142
      */
143
-    getFacialExpressions() {
144
-        return this._facialExpressions;
143
+    getFaceExpressions() {
144
+        return this._faceExpressions;
145
     }
145
     }
146
 
146
 
147
     /**
147
     /**
148
-     * Sets the facial expressions of the user.
148
+     * Sets the face expressions of the user.
149
      *
149
      *
150
-     * @param {Object} facialExpressions - object with facial expressions.
150
+     * @param {Object} faceExpressions - object with face expressions.
151
      * @returns {void}
151
      * @returns {void}
152
      */
152
      */
153
-    setFacialExpressions(facialExpressions) {
154
-        this._facialExpressions = facialExpressions;
153
+    setFaceExpressions(faceExpressions) {
154
+        this._faceExpressions = faceExpressions;
155
     }
155
     }
156
 
156
 
157
     /**
157
     /**
158
-     * Adds a new facial expression to speaker stats.
158
+     * Adds a new face expression to speaker stats.
159
      *
159
      *
160
-     * @param  {string} facialExpression
160
+     * @param  {string} faceExpression
161
      * @param {number} duration
161
      * @param {number} duration
162
      */
162
      */
163
-    addFacialExpression(facialExpression, duration) {
164
-        this._facialExpressions[facialExpression] += duration;
163
+    addFaceExpression(faceExpression, duration) {
164
+        this._faceExpressions[faceExpression] += duration;
165
     }
165
     }
166
 }
166
 }
167
 
167
 

+ 8
- 8
modules/statistics/SpeakerStatsCollector.js 查看文件

42
             JitsiConferenceEvents.DISPLAY_NAME_CHANGED,
42
             JitsiConferenceEvents.DISPLAY_NAME_CHANGED,
43
             this._onDisplayNameChange.bind(this));
43
             this._onDisplayNameChange.bind(this));
44
         conference.addEventListener(
44
         conference.addEventListener(
45
-            JitsiConferenceEvents.FACIAL_EXPRESSION_ADDED,
46
-            this._onFacialExpressionAdd.bind(this));
45
+            JitsiConferenceEvents.FACE_LANDMARK_ADDED,
46
+            this._onFaceLandmarkAdd.bind(this));
47
         if (conference.xmpp) {
47
         if (conference.xmpp) {
48
             conference.xmpp.addListener(
48
             conference.xmpp.addListener(
49
                 XMPPEvents.SPEAKER_STATS_RECEIVED,
49
                 XMPPEvents.SPEAKER_STATS_RECEIVED,
121
     }
121
     }
122
 
122
 
123
     /**
123
     /**
124
-     * Adds a new facial expression with its duration of a remote user.
124
+     * Processes a new face landmark object of a remote user.
125
      *
125
      *
126
      * @param {string} userId - The user id of the user that left.
126
      * @param {string} userId - The user id of the user that left.
127
-     * @param {Object} data - The facial expression with its duration.
127
+     * @param {Object} data - The face landmark object.
128
      * @returns {void}
128
      * @returns {void}
129
      * @private
129
      * @private
130
      */
130
      */
131
-    _onFacialExpressionAdd(userId, data) {
131
+    _onFaceLandmarkAdd(userId, data) {
132
         const savedUser = this.stats.users[userId];
132
         const savedUser = this.stats.users[userId];
133
 
133
 
134
-        if (savedUser) {
135
-            savedUser.addFacialExpression(data.facialExpression, data.duration);
134
+        if (savedUser && data.faceExpression) {
135
+            savedUser.addFaceExpression(data.faceExpression, data.duration);
136
         }
136
         }
137
     }
137
     }
138
 
138
 
177
             speakerStatsToUpdate.totalDominantSpeakerTime
177
             speakerStatsToUpdate.totalDominantSpeakerTime
178
                 = newStats[userId].totalDominantSpeakerTime;
178
                 = newStats[userId].totalDominantSpeakerTime;
179
 
179
 
180
-            speakerStatsToUpdate.setFacialExpressions(newStats[userId].facialExpressions);
180
+            speakerStatsToUpdate.setFaceExpressions(newStats[userId].faceExpressions);
181
         }
181
         }
182
     }
182
     }
183
 }
183
 }

+ 4
- 4
modules/xmpp/xmpp.js 查看文件

915
     }
915
     }
916
 
916
 
917
     /**
917
     /**
918
-     * Sends facial expression to speaker stats component.
918
+     * Sends face expressions to speaker stats component.
919
      * @param {String} roomJid - The room jid where the speaker event occurred.
919
      * @param {String} roomJid - The room jid where the speaker event occurred.
920
      * @param {Object} payload - The expression to be sent to the speaker stats.
920
      * @param {Object} payload - The expression to be sent to the speaker stats.
921
      */
921
      */
922
-    sendFacialExpressionEvent(roomJid, payload) {
922
+    sendFaceExpressionEvent(roomJid, payload) {
923
         // no speaker stats component advertised
923
         // no speaker stats component advertised
924
         if (!this.speakerStatsComponentAddress || !roomJid) {
924
         if (!this.speakerStatsComponentAddress || !roomJid) {
925
             return;
925
             return;
927
 
927
 
928
         const msg = $msg({ to: this.speakerStatsComponentAddress });
928
         const msg = $msg({ to: this.speakerStatsComponentAddress });
929
 
929
 
930
-        msg.c('facialExpression', {
930
+        msg.c('faceExpression', {
931
             xmlns: 'http://jitsi.org/jitmeet',
931
             xmlns: 'http://jitsi.org/jitmeet',
932
             room: roomJid,
932
             room: roomJid,
933
-            expression: payload.facialExpression,
933
+            expression: payload.faceExpression,
934
             duration: payload.duration
934
             duration: payload.duration
935
         }).up();
935
         }).up();
936
 
936
 

+ 2
- 2
types/auto/JitsiConference.d.ts 查看文件

986
      */
986
      */
987
     getSpeakerStats(): object;
987
     getSpeakerStats(): object;
988
     /**
988
     /**
989
-     * Sends a facial expression with its duration to the xmpp server.
989
+     * Sends a face landmarks object to the xmpp server.
990
      * @param {Object} payload
990
      * @param {Object} payload
991
      */
991
      */
992
-    sendFacialExpression(payload: any): void;
992
+    sendFaceLandmarks(payload: any): void;
993
     /**
993
     /**
994
      * Sets the constraints for the video that is requested from the bridge.
994
      * Sets the constraints for the video that is requested from the bridge.
995
      *
995
      *

+ 3
- 3
types/auto/JitsiConferenceEvents.d.ts 查看文件

381
      */
381
      */
382
     AV_MODERATION_PARTICIPANT_REJECTED = "conference.av_moderation.participant.rejected",
382
     AV_MODERATION_PARTICIPANT_REJECTED = "conference.av_moderation.participant.rejected",
383
     /**
383
     /**
384
-     * A new facial expression is added with its duration for a participant
384
+     * A new face landmark object is added for a participant
385
      */
385
      */
386
-    FACIAL_EXPRESSION_ADDED = "conference.facial_expression.added",
386
+    FACE_LANDMARK_ADDED = "conference.face_landmark.added",
387
     /**
387
     /**
388
      * Event fired when a participant is requested to join a given (breakout) room.
388
      * Event fired when a participant is requested to join a given (breakout) room.
389
      */
389
      */
462
 export declare const AV_MODERATION_CHANGED = JitsiConferenceEvents.AV_MODERATION_CHANGED;
462
 export declare const AV_MODERATION_CHANGED = JitsiConferenceEvents.AV_MODERATION_CHANGED;
463
 export declare const AV_MODERATION_PARTICIPANT_APPROVED = JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_APPROVED;
463
 export declare const AV_MODERATION_PARTICIPANT_APPROVED = JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_APPROVED;
464
 export declare const AV_MODERATION_PARTICIPANT_REJECTED = JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_REJECTED;
464
 export declare const AV_MODERATION_PARTICIPANT_REJECTED = JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_REJECTED;
465
-export declare const FACIAL_EXPRESSION_ADDED = JitsiConferenceEvents.FACIAL_EXPRESSION_ADDED;
465
+export declare const FACE_LANDMARK_ADDED = JitsiConferenceEvents.FACE_LANDMARK_ADDED;
466
 export declare const BREAKOUT_ROOMS_MOVE_TO_ROOM = JitsiConferenceEvents.BREAKOUT_ROOMS_MOVE_TO_ROOM;
466
 export declare const BREAKOUT_ROOMS_MOVE_TO_ROOM = JitsiConferenceEvents.BREAKOUT_ROOMS_MOVE_TO_ROOM;
467
 export declare const BREAKOUT_ROOMS_UPDATED = JitsiConferenceEvents.BREAKOUT_ROOMS_UPDATED;
467
 export declare const BREAKOUT_ROOMS_UPDATED = JitsiConferenceEvents.BREAKOUT_ROOMS_UPDATED;

+ 9
- 9
types/auto/modules/statistics/SpeakerStats.d.ts 查看文件

23
     totalDominantSpeakerTime: number;
23
     totalDominantSpeakerTime: number;
24
     _dominantSpeakerStart: number;
24
     _dominantSpeakerStart: number;
25
     _hasLeft: boolean;
25
     _hasLeft: boolean;
26
-    _facialExpressions: {
26
+    _faceExpressions: {
27
         happy: number;
27
         happy: number;
28
         neutral: number;
28
         neutral: number;
29
         surprised: number;
29
         surprised: number;
92
      */
92
      */
93
     markAsHasLeft(): void;
93
     markAsHasLeft(): void;
94
     /**
94
     /**
95
-     * Gets the facial expressions of the user.
95
+     * Gets the face expressions of the user.
96
      *
96
      *
97
      * @returns {Object}
97
      * @returns {Object}
98
      */
98
      */
99
-    getFacialExpressions(): any;
99
+    getFaceExpressions(): any;
100
     /**
100
     /**
101
-     * Sets the facial expressions of the user.
101
+     * Sets the face expressions of the user.
102
      *
102
      *
103
-     * @param {Object} facialExpressions - object with facial expressions.
103
+     * @param {Object} faceExpressions - object with face expressions.
104
      * @returns {void}
104
      * @returns {void}
105
      */
105
      */
106
-    setFacialExpressions(facialExpressions: any): void;
106
+    setFaceExpressions(faceExpressions: any): void;
107
     /**
107
     /**
108
-     * Adds a new facial expression to speaker stats.
108
+     * Adds a new face expression to speaker stats.
109
      *
109
      *
110
-     * @param  {string} facialExpression
110
+     * @param  {string} faceExpression
111
      * @param {number} duration
111
      * @param {number} duration
112
      */
112
      */
113
-    addFacialExpression(facialExpression: string, duration: number): void;
113
+    addFaceExpression(faceExpression: string, duration: number): void;
114
 }
114
 }

+ 3
- 3
types/auto/modules/statistics/SpeakerStatsCollector.d.ts 查看文件

54
      */
54
      */
55
     private _onDisplayNameChange;
55
     private _onDisplayNameChange;
56
     /**
56
     /**
57
-     * Adds a new facial expression with its duration of a remote user.
57
+     * Processes a new face landmark object of a remote user.
58
      *
58
      *
59
      * @param {string} userId - The user id of the user that left.
59
      * @param {string} userId - The user id of the user that left.
60
-     * @param {Object} data - The facial expression with its duration.
60
+     * @param {Object} data - The face landmark object.
61
      * @returns {void}
61
      * @returns {void}
62
      * @private
62
      * @private
63
      */
63
      */
64
-    private _onFacialExpressionAdd;
64
+    private _onFaceLandmarkAdd;
65
     /**
65
     /**
66
      * Return a copy of the tracked SpeakerStats models.
66
      * Return a copy of the tracked SpeakerStats models.
67
      *
67
      *

+ 2
- 2
types/auto/modules/xmpp/xmpp.d.ts 查看文件

240
      */
240
      */
241
     sendDominantSpeakerEvent(roomJid: string): void;
241
     sendDominantSpeakerEvent(roomJid: string): void;
242
     /**
242
     /**
243
-     * Sends facial expression to speaker stats component.
243
+     * Sends face expressions to speaker stats component.
244
      * @param {String} roomJid - The room jid where the speaker event occurred.
244
      * @param {String} roomJid - The room jid where the speaker event occurred.
245
      * @param {Object} payload - The expression to be sent to the speaker stats.
245
      * @param {Object} payload - The expression to be sent to the speaker stats.
246
      */
246
      */
247
-    sendFacialExpressionEvent(roomJid: string, payload: any): void;
247
+    sendFaceExpressionEvent(roomJid: string, payload: any): void;
248
     /**
248
     /**
249
      * Check if the given argument is a valid JSON ENDPOINT_MESSAGE string by
249
      * Check if the given argument is a valid JSON ENDPOINT_MESSAGE string by
250
      * parsing it and checking if it has a field called 'type'.
250
      * parsing it and checking if it has a field called 'type'.

Loading…
取消
儲存