mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-15 14:47:48 +00:00
* fix(face-landmarks): work only when one face is detected * fix: remove redundant check for detection * fix(face-landmarks): re-center and stop when more faces detected * fix: remove faceCount checking when sending message from worker * fix: add again the faceCount * fix: add comment * code review
29 lines
711 B
TypeScript
29 lines
711 B
TypeScript
import { DETECT_FACE, INIT_WORKER } from './constants';
|
|
import { FaceLandmarksHelper, HumanHelper }from './FaceLandmarksHelper';
|
|
|
|
|
|
let helper: FaceLandmarksHelper;
|
|
|
|
onmessage = async function(message: MessageEvent<any>) {
|
|
switch (message.data.type) {
|
|
case DETECT_FACE: {
|
|
if (!helper || helper.getDetectionInProgress()) {
|
|
return;
|
|
}
|
|
|
|
const detections = await helper.detect(message.data);
|
|
|
|
if (detections && (detections.faceBox || detections.faceExpression || detections.faceCount)) {
|
|
self.postMessage(detections);
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
case INIT_WORKER: {
|
|
helper = new HumanHelper(message.data);
|
|
break;
|
|
}
|
|
}
|
|
};
|