From 291370a2636a539f3671964fc13fb127927d2e33 Mon Sep 17 00:00:00 2001 From: Gabriel Borlea Date: Wed, 21 Dec 2022 15:34:40 +0200 Subject: [PATCH] fix(face-landmarks): check for track state only if image capture is not polyfill (#12711) --- .../features/face-landmarks/FaceLandmarksDetector.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/react/features/face-landmarks/FaceLandmarksDetector.ts b/react/features/face-landmarks/FaceLandmarksDetector.ts index 0af9c56a4..039a51909 100644 --- a/react/features/face-landmarks/FaceLandmarksDetector.ts +++ b/react/features/face-landmarks/FaceLandmarksDetector.ts @@ -305,13 +305,20 @@ class FaceLandmarksDetector { private async sendDataToWorker(faceCenteringThreshold = 10): Promise { if (!this.imageCapture || !this.worker - || !this.imageCapture?.track - || this.imageCapture?.track.readyState !== 'live') { + || !this.imageCapture) { logger.log('Environment not ready! Could not send data to worker'); return false; } + // if ImageCapture is polyfilled then it would not have the track, + // so there would be no point in checking for its readyState + if (this.imageCapture.track && this.imageCapture.track.readyState !== 'live') { + logger.log('Track not ready! Could not send data to worker'); + + return false; + } + let imageBitmap; let image;