easyproctor-hml 2.5.17 → 2.5.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.js CHANGED
@@ -11819,12 +11819,12 @@ var BackendService = class {
11819
11819
  });
11820
11820
  return result.data;
11821
11821
  }
11822
- async verifyFace(proctoringId2, faceImage) {
11822
+ async verifyFace(proctoringId2, faceImage, retry) {
11823
11823
  const result = await this.makeRequestAxios({
11824
11824
  path: `/Realtime/verify-face`,
11825
11825
  method: "POST",
11826
11826
  jwt: this.token,
11827
- body: { "proctoringId": proctoringId2, "base64": faceImage }
11827
+ body: { "proctoringId": proctoringId2, "base64": faceImage, "retry": retry }
11828
11828
  });
11829
11829
  return result.data;
11830
11830
  }
@@ -12700,7 +12700,6 @@ var CameraRecorder = class {
12700
12700
  noiseLimit: 40
12701
12701
  },
12702
12702
  imageBehaviourParameters: {
12703
- frames: 40,
12704
12703
  useUploadImage: true,
12705
12704
  uploadInterval: 20,
12706
12705
  saveVideo: true
@@ -12712,7 +12711,6 @@ var CameraRecorder = class {
12712
12711
  }
12713
12712
  };
12714
12713
  // private imageParams: ImageParameters = {
12715
- // frames: 40,
12716
12714
  // useUploadImage: true,
12717
12715
  // uploadInterval: 20,
12718
12716
  // saveVideo: true
@@ -15202,7 +15200,6 @@ var AlertRecorder = class {
15202
15200
  // 1. LOST / RETURN FOCUS
15203
15201
  this.handleLostFocus = () => {
15204
15202
  if (this.getRelativeTime() > 1e4) {
15205
- this.createAlert(25 /* FocusOff */, 3 /* Screen */, "Usu\xE1rio mudou de aba ou minimizou");
15206
15203
  const alertPayload = {
15207
15204
  begin: this.getRelativeTime(),
15208
15205
  end: 0,
@@ -21797,7 +21794,6 @@ var Proctoring = class {
21797
21794
  noiseLimit: 40
21798
21795
  },
21799
21796
  imageBehaviourParameters: {
21800
- frames: 40,
21801
21797
  useUploadImage: true,
21802
21798
  uploadInterval: 20,
21803
21799
  saveVideo: true
@@ -22128,11 +22124,23 @@ Navigator: ${JSON.stringify(_navigator2)}`
22128
22124
  startResponse.screenStream = this.allRecorders.screenRecorder.screenStream;
22129
22125
  }
22130
22126
  this.state = "Recording" /* Recording */;
22131
- setTimeout(async () => {
22127
+ let verifyFirstFaceIntervalCount = 0;
22128
+ let verifyingFace = false;
22129
+ this.verifyFirstFaceInterval = setInterval(async () => {
22132
22130
  if (this.sessionOptions.proctoringType === "REALTIME") {
22133
- await this.backend.verifyFace(this.proctoringId, await this.allRecorders.cameraRecorder.getCurrentImageBase64());
22131
+ if (verifyingFace) return;
22132
+ verifyingFace = true;
22133
+ verifyFirstFaceIntervalCount++;
22134
+ try {
22135
+ var response = await this.backend.verifyFace(this.proctoringId, await this.allRecorders.cameraRecorder.getCurrentImageBase64(), verifyFirstFaceIntervalCount > 5 ? false : true);
22136
+ verifyingFace = false;
22137
+ clearInterval(this.verifyFirstFaceInterval);
22138
+ } catch (error) {
22139
+ verifyingFace = false;
22140
+ return;
22141
+ }
22134
22142
  }
22135
- }, 1e3);
22143
+ }, 1500);
22136
22144
  return startResponse;
22137
22145
  } catch (error) {
22138
22146
  console.log(error);
@@ -22270,6 +22278,9 @@ Upload Services: ${uploaderServices}`,
22270
22278
  await this.backend.externalCameraFinish(externalSessionId);
22271
22279
  }
22272
22280
  }
22281
+ if (this.verifyFirstFaceInterval) {
22282
+ clearInterval(this.verifyFirstFaceInterval);
22283
+ }
22273
22284
  this.state = "Stop" /* Stop */;
22274
22285
  } catch (error) {
22275
22286
  await this.cancel();
@@ -22657,12 +22668,12 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
22657
22668
  const photo = new CapturePhoto();
22658
22669
  const login = proctoring.login.bind(proctoring);
22659
22670
  const originalStart = proctoring.start.bind(proctoring);
22660
- const start = async (parameters2) => {
22671
+ const start = async (parameters2, videoOptions) => {
22661
22672
  const deviceResult = checker.getDeviceCheckResult();
22662
22673
  if (deviceResult) {
22663
22674
  proctoring.setDeviceCheckData(deviceResult);
22664
22675
  }
22665
- return originalStart(parameters2);
22676
+ return originalStart(parameters2, videoOptions);
22666
22677
  };
22667
22678
  const finish = proctoring.finish.bind(proctoring);
22668
22679
  const startChallenge = proctoring.startChallenge.bind(proctoring);
package/index.js CHANGED
@@ -29916,12 +29916,12 @@ var BackendService = class {
29916
29916
  });
29917
29917
  return result.data;
29918
29918
  }
29919
- async verifyFace(proctoringId2, faceImage) {
29919
+ async verifyFace(proctoringId2, faceImage, retry) {
29920
29920
  const result = await this.makeRequestAxios({
29921
29921
  path: `/Realtime/verify-face`,
29922
29922
  method: "POST",
29923
29923
  jwt: this.token,
29924
- body: { "proctoringId": proctoringId2, "base64": faceImage }
29924
+ body: { "proctoringId": proctoringId2, "base64": faceImage, "retry": retry }
29925
29925
  });
29926
29926
  return result.data;
29927
29927
  }
@@ -30797,7 +30797,6 @@ var CameraRecorder = class {
30797
30797
  noiseLimit: 40
30798
30798
  },
30799
30799
  imageBehaviourParameters: {
30800
- frames: 40,
30801
30800
  useUploadImage: true,
30802
30801
  uploadInterval: 20,
30803
30802
  saveVideo: true
@@ -30809,7 +30808,6 @@ var CameraRecorder = class {
30809
30808
  }
30810
30809
  };
30811
30810
  // private imageParams: ImageParameters = {
30812
- // frames: 40,
30813
30811
  // useUploadImage: true,
30814
30812
  // uploadInterval: 20,
30815
30813
  // saveVideo: true
@@ -33299,7 +33297,6 @@ var AlertRecorder = class {
33299
33297
  // 1. LOST / RETURN FOCUS
33300
33298
  this.handleLostFocus = () => {
33301
33299
  if (this.getRelativeTime() > 1e4) {
33302
- this.createAlert(25 /* FocusOff */, 3 /* Screen */, "Usu\xE1rio mudou de aba ou minimizou");
33303
33300
  const alertPayload = {
33304
33301
  begin: this.getRelativeTime(),
33305
33302
  end: 0,
@@ -37046,7 +37043,6 @@ var Proctoring = class {
37046
37043
  noiseLimit: 40
37047
37044
  },
37048
37045
  imageBehaviourParameters: {
37049
- frames: 40,
37050
37046
  useUploadImage: true,
37051
37047
  uploadInterval: 20,
37052
37048
  saveVideo: true
@@ -37377,11 +37373,23 @@ Navigator: ${JSON.stringify(_navigator2)}`
37377
37373
  startResponse.screenStream = this.allRecorders.screenRecorder.screenStream;
37378
37374
  }
37379
37375
  this.state = "Recording" /* Recording */;
37380
- setTimeout(async () => {
37376
+ let verifyFirstFaceIntervalCount = 0;
37377
+ let verifyingFace = false;
37378
+ this.verifyFirstFaceInterval = setInterval(async () => {
37381
37379
  if (this.sessionOptions.proctoringType === "REALTIME") {
37382
- await this.backend.verifyFace(this.proctoringId, await this.allRecorders.cameraRecorder.getCurrentImageBase64());
37380
+ if (verifyingFace) return;
37381
+ verifyingFace = true;
37382
+ verifyFirstFaceIntervalCount++;
37383
+ try {
37384
+ var response = await this.backend.verifyFace(this.proctoringId, await this.allRecorders.cameraRecorder.getCurrentImageBase64(), verifyFirstFaceIntervalCount > 5 ? false : true);
37385
+ verifyingFace = false;
37386
+ clearInterval(this.verifyFirstFaceInterval);
37387
+ } catch (error) {
37388
+ verifyingFace = false;
37389
+ return;
37390
+ }
37383
37391
  }
37384
- }, 1e3);
37392
+ }, 1500);
37385
37393
  return startResponse;
37386
37394
  } catch (error) {
37387
37395
  console.log(error);
@@ -37519,6 +37527,9 @@ Upload Services: ${uploaderServices}`,
37519
37527
  await this.backend.externalCameraFinish(externalSessionId);
37520
37528
  }
37521
37529
  }
37530
+ if (this.verifyFirstFaceInterval) {
37531
+ clearInterval(this.verifyFirstFaceInterval);
37532
+ }
37522
37533
  this.state = "Stop" /* Stop */;
37523
37534
  } catch (error) {
37524
37535
  await this.cancel();
@@ -37906,12 +37917,12 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
37906
37917
  const photo = new CapturePhoto();
37907
37918
  const login = proctoring.login.bind(proctoring);
37908
37919
  const originalStart = proctoring.start.bind(proctoring);
37909
- const start = async (parameters2) => {
37920
+ const start = async (parameters2, videoOptions) => {
37910
37921
  const deviceResult = checker.getDeviceCheckResult();
37911
37922
  if (deviceResult) {
37912
37923
  proctoring.setDeviceCheckData(deviceResult);
37913
37924
  }
37914
- return originalStart(parameters2);
37925
+ return originalStart(parameters2, videoOptions);
37915
37926
  };
37916
37927
  const finish = proctoring.finish.bind(proctoring);
37917
37928
  const startChallenge = proctoring.startChallenge.bind(proctoring);
@@ -5,7 +5,6 @@ export type AudioBehaviourParameters = {
5
5
  noiseLimit?: number;
6
6
  };
7
7
  export type ImageBehaviourParameters = {
8
- frames?: number;
9
8
  useUploadImage?: boolean;
10
9
  uploadInterval?: number;
11
10
  saveVideo?: boolean;
@@ -39,7 +39,7 @@ export declare class BackendService {
39
39
  stopChallenge(challengeId: string, body: any): Promise<any>;
40
40
  startRealtimeAlert(body: any): Promise<any>;
41
41
  stopRealtimeAlert(body: any): Promise<any>;
42
- verifyFace(proctoringId: any, faceImage: any): Promise<any>;
42
+ verifyFace(proctoringId: any, faceImage: any, retry: boolean): Promise<any>;
43
43
  getServerHour(token: string): Promise<string>;
44
44
  private makeRequest;
45
45
  makeRequestAxios<R>(data: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor-hml",
3
- "version": "2.5.17",
3
+ "version": "2.5.18",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -57,6 +57,7 @@ export declare class Proctoring {
57
57
  private allRecorders;
58
58
  private spyCam;
59
59
  appChecker: ExternalCameraChecker;
60
+ private verifyFirstFaceInterval;
60
61
  private onStopSharingScreenCallback;
61
62
  setOnStopSharingScreenCallback(cb: () => void): void;
62
63
  private setOnLostFocusAlertRecorderCallback;
@@ -3,7 +3,7 @@ import enumarateDevices from "../modules/enumarateDevices";
3
3
  import { ProctoringContext } from "./proctoring";
4
4
  export declare function useProctoring(proctoringOptions: ProctoringContext, enviromentConfig?: string): {
5
5
  login: () => Promise<void>;
6
- start: (parameters: any) => Promise<import("../dtos/StartProctoringResponse").default>;
6
+ start: (parameters: any, videoOptions: any) => Promise<import("../dtos/StartProctoringResponse").default>;
7
7
  finish: (options?: import("./proctoring").ProctoringFinisherOptions) => Promise<void>;
8
8
  startChallenge: (templateId: string) => Promise<void>;
9
9
  stopChallenge: () => Promise<void>;