easyproctor-hml 2.5.37 → 2.5.39

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
@@ -9157,7 +9157,6 @@ var BaseDetection = class {
9157
9157
  }
9158
9158
  enableCam(cameraStream) {
9159
9159
  var _a2;
9160
- console.log("BaseDetection enableCam");
9161
9160
  if (!this.detector) {
9162
9161
  console.log("Wait! Detector not loaded yet.");
9163
9162
  return;
@@ -9183,7 +9182,11 @@ var BaseDetection = class {
9183
9182
  cameraStream && !this.video.srcObject && (this.video.srcObject = cameraStream);
9184
9183
  this.video.play();
9185
9184
  const that = this;
9186
- (_a2 = this.video) == null ? void 0 : _a2.addEventListener("loadeddata", () => that.predictWebcam());
9185
+ (_a2 = this.video) == null ? void 0 : _a2.addEventListener("loadeddata", () => {
9186
+ this.animationFrameId = setTimeout(() => {
9187
+ that.predictWebcam();
9188
+ }, 1e4);
9189
+ });
9187
9190
  const style = document.createElement("style");
9188
9191
  style.type = "text/css";
9189
9192
  style.innerHTML = `
@@ -9202,6 +9205,7 @@ var BaseDetection = class {
9202
9205
  console.log("BaseDetection enableCam OK");
9203
9206
  }
9204
9207
  async predictWebcam() {
9208
+ if (this.detecting == false) return;
9205
9209
  if (this.lastVideoTime === -1) {
9206
9210
  await this.detector.setOptions({ runningMode: "VIDEO" });
9207
9211
  }
@@ -9263,7 +9267,7 @@ var BaseDetection = class {
9263
9267
  case "person_ok":
9264
9268
  return "Pessoa detectada";
9265
9269
  case "cellphone_ok":
9266
- return "Nenhum celular detectadoa";
9270
+ return "Nenhum celular detectado";
9267
9271
  case "face_ok":
9268
9272
  return "Face detectada";
9269
9273
  case "ok_position_face_detected":
@@ -9497,8 +9501,6 @@ var FaceDetection = class extends BaseDetection {
9497
9501
  }
9498
9502
  verify(result) {
9499
9503
  var _a2;
9500
- console.log("this.numFacesSent", this.numFacesSent);
9501
- console.log("result.detections.length", result.detections.length);
9502
9504
  if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectFace) && result.detections.length !== this.numFacesSent) {
9503
9505
  this.numFacesSent = result.detections.length;
9504
9506
  if (result.detections.length === 0) {
@@ -12709,12 +12711,12 @@ function setRecorderProctoringId(id) {
12709
12711
  }
12710
12712
  function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCallback, audio = false) {
12711
12713
  let resolvePromise;
12712
- let stopped = false;
12713
12714
  let onBufferSizeInterval;
12714
12715
  let lastEvent;
12715
12716
  let bufferSize;
12716
12717
  bufferSize = 0;
12717
12718
  let startTime;
12719
+ let duration = 0;
12718
12720
  let recorderOptions = {
12719
12721
  // eslint-disable-next-line no-useless-escape
12720
12722
  mimeType: "video/webm",
@@ -12751,10 +12753,6 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
12751
12753
  if (e3.data.size > 0) {
12752
12754
  buffer.push(e3.data);
12753
12755
  }
12754
- if (stopped) {
12755
- console.log("buildMediaRecorder ondataavailable stopped");
12756
- resolvePromise && resolvePromise();
12757
- }
12758
12756
  };
12759
12757
  return mediaRecorder2;
12760
12758
  }
@@ -12766,6 +12764,7 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
12766
12764
  recorder2.onstart = () => {
12767
12765
  started = true;
12768
12766
  console.log("recorder onstart");
12767
+ startTime = new Date(Date.now());
12769
12768
  resolve();
12770
12769
  };
12771
12770
  recorder2.onerror = (ev) => {
@@ -12805,7 +12804,6 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
12805
12804
  await startRecorder(mediaRecorder);
12806
12805
  if (mediaRecorder.state === "recording") {
12807
12806
  bufferSize = 0;
12808
- stopped = false;
12809
12807
  return;
12810
12808
  } else {
12811
12809
  console.log("Recorder n\xE3o est\xE1 em estado recording ap\xF3s start");
@@ -12824,9 +12822,13 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
12824
12822
  resolvePromise = resolve;
12825
12823
  mediaRecorder.onstop = () => {
12826
12824
  console.log("recorder onstop");
12825
+ const duration2 = Date.now() - startTime.getTime() || 0;
12826
+ console.log("duration no onstop", duration2);
12827
+ resolvePromise && resolvePromise();
12827
12828
  };
12828
- stopped = true;
12829
12829
  mediaRecorder.stop();
12830
+ duration = Date.now() - startTime.getTime() || 0;
12831
+ console.log("duration imediatamente ap\xF3s mediaRecorder.stop()", duration);
12830
12832
  } else {
12831
12833
  console.log("stopRecording Recorder n\xE3o est\xE1 em estado recording");
12832
12834
  resolve();
@@ -12862,6 +12864,9 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
12862
12864
  function getStartTime() {
12863
12865
  return startTime;
12864
12866
  }
12867
+ function getDuration() {
12868
+ return duration;
12869
+ }
12865
12870
  return {
12866
12871
  startRecording,
12867
12872
  stopRecording,
@@ -12869,7 +12874,8 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
12869
12874
  resumeRecording,
12870
12875
  recorderOptions,
12871
12876
  getBufferSize,
12872
- getStartTime
12877
+ getStartTime,
12878
+ getDuration
12873
12879
  };
12874
12880
  }
12875
12881
 
@@ -13292,6 +13298,7 @@ var CameraRecorder = class {
13292
13298
  this.internalClonedStream = null;
13293
13299
  this.videoElement = null;
13294
13300
  this.duration = 0;
13301
+ this.stopped = false;
13295
13302
  this.currentRetries = 0;
13296
13303
  this.packageCount = 0;
13297
13304
  this.noiseWait = 20;
@@ -13468,7 +13475,8 @@ Setting: ${JSON.stringify(settings, null, 2)}`
13468
13475
  resumeRecording,
13469
13476
  recorderOptions,
13470
13477
  getBufferSize,
13471
- getStartTime
13478
+ getStartTime,
13479
+ getDuration
13472
13480
  } = recorder(
13473
13481
  this.cameraStream,
13474
13482
  // streamToRecord,
@@ -13484,6 +13492,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
13484
13492
  this.recorderOptions = recorderOptions;
13485
13493
  this.getBufferSize = getBufferSize;
13486
13494
  this.getStartTime = getStartTime;
13495
+ this.getDuration = getDuration;
13487
13496
  try {
13488
13497
  await new Promise((r3) => setTimeout(r3, 500));
13489
13498
  await this.recordingStart();
@@ -13499,6 +13508,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
13499
13508
  throw error;
13500
13509
  }
13501
13510
  }
13511
+ this.stopped = false;
13502
13512
  if (((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectPerson) || ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectCellPhone) || ((_d = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _d.detectFace)) {
13503
13513
  await this.initializeDetectors();
13504
13514
  }
@@ -13516,8 +13526,9 @@ Setting: ${JSON.stringify(settings, null, 2)}`
13516
13526
  console.log("Camera Recorder started OK");
13517
13527
  }
13518
13528
  async stopRecording() {
13519
- var _a2, _b, _c2, _d;
13529
+ var _a2, _b, _c2;
13520
13530
  console.log("Camera Recorder stopRecording");
13531
+ this.stopped = true;
13521
13532
  this.isCanvasLoopActive = false;
13522
13533
  this.faceDetection && this.faceDetection.detecting && this.faceDetection.stopDetection();
13523
13534
  this.objectDetection && this.objectDetection.detecting && this.objectDetection.stopDetection();
@@ -13526,7 +13537,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
13526
13537
  this.volumeMeter && this.volumeMeter.stop();
13527
13538
  this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
13528
13539
  this.recordingStop && await this.recordingStop();
13529
- this.duration = Date.now() - ((_a2 = this.getStartTime()) == null ? void 0 : _a2.getTime()) || 0;
13540
+ this.duration = this.getDuration();
13530
13541
  try {
13531
13542
  if (this.animationFrameId) {
13532
13543
  cancelAnimationFrame(this.animationFrameId);
@@ -13544,14 +13555,14 @@ Setting: ${JSON.stringify(settings, null, 2)}`
13544
13555
  this.hardwareStream = null;
13545
13556
  }
13546
13557
  if (this.videoElement) {
13547
- (_b = this.videoElement) == null ? void 0 : _b.remove();
13558
+ (_a2 = this.videoElement) == null ? void 0 : _a2.remove();
13548
13559
  this.videoElement = null;
13549
13560
  }
13550
13561
  if (this.video) {
13551
- (_c2 = this.video) == null ? void 0 : _c2.remove();
13562
+ (_b = this.video) == null ? void 0 : _b.remove();
13552
13563
  }
13553
13564
  if (this.canvas) {
13554
- (_d = this.canvas) == null ? void 0 : _d.remove();
13565
+ (_c2 = this.canvas) == null ? void 0 : _c2.remove();
13555
13566
  }
13556
13567
  } catch (e3) {
13557
13568
  console.error("Erro ao parar os streams de m\xEDdia.");
@@ -13698,7 +13709,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
13698
13709
  });
13699
13710
  const fixedBlob = await (0, import_fix_webm_duration.default)(rawBlob, this.duration);
13700
13711
  const file = new File(
13701
- [fixedBlob],
13712
+ [rawBlob],
13702
13713
  `EP_${session.id}_camera_0.webm`,
13703
13714
  { type: rawBlob.type }
13704
13715
  );
@@ -13712,6 +13723,21 @@ Setting: ${JSON.stringify(settings, null, 2)}`
13712
13723
  file,
13713
13724
  origin: "Camera" /* Camera */
13714
13725
  });
13726
+ const fileWithDuration = new File(
13727
+ [fixedBlob],
13728
+ `EP_${session.id}_camera_with_duration.webm`,
13729
+ { type: rawBlob.type }
13730
+ );
13731
+ session.addRecording({
13732
+ device: `Audio
13733
+ Sample Rate: ${settingsAudio.sampleRate}
13734
+ Sample Size: ${settingsAudio.sampleSize}
13735
+
13736
+ Video:
13737
+ ${JSON.stringify(this.recorderOptions)}`,
13738
+ file: fileWithDuration,
13739
+ origin: "Camera" /* Camera */
13740
+ });
13715
13741
  }
13716
13742
  }
13717
13743
  async getFile(file, name, type) {
@@ -22528,6 +22554,7 @@ var Proctoring = class {
22528
22554
  async internalOnRealtimeAlerts(response) {
22529
22555
  if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus")) {
22530
22556
  if (response.status === "ALERT") {
22557
+ if (this.allRecorders.cameraRecorder.stopped) return;
22531
22558
  await this.backend.startRealtimeAlert({
22532
22559
  proctoringId: this.proctoringId,
22533
22560
  begin: response.begin,
@@ -22535,6 +22562,7 @@ var Proctoring = class {
22535
22562
  alert: this.convertRealtimeCategoryToAlertCategory(response.category)
22536
22563
  });
22537
22564
  } else if (response.status === "OK") {
22565
+ if (this.allRecorders.cameraRecorder.stopped && response.description !== "face_stop") return;
22538
22566
  await this.stopRealtimeAlert(response);
22539
22567
  }
22540
22568
  }
@@ -22617,7 +22645,7 @@ var Proctoring = class {
22617
22645
  recorders.push(screenRecorder);
22618
22646
  }
22619
22647
  this.recorder = new ProctoringRecorder(this.proctoringSession, recorders);
22620
- return { cameraRecorder, screenRecorder, alertRecorder, noiseRecorder };
22648
+ return { screenRecorder, alertRecorder, noiseRecorder, cameraRecorder };
22621
22649
  }
22622
22650
  async login() {
22623
22651
  var _a2;
package/index.js CHANGED
@@ -26442,7 +26442,6 @@ var BaseDetection = class {
26442
26442
  }
26443
26443
  enableCam(cameraStream) {
26444
26444
  var _a2;
26445
- console.log("BaseDetection enableCam");
26446
26445
  if (!this.detector) {
26447
26446
  console.log("Wait! Detector not loaded yet.");
26448
26447
  return;
@@ -26468,7 +26467,11 @@ var BaseDetection = class {
26468
26467
  cameraStream && !this.video.srcObject && (this.video.srcObject = cameraStream);
26469
26468
  this.video.play();
26470
26469
  const that = this;
26471
- (_a2 = this.video) == null ? void 0 : _a2.addEventListener("loadeddata", () => that.predictWebcam());
26470
+ (_a2 = this.video) == null ? void 0 : _a2.addEventListener("loadeddata", () => {
26471
+ this.animationFrameId = setTimeout(() => {
26472
+ that.predictWebcam();
26473
+ }, 1e4);
26474
+ });
26472
26475
  const style = document.createElement("style");
26473
26476
  style.type = "text/css";
26474
26477
  style.innerHTML = `
@@ -26487,6 +26490,7 @@ var BaseDetection = class {
26487
26490
  console.log("BaseDetection enableCam OK");
26488
26491
  }
26489
26492
  async predictWebcam() {
26493
+ if (this.detecting == false) return;
26490
26494
  if (this.lastVideoTime === -1) {
26491
26495
  await this.detector.setOptions({ runningMode: "VIDEO" });
26492
26496
  }
@@ -26548,7 +26552,7 @@ var BaseDetection = class {
26548
26552
  case "person_ok":
26549
26553
  return "Pessoa detectada";
26550
26554
  case "cellphone_ok":
26551
- return "Nenhum celular detectadoa";
26555
+ return "Nenhum celular detectado";
26552
26556
  case "face_ok":
26553
26557
  return "Face detectada";
26554
26558
  case "ok_position_face_detected":
@@ -26782,8 +26786,6 @@ var FaceDetection = class extends BaseDetection {
26782
26786
  }
26783
26787
  verify(result) {
26784
26788
  var _a2;
26785
- console.log("this.numFacesSent", this.numFacesSent);
26786
- console.log("result.detections.length", result.detections.length);
26787
26789
  if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectFace) && result.detections.length !== this.numFacesSent) {
26788
26790
  this.numFacesSent = result.detections.length;
26789
26791
  if (result.detections.length === 0) {
@@ -30806,12 +30808,12 @@ function setRecorderProctoringId(id) {
30806
30808
  }
30807
30809
  function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorCallback, audio = false) {
30808
30810
  let resolvePromise;
30809
- let stopped = false;
30810
30811
  let onBufferSizeInterval;
30811
30812
  let lastEvent;
30812
30813
  let bufferSize;
30813
30814
  bufferSize = 0;
30814
30815
  let startTime;
30816
+ let duration = 0;
30815
30817
  let recorderOptions = {
30816
30818
  // eslint-disable-next-line no-useless-escape
30817
30819
  mimeType: "video/webm",
@@ -30848,10 +30850,6 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30848
30850
  if (e3.data.size > 0) {
30849
30851
  buffer.push(e3.data);
30850
30852
  }
30851
- if (stopped) {
30852
- console.log("buildMediaRecorder ondataavailable stopped");
30853
- resolvePromise && resolvePromise();
30854
- }
30855
30853
  };
30856
30854
  return mediaRecorder2;
30857
30855
  }
@@ -30863,6 +30861,7 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30863
30861
  recorder2.onstart = () => {
30864
30862
  started = true;
30865
30863
  console.log("recorder onstart");
30864
+ startTime = new Date(Date.now());
30866
30865
  resolve();
30867
30866
  };
30868
30867
  recorder2.onerror = (ev) => {
@@ -30902,7 +30901,6 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30902
30901
  await startRecorder(mediaRecorder);
30903
30902
  if (mediaRecorder.state === "recording") {
30904
30903
  bufferSize = 0;
30905
- stopped = false;
30906
30904
  return;
30907
30905
  } else {
30908
30906
  console.log("Recorder n\xE3o est\xE1 em estado recording ap\xF3s start");
@@ -30921,9 +30919,13 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30921
30919
  resolvePromise = resolve;
30922
30920
  mediaRecorder.onstop = () => {
30923
30921
  console.log("recorder onstop");
30922
+ const duration2 = Date.now() - startTime.getTime() || 0;
30923
+ console.log("duration no onstop", duration2);
30924
+ resolvePromise && resolvePromise();
30924
30925
  };
30925
- stopped = true;
30926
30926
  mediaRecorder.stop();
30927
+ duration = Date.now() - startTime.getTime() || 0;
30928
+ console.log("duration imediatamente ap\xF3s mediaRecorder.stop()", duration);
30927
30929
  } else {
30928
30930
  console.log("stopRecording Recorder n\xE3o est\xE1 em estado recording");
30929
30931
  resolve();
@@ -30959,6 +30961,9 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30959
30961
  function getStartTime() {
30960
30962
  return startTime;
30961
30963
  }
30964
+ function getDuration() {
30965
+ return duration;
30966
+ }
30962
30967
  return {
30963
30968
  startRecording,
30964
30969
  stopRecording,
@@ -30966,7 +30971,8 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
30966
30971
  resumeRecording,
30967
30972
  recorderOptions,
30968
30973
  getBufferSize,
30969
- getStartTime
30974
+ getStartTime,
30975
+ getDuration
30970
30976
  };
30971
30977
  }
30972
30978
 
@@ -31389,6 +31395,7 @@ var CameraRecorder = class {
31389
31395
  this.internalClonedStream = null;
31390
31396
  this.videoElement = null;
31391
31397
  this.duration = 0;
31398
+ this.stopped = false;
31392
31399
  this.currentRetries = 0;
31393
31400
  this.packageCount = 0;
31394
31401
  this.noiseWait = 20;
@@ -31565,7 +31572,8 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31565
31572
  resumeRecording,
31566
31573
  recorderOptions,
31567
31574
  getBufferSize,
31568
- getStartTime
31575
+ getStartTime,
31576
+ getDuration
31569
31577
  } = recorder(
31570
31578
  this.cameraStream,
31571
31579
  // streamToRecord,
@@ -31581,6 +31589,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31581
31589
  this.recorderOptions = recorderOptions;
31582
31590
  this.getBufferSize = getBufferSize;
31583
31591
  this.getStartTime = getStartTime;
31592
+ this.getDuration = getDuration;
31584
31593
  try {
31585
31594
  await new Promise((r3) => setTimeout(r3, 500));
31586
31595
  await this.recordingStart();
@@ -31596,6 +31605,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31596
31605
  throw error;
31597
31606
  }
31598
31607
  }
31608
+ this.stopped = false;
31599
31609
  if (((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectPerson) || ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectCellPhone) || ((_d = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _d.detectFace)) {
31600
31610
  await this.initializeDetectors();
31601
31611
  }
@@ -31613,8 +31623,9 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31613
31623
  console.log("Camera Recorder started OK");
31614
31624
  }
31615
31625
  async stopRecording() {
31616
- var _a2, _b, _c2, _d;
31626
+ var _a2, _b, _c2;
31617
31627
  console.log("Camera Recorder stopRecording");
31628
+ this.stopped = true;
31618
31629
  this.isCanvasLoopActive = false;
31619
31630
  this.faceDetection && this.faceDetection.detecting && this.faceDetection.stopDetection();
31620
31631
  this.objectDetection && this.objectDetection.detecting && this.objectDetection.stopDetection();
@@ -31623,7 +31634,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31623
31634
  this.volumeMeter && this.volumeMeter.stop();
31624
31635
  this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
31625
31636
  this.recordingStop && await this.recordingStop();
31626
- this.duration = Date.now() - ((_a2 = this.getStartTime()) == null ? void 0 : _a2.getTime()) || 0;
31637
+ this.duration = this.getDuration();
31627
31638
  try {
31628
31639
  if (this.animationFrameId) {
31629
31640
  cancelAnimationFrame(this.animationFrameId);
@@ -31641,14 +31652,14 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31641
31652
  this.hardwareStream = null;
31642
31653
  }
31643
31654
  if (this.videoElement) {
31644
- (_b = this.videoElement) == null ? void 0 : _b.remove();
31655
+ (_a2 = this.videoElement) == null ? void 0 : _a2.remove();
31645
31656
  this.videoElement = null;
31646
31657
  }
31647
31658
  if (this.video) {
31648
- (_c2 = this.video) == null ? void 0 : _c2.remove();
31659
+ (_b = this.video) == null ? void 0 : _b.remove();
31649
31660
  }
31650
31661
  if (this.canvas) {
31651
- (_d = this.canvas) == null ? void 0 : _d.remove();
31662
+ (_c2 = this.canvas) == null ? void 0 : _c2.remove();
31652
31663
  }
31653
31664
  } catch {
31654
31665
  console.error("Erro ao parar os streams de m\xEDdia.");
@@ -31795,7 +31806,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31795
31806
  });
31796
31807
  const fixedBlob = await (0, import_fix_webm_duration.default)(rawBlob, this.duration);
31797
31808
  const file = new File(
31798
- [fixedBlob],
31809
+ [rawBlob],
31799
31810
  `EP_${session.id}_camera_0.webm`,
31800
31811
  { type: rawBlob.type }
31801
31812
  );
@@ -31809,6 +31820,21 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31809
31820
  file,
31810
31821
  origin: "Camera" /* Camera */
31811
31822
  });
31823
+ const fileWithDuration = new File(
31824
+ [fixedBlob],
31825
+ `EP_${session.id}_camera_with_duration.webm`,
31826
+ { type: rawBlob.type }
31827
+ );
31828
+ session.addRecording({
31829
+ device: `Audio
31830
+ Sample Rate: ${settingsAudio.sampleRate}
31831
+ Sample Size: ${settingsAudio.sampleSize}
31832
+
31833
+ Video:
31834
+ ${JSON.stringify(this.recorderOptions)}`,
31835
+ file: fileWithDuration,
31836
+ origin: "Camera" /* Camera */
31837
+ });
31812
31838
  }
31813
31839
  }
31814
31840
  async getFile(file, name, type) {
@@ -37777,6 +37803,7 @@ var Proctoring = class {
37777
37803
  async internalOnRealtimeAlerts(response) {
37778
37804
  if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus")) {
37779
37805
  if (response.status === "ALERT") {
37806
+ if (this.allRecorders.cameraRecorder.stopped) return;
37780
37807
  await this.backend.startRealtimeAlert({
37781
37808
  proctoringId: this.proctoringId,
37782
37809
  begin: response.begin,
@@ -37784,6 +37811,7 @@ var Proctoring = class {
37784
37811
  alert: this.convertRealtimeCategoryToAlertCategory(response.category)
37785
37812
  });
37786
37813
  } else if (response.status === "OK") {
37814
+ if (this.allRecorders.cameraRecorder.stopped && response.description !== "face_stop") return;
37787
37815
  await this.stopRealtimeAlert(response);
37788
37816
  }
37789
37817
  }
@@ -37866,7 +37894,7 @@ var Proctoring = class {
37866
37894
  recorders.push(screenRecorder);
37867
37895
  }
37868
37896
  this.recorder = new ProctoringRecorder(this.proctoringSession, recorders);
37869
- return { cameraRecorder, screenRecorder, alertRecorder, noiseRecorder };
37897
+ return { screenRecorder, alertRecorder, noiseRecorder, cameraRecorder };
37870
37898
  }
37871
37899
  async login() {
37872
37900
  var _a2;
@@ -38,6 +38,7 @@ export declare class CameraRecorder implements IRecorder {
38
38
  private internalClonedStream;
39
39
  private videoElement;
40
40
  private duration;
41
+ stopped: boolean;
41
42
  constructor(options: {
42
43
  cameraId?: string;
43
44
  microphoneId?: string;
@@ -54,6 +55,7 @@ export declare class CameraRecorder implements IRecorder {
54
55
  recordingResume: () => any;
55
56
  getBufferSize: () => any;
56
57
  getStartTime: () => any;
58
+ getDuration: () => any;
57
59
  setProctoringId(proctoringId: string): void;
58
60
  initializeDetectors(): Promise<void>;
59
61
  configImageCapture(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor-hml",
3
- "version": "2.5.37",
3
+ "version": "2.5.39",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -7,4 +7,5 @@ export default function recorder(stream: MediaStream, buffer: Blob[], onBufferSi
7
7
  recorderOptions: MediaRecorderOptions;
8
8
  getBufferSize: () => number;
9
9
  getStartTime: () => Date | undefined;
10
+ getDuration: () => number;
10
11
  };