static process()

in client/src/js/ChallengeProcessor.ts [92:120]


  static process(challengeProcessor: ChallengeProcessor): any {
    Logger.debug("video event handler");
    if (challengeProcessor.videoElement.paused || challengeProcessor.videoElement.ended) {
      Logger.debug("video paused or ended");
      return setTimeout(() => ChallengeProcessor.process(challengeProcessor), 10);
    }

    if (Utils.isProfiling()) {
      Logger.time("faceDetectionWithFaceLandmarks");
    }
    const options = new faceapi.TinyFaceDetectorOptions();
    faceapi
      .detectAllFaces(challengeProcessor.videoElement, options)
      .withFaceLandmarks(false)
      .then(
        // @ts-ignore
        function(result: faceapi.WithFaceLandmarks<{ detection: faceapi.FaceDetection }, faceapi.FaceLandmarks68>[]) {
          if (Utils.isProfiling()) {
            Logger.timeEnd("faceDetectionWithFaceLandmarks");
          }

          if (result) {
            ChallengeProcessor.processDetectionResults(challengeProcessor, result);
          } else {
            setTimeout(() => ChallengeProcessor.process(challengeProcessor));
          }
        }
      );
  }