fix(face-landmarks): not sending duplicate expressions when recognition stops (#12067)

fix(facelandmarks): do not perform stop recognition if it is not active
This commit is contained in:
Gabriel Borlea 2022-08-25 16:52:03 +03:00 committed by GitHub
parent 7951dc3ce7
commit b9aeb19379
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -212,8 +212,10 @@ export function startFaceLandmarksDetection(track) {
* @returns {void}
*/
export function stopFaceLandmarksDetection() {
return function(dispatch: Function) {
if (lastFaceExpression && lastFaceExpressionTimestamp) {
return function(dispatch: Function, getState: Function) {
const { recognitionActive } = getState()['features/face-landmarks'];
if (lastFaceExpression && lastFaceExpressionTimestamp && recognitionActive) {
dispatch(
addFaceExpression(
lastFaceExpression,
@ -227,6 +229,8 @@ export function stopFaceLandmarksDetection() {
clearInterval(detectionInterval);
duplicateConsecutiveExpressions = 0;
lastFaceExpression = null;
lastFaceExpressionTimestamp = null;
webhookSendInterval = null;
detectionInterval = null;
imageCapture = null;