easyproctor-hml 3.1.0 → 3.2.0

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/README.md CHANGED
@@ -263,6 +263,11 @@ const {
263
263
  token: "...",
264
264
  });
265
265
  ```
266
+ ## Release Note V 3.2.0
267
+ - Fix: melhoria na sincronizacao dos alertas de tela
268
+ - Fix: melhoria no corte do audio para analise
269
+ - Fator de qualidade parametrizavel
270
+ - Alerta de microfone mutado adicionado
266
271
 
267
272
  ## Release Note V 3.0.0
268
273
  - Envio do vídeo por partes durante o exame para o proctoring REALTIME
package/esm/index.js CHANGED
@@ -12695,14 +12695,13 @@ var getDefaultProctoringOptions = {
12695
12695
  captureScreen: true,
12696
12696
  noiseLimit: 40,
12697
12697
  // deprecated
12698
- proctoringType: "IMAGE",
12698
+ proctoringType: "VIDEO",
12699
12699
  insights: "",
12700
12700
  onBufferSizeError: false,
12701
12701
  useGeolocation: false,
12702
12702
  useSpyScan: false,
12703
12703
  useExternalCamera: false,
12704
12704
  useChallenge: false,
12705
- screenRecorderOptions: { width: 1280, height: 720 },
12706
12705
  auto: false
12707
12706
  };
12708
12707
 
@@ -12771,7 +12770,7 @@ var proctoringId;
12771
12770
  function setRecorderProctoringId(id) {
12772
12771
  proctoringId = id;
12773
12772
  }
12774
- function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCallback, audio = false, recorderOpts) {
12773
+ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCallback, recorderOpts) {
12775
12774
  let resolvePromise;
12776
12775
  let onBufferSizeInterval;
12777
12776
  let lastEvent;
@@ -12783,9 +12782,11 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
12783
12782
  let recorderOptions = {
12784
12783
  // eslint-disable-next-line no-useless-escape
12785
12784
  mimeType: "video/webm",
12786
- videoBitsPerSecond: 128e3,
12785
+ videoBitsPerSecond: 25e4 * ((recorderOpts == null ? void 0 : recorderOpts.quality) || 1),
12786
+ // 250Kbps por padrão
12787
12787
  audioBitsPerSecond: 64 * 1e3
12788
12788
  };
12789
+ console.log("recorderOptions", recorderOptions);
12789
12790
  if (MediaRecorder.isTypeSupported("video/webm;codecs=vp9")) {
12790
12791
  recorderOptions.mimeType = "video/webm;codecs=vp9";
12791
12792
  } else {
@@ -12793,12 +12794,6 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
12793
12794
  "vp9 codec not supported. Using default mimeType without vp9."
12794
12795
  );
12795
12796
  }
12796
- if (audio) {
12797
- recorderOptions = {
12798
- mimeType: "audio/webm",
12799
- audioBitsPerSecond: 64 * 1e3
12800
- };
12801
- }
12802
12797
  function buildMediaRecorder(stream2, recorderOptions2) {
12803
12798
  const tracks = stream2.getTracks();
12804
12799
  if (tracks.length == 0) {
@@ -12869,7 +12864,7 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
12869
12864
  console.error("Timeout ao iniciar o recorder");
12870
12865
  reject(new Error("Timeout ao iniciar o recorder"));
12871
12866
  }
12872
- }, 2e3);
12867
+ }, 5e3);
12873
12868
  });
12874
12869
  }
12875
12870
  async function startRecording() {
@@ -13891,29 +13886,20 @@ var _CameraRecorder = class _CameraRecorder {
13891
13886
  recordingBitrate: 128,
13892
13887
  noiseLimit: 40
13893
13888
  },
13894
- imageBehaviourParameters: {
13895
- useUploadImage: true,
13896
- uploadInterval: 20,
13897
- saveVideo: true
13898
- },
13899
13889
  videoBehaviourParameters: {
13900
13890
  detectPerson: false,
13901
13891
  detectFace: false,
13902
- detectCellPhone: false
13892
+ detectCellPhone: false,
13893
+ cameraVideoQuality: 1
13903
13894
  }
13904
13895
  };
13905
- // private imageParams: ImageParameters = {
13906
- // useUploadImage: true,
13907
- // uploadInterval: 20,
13908
- // saveVideo: true
13909
- // };
13910
13896
  this.options = {
13911
13897
  cameraId: void 0,
13912
13898
  microphoneId: void 0,
13913
13899
  onBufferSizeError: false,
13914
13900
  onBufferSizeErrorCallback: (cameraStream) => {
13915
13901
  },
13916
- proctoringType: "IMAGE",
13902
+ proctoringType: "VIDEO",
13917
13903
  onChangeDevicesCallback: (devices) => {
13918
13904
  },
13919
13905
  onRealtimeAlertsCallback: (response) => {
@@ -14220,14 +14206,15 @@ Setting: ${JSON.stringify(settings, null, 2)}`
14220
14206
  await new Promise((r3) => setTimeout(r3, 300));
14221
14207
  }
14222
14208
  async startRecording() {
14223
- var _a2, _b, _c2, _d, _e3, _f, _g, _h;
14209
+ var _a2, _b, _c2, _d, _e3, _f, _g, _h, _i3;
14224
14210
  await this.startStream();
14225
14211
  await this.attachAndWarmup(this.cameraStream);
14226
14212
  const recorderOpts = this.isChunkEnabled ? {
14227
14213
  timeslice: _CameraRecorder.CHUNK_TIMESLICE_MS,
14228
14214
  onChunkAvailable: (blob, idx) => {
14229
14215
  this.handleNewChunk(blob, idx);
14230
- }
14216
+ },
14217
+ quality: (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.cameraVideoQuality
14231
14218
  } : {};
14232
14219
  const {
14233
14220
  startRecording,
@@ -14244,7 +14231,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
14244
14231
  this.blobs,
14245
14232
  this.options.onBufferSizeError,
14246
14233
  (e3) => this.bufferError(e3),
14247
- false,
14248
14234
  recorderOpts
14249
14235
  );
14250
14236
  this.recordingStart = startRecording;
@@ -14257,7 +14243,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
14257
14243
  this.getDuration = getDuration;
14258
14244
  this.chunkIndex = 0;
14259
14245
  if (this.isChunkEnabled) {
14260
- (_a2 = this.backgroundUpload) == null ? void 0 : _a2.start();
14246
+ (_b = this.backgroundUpload) == null ? void 0 : _b.start();
14261
14247
  this.setupLifecycleListeners();
14262
14248
  }
14263
14249
  try {
@@ -14266,7 +14252,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
14266
14252
  } catch (error) {
14267
14253
  console.log("Camera Recorder error", error);
14268
14254
  this.stopRecording();
14269
- const maxRetries = ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.maxRetries) || 3;
14255
+ const maxRetries = ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.maxRetries) || 3;
14270
14256
  if (this.currentRetries < maxRetries) {
14271
14257
  console.log("Camera Recorder retry", this.currentRetries);
14272
14258
  this.currentRetries++;
@@ -14276,13 +14262,13 @@ Setting: ${JSON.stringify(settings, null, 2)}`
14276
14262
  }
14277
14263
  }
14278
14264
  this.stopped = false;
14279
- if (((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectPerson) || ((_d = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _d.detectCellPhone) || ((_e3 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _e3.detectFace)) {
14265
+ if (((_d = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _d.detectPerson) || ((_e3 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _e3.detectCellPhone) || ((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectFace)) {
14280
14266
  await this.initializeDetectors();
14281
14267
  }
14282
- if ((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectFace) {
14268
+ if ((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectFace) {
14283
14269
  await this.faceDetection.enableCam(this.cameraStream);
14284
14270
  }
14285
- if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectPerson) || ((_h = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _h.detectCellPhone)) {
14271
+ if (((_h = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _h.detectPerson) || ((_i3 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _i3.detectCellPhone)) {
14286
14272
  await this.objectDetection.enableCam(this.cameraStream);
14287
14273
  }
14288
14274
  this.filesToUpload = [];
@@ -14517,7 +14503,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
14517
14503
  window.URL.revokeObjectURL(url);
14518
14504
  }
14519
14505
  async saveOnSession(session) {
14520
- var _a2, _b;
14506
+ var _a2;
14521
14507
  if (this.blobs != null)
14522
14508
  trackers.registerSaveOnSession(
14523
14509
  this.proctoringId,
@@ -14525,42 +14511,40 @@ Setting: ${JSON.stringify(settings, null, 2)}`
14525
14511
  );
14526
14512
  const settings = this.cameraStream.getVideoTracks()[0].getSettings();
14527
14513
  const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
14528
- if (this.options.proctoringType == "VIDEO" || this.options.proctoringType == "REALTIME" || this.options.proctoringType == "IMAGE" && ((_a2 = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _a2.saveVideo)) {
14529
- let isUploaded = false;
14530
- if (this.isChunkEnabled) {
14531
- if (this.backend && this.backendToken && this.proctoringId) {
14532
- const fileName = `EP_${this.proctoringId}_camera_0.webm`;
14533
- const objectName = `${this.proctoringId}/${fileName}`;
14534
- isUploaded = await this.backend.checkUpload(this.backendToken, objectName, "video/webm");
14535
- this.chunkStorage && await this.chunkStorage.clearAllChunks(session.id);
14536
- }
14537
- }
14538
- if (!isUploaded) {
14539
- const rawBlob = new Blob(this.blobs, {
14540
- type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
14541
- });
14542
- let finalBlob = rawBlob;
14543
- if (typeof fixWebmDuration === "function") {
14544
- try {
14545
- finalBlob = await fixWebmDuration(rawBlob, this.duration);
14546
- } catch (e3) {
14547
- console.warn("Erro ao corrigir a dura\xE7\xE3o do v\xEDdeo", e3);
14548
- finalBlob = rawBlob;
14549
- }
14550
- } else {
14551
- console.warn("fixWebmDuration n\xE3o dispon\xEDvel");
14514
+ let isUploaded = false;
14515
+ if (this.isChunkEnabled) {
14516
+ if (this.backend && this.backendToken && this.proctoringId) {
14517
+ const fileName = `EP_${this.proctoringId}_camera_0.webm`;
14518
+ const objectName = `${this.proctoringId}/${fileName}`;
14519
+ isUploaded = await this.backend.checkUpload(this.backendToken, objectName, "video/webm");
14520
+ this.chunkStorage && await this.chunkStorage.clearAllChunks(session.id);
14521
+ }
14522
+ }
14523
+ if (!isUploaded) {
14524
+ const rawBlob = new Blob(this.blobs, {
14525
+ type: ((_a2 = this.recorderOptions) == null ? void 0 : _a2.mimeType) || "video/webm"
14526
+ });
14527
+ let finalBlob = rawBlob;
14528
+ if (typeof fixWebmDuration === "function") {
14529
+ try {
14530
+ finalBlob = await fixWebmDuration(rawBlob, this.duration);
14531
+ } catch (e3) {
14532
+ console.warn("Erro ao corrigir a dura\xE7\xE3o do v\xEDdeo", e3);
14533
+ finalBlob = rawBlob;
14552
14534
  }
14553
- session.addRecording({
14554
- device: `Audio
14535
+ } else {
14536
+ console.warn("fixWebmDuration n\xE3o dispon\xEDvel");
14537
+ }
14538
+ session.addRecording({
14539
+ device: `Audio
14555
14540
  Sample Rate: ${settingsAudio.sampleRate}
14556
14541
  Sample Size: ${settingsAudio.sampleSize}
14557
14542
 
14558
14543
  Video:
14559
14544
  ${JSON.stringify(this.recorderOptions)}`,
14560
- arrayBuffer: await finalBlob.arrayBuffer(),
14561
- origin: "Camera" /* Camera */
14562
- });
14563
- }
14545
+ arrayBuffer: await finalBlob.arrayBuffer(),
14546
+ origin: "Camera" /* Camera */
14547
+ });
14564
14548
  }
14565
14549
  }
14566
14550
  async getFile(file, name, type) {
@@ -16745,7 +16729,7 @@ Error: ${e3.message}
16745
16729
 
16746
16730
  // src/new-flow/recorders/AlertRecorder.ts
16747
16731
  var AlertRecorder = class {
16748
- constructor(options, optionsProctoring) {
16732
+ constructor(options, optionsProctoring, screenRecorder) {
16749
16733
  this.alerts = [];
16750
16734
  // Variáveis para controle de inatividade
16751
16735
  this.lastActivityTime = Date.now();
@@ -16761,35 +16745,21 @@ var AlertRecorder = class {
16761
16745
  this.handleLostFocus();
16762
16746
  }
16763
16747
  };
16764
- this.lastLostFocusTime = Date.now();
16748
+ this.isFocused = true;
16765
16749
  this.handleLostFocus = () => {
16766
- if (this.getRelativeTime() > 1e4 && Date.now() - this.lastLostFocusTime > 1e3) {
16767
- const alertPayload = {
16768
- begin: this.getRelativeTime(),
16769
- end: 0,
16770
- alert: 25 /* FocusOff */,
16771
- type: 3 /* Screen */
16772
- };
16773
- this.onLostFocusCallback(alertPayload);
16774
- this.alerts.push(alertPayload);
16775
- this.lastLostFocusTime = Date.now();
16750
+ if (this.screenRecorder && !this.screenRecorder.isRecording) {
16751
+ return;
16752
+ }
16753
+ if (this.getRelativeTime() > 1e4) {
16754
+ this.setFocus(false);
16776
16755
  }
16777
16756
  };
16778
- this.lastReturnFocusTime = Date.now();
16779
16757
  this.handleReturnFocus = () => {
16780
- const diffTime = Date.now() - this.lastReturnFocusTime;
16781
- if (diffTime < 1e3) return;
16782
- const lastAlert = this.alerts[this.alerts.length - 1];
16783
- if (lastAlert) {
16784
- this.onFocusCallback({
16785
- begin: lastAlert.begin,
16786
- end: this.getRelativeTime(),
16787
- alert: 25 /* FocusOff */,
16788
- type: 3 /* Screen */
16789
- });
16790
- lastAlert.end = this.getRelativeTime();
16758
+ if (this.screenRecorder && !this.screenRecorder.isRecording) {
16759
+ return;
16791
16760
  }
16792
- this.lastReturnFocusTime = Date.now();
16761
+ if (this.alerts.length === 0) return;
16762
+ this.setFocus(true);
16793
16763
  };
16794
16764
  // 2. SPLIT SCREEN DETECTION
16795
16765
  this.handleResize = () => {
@@ -16848,6 +16818,7 @@ var AlertRecorder = class {
16848
16818
  this.onFocusCallback = options.onFocusCallback;
16849
16819
  this.onRealtimeAlertCallback = options.onRealtimeAlertCallback;
16850
16820
  this.optionsProctoring = optionsProctoring;
16821
+ this.screenRecorder = screenRecorder;
16851
16822
  }
16852
16823
  async startRecording() {
16853
16824
  this.startTime = new Date(Date.now());
@@ -16891,6 +16862,33 @@ var AlertRecorder = class {
16891
16862
  window.document.removeEventListener("cut", this.handleCut);
16892
16863
  window.document.removeEventListener("paste", this.handlePaste);
16893
16864
  }
16865
+ setFocus(focused) {
16866
+ if (this.isFocused === focused) {
16867
+ return;
16868
+ }
16869
+ this.isFocused = focused;
16870
+ if (focused) {
16871
+ const lastAlert = this.alerts[this.alerts.length - 1];
16872
+ if (lastAlert) {
16873
+ this.onFocusCallback({
16874
+ begin: lastAlert.begin,
16875
+ end: this.getRelativeTime(),
16876
+ alert: 25 /* FocusOff */,
16877
+ type: 3 /* Screen */
16878
+ });
16879
+ lastAlert.end = this.getRelativeTime();
16880
+ }
16881
+ } else {
16882
+ const alertPayload = {
16883
+ begin: this.getRelativeTime(),
16884
+ end: 0,
16885
+ alert: 25 /* FocusOff */,
16886
+ type: 3 /* Screen */
16887
+ };
16888
+ this.onLostFocusCallback(alertPayload);
16889
+ this.alerts.push(alertPayload);
16890
+ }
16891
+ }
16894
16892
  // private startIdleChecker() {
16895
16893
  // this.stopIdleChecker(); // Garante que não tenha duplicação
16896
16894
  // this.idleCheckInterval = setInterval(() => {
@@ -16931,7 +16929,11 @@ var AlertRecorder = class {
16931
16929
  // HELPERS
16932
16930
  // ==========================================
16933
16931
  getRelativeTime() {
16934
- return Date.now() - this.startTime.getTime();
16932
+ var _a2;
16933
+ if (this.screenRecorder) {
16934
+ return Date.now() - (((_a2 = this.screenRecorder.getStartTime()) == null ? void 0 : _a2.getTime()) || 0);
16935
+ }
16936
+ return Date.now() - (this.startTime.getTime() || 0);
16935
16937
  }
16936
16938
  createAlert(category, type, description) {
16937
16939
  this.alerts.push({
@@ -19205,7 +19207,12 @@ var NoiseRecorder = class {
19205
19207
  this.MAX_PRE_ROLL_CHUNKS = 4;
19206
19208
  this.lastNoiseTime = 0;
19207
19209
  this.SILENCE_THRESHOLD = 3e3;
19210
+ this.MAX_RECORD_DURATION = 3e4;
19211
+ // 30 segundos
19208
19212
  this.filesToUpload = [];
19213
+ // logica do mute
19214
+ this.acumulatedMuteTime = 0;
19215
+ this.startMuteTime = 0;
19209
19216
  this.optionsProctoring = optionsProctoring;
19210
19217
  this.proctoringSession = proctoringSession;
19211
19218
  this.paramsConfig = paramsConfig;
@@ -19240,7 +19247,7 @@ var NoiseRecorder = class {
19240
19247
  async saveOnSession(session) {
19241
19248
  }
19242
19249
  async onNoiseDetectedRecord() {
19243
- var _a2, _b, _c2, _d, _e3, _f, _g, _h, _i3;
19250
+ var _a2, _b, _c2, _d, _e3, _f, _g, _h, _i3, _j, _k, _l;
19244
19251
  if (!this.volumeMeter && this.cameraRecorder.cameraStream) {
19245
19252
  this.volumeMeter = new VolumeMeter(this.cameraRecorder.cameraStream);
19246
19253
  this.volumeMeter.start().catch((e3) => {
@@ -19250,6 +19257,25 @@ var NoiseRecorder = class {
19250
19257
  }
19251
19258
  let noiseLimit = ((_a2 = this.paramsConfig.audioBehaviourParameters) == null ? void 0 : _a2.noiseLimit) || 40;
19252
19259
  const currentVolume = ((_b = this.volumeMeter) == null ? void 0 : _b.getVolume()) || 0;
19260
+ if (this.optionsProctoring.proctoringType == "REALTIME") {
19261
+ let muteThreshold = ((_c2 = this.paramsConfig.audioBehaviourParameters) == null ? void 0 : _c2.muteThreshold) || 60;
19262
+ if (currentVolume == 0) {
19263
+ if (this.acumulatedMuteTime == 0) this.startMuteTime = Date.now() - (((_d = this.cameraRecorder.getStartTime()) == null ? void 0 : _d.getTime()) || 0);
19264
+ this.acumulatedMuteTime = this.acumulatedMuteTime + 200;
19265
+ } else
19266
+ this.acumulatedMuteTime = 0;
19267
+ if (this.acumulatedMuteTime / 1e3 >= muteThreshold) {
19268
+ this.acumulatedMuteTime = 0;
19269
+ this.onRealtimeAlertsCallback({
19270
+ begin: this.startMuteTime,
19271
+ end: Date.now() - (((_e3 = this.cameraRecorder.getStartTime()) == null ? void 0 : _e3.getTime()) || 0),
19272
+ status: "ALERT",
19273
+ description: "Microfone mutado",
19274
+ type: "audio_muted_on_stream",
19275
+ category: "audio_muted_on_stream"
19276
+ });
19277
+ }
19278
+ }
19253
19279
  this.isSpeech = this.isSpeech || this.hasDesiredResult(this.audioClassificationResult);
19254
19280
  if (!this.isSpeech && !this.recordingInProgress)
19255
19281
  noiseLimit = noiseLimit * 1.25;
@@ -19262,27 +19288,28 @@ var NoiseRecorder = class {
19262
19288
  this.recordingChunks = [...this.preRollBuffer];
19263
19289
  const totalSamplesInBuffer = this.preRollBuffer.reduce((acc, chunk) => acc + chunk.length, 0);
19264
19290
  const bufferDurationMs = totalSamplesInBuffer / this.SAMPLE_RATE * 1e3;
19265
- const triggerTime = Date.now() - (((_c2 = this.cameraRecorder.getStartTime()) == null ? void 0 : _c2.getTime()) || 0);
19291
+ const triggerTime = Date.now() - (((_f = this.cameraRecorder.getStartTime()) == null ? void 0 : _f.getTime()) || 0);
19266
19292
  this.recordingStartTime = triggerTime - bufferDurationMs;
19267
19293
  if (this.recordingStartTime < 0) this.recordingStartTime = 0;
19268
19294
  } else if (this.recordingInProgress) {
19269
19295
  const silenceDuration = Date.now() - this.lastNoiseTime;
19270
19296
  const currentRecordDuration = Date.now() - this.recordingStartTime;
19271
- if (silenceDuration >= this.SILENCE_THRESHOLD && currentRecordDuration >= 3e3 && this.countLoopTimes > 4) {
19297
+ const isMaxDurationReached = currentRecordDuration >= this.MAX_RECORD_DURATION;
19298
+ if (silenceDuration >= this.SILENCE_THRESHOLD && currentRecordDuration >= 3e3 && this.countLoopTimes > 4 || isMaxDurationReached) {
19272
19299
  await this.stopSoundRecord();
19273
- if (((_d = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _d.detectNoise) && !this.isSpeech) {
19300
+ if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectNoise) && !this.isSpeech) {
19274
19301
  this.onRealtimeAlertsCallback({
19275
- begin: Date.now() - (((_e3 = this.cameraRecorder.getStartTime()) == null ? void 0 : _e3.getTime()) || 0),
19276
- end: Date.now() - (((_f = this.cameraRecorder.getStartTime()) == null ? void 0 : _f.getTime()) || 0),
19302
+ begin: Date.now() - (((_h = this.cameraRecorder.getStartTime()) == null ? void 0 : _h.getTime()) || 0),
19303
+ end: Date.now() - (((_i3 = this.cameraRecorder.getStartTime()) == null ? void 0 : _i3.getTime()) || 0),
19277
19304
  status: "ALERT",
19278
19305
  description: "Barulho detectado",
19279
19306
  type: "audio_detection_on_stream"
19280
19307
  });
19281
19308
  }
19282
- if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectSpeech) && this.isSpeech) {
19309
+ if (((_j = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _j.detectSpeech) && this.isSpeech) {
19283
19310
  this.onRealtimeAlertsCallback({
19284
- begin: Date.now() - (((_h = this.cameraRecorder.getStartTime()) == null ? void 0 : _h.getTime()) || 0),
19285
- end: Date.now() - (((_i3 = this.cameraRecorder.getStartTime()) == null ? void 0 : _i3.getTime()) || 0),
19311
+ begin: Date.now() - (((_k = this.cameraRecorder.getStartTime()) == null ? void 0 : _k.getTime()) || 0),
19312
+ end: Date.now() - (((_l = this.cameraRecorder.getStartTime()) == null ? void 0 : _l.getTime()) || 0),
19286
19313
  status: "ALERT",
19287
19314
  description: "Fala detectada",
19288
19315
  type: "audio_detection_on_stream"
@@ -19460,10 +19487,28 @@ registerProcessor("audio-processor", AudioProcessor);
19460
19487
  var pkg2 = require_fix_webm_duration();
19461
19488
  var fixWebmDuration2 = pkg2.default || pkg2;
19462
19489
  var ScreenRecorder = class {
19463
- constructor(options) {
19490
+ constructor(options, videoOptions, paramsConfig) {
19464
19491
  this.blobs = [];
19465
19492
  this.blobsFinal = [];
19493
+ this.isRecording = false;
19466
19494
  this.duration = 0;
19495
+ this.videoOptions = {
19496
+ width: 640,
19497
+ height: 480,
19498
+ minWidth: 0,
19499
+ minHeight: 0
19500
+ };
19501
+ this.paramsConfig = {
19502
+ audioBehaviourParameters: {
19503
+ recordingBitrate: 128,
19504
+ noiseLimit: 40
19505
+ },
19506
+ videoBehaviourParameters: {
19507
+ screenVideoQuality: 3
19508
+ }
19509
+ };
19510
+ paramsConfig && (this.paramsConfig = paramsConfig);
19511
+ this.videoOptions = videoOptions;
19467
19512
  this.options = options;
19468
19513
  }
19469
19514
  setProctoringId(proctoringId2) {
@@ -19471,15 +19516,16 @@ var ScreenRecorder = class {
19471
19516
  setRecorderProctoringId(proctoringId2);
19472
19517
  }
19473
19518
  async startRecording() {
19474
- this.startTime = new Date(Date.now());
19519
+ var _a2;
19475
19520
  if (isMobileDevice()) return;
19476
19521
  const { allowOnlyFirstMonitor, allowMultipleMonitors, onStopSharingScreenCallback, onBufferSizeErrorCallback } = this.options;
19477
19522
  const complexConstraints = {
19478
19523
  video: {
19479
19524
  cursor: "always",
19480
- width: this.options.screenRecorderOptions.width,
19481
- height: this.options.screenRecorderOptions.height,
19482
- displaySurface: "monitor"
19525
+ width: this.videoOptions.width,
19526
+ height: this.videoOptions.height,
19527
+ displaySurface: "monitor",
19528
+ frameRate: 15
19483
19529
  },
19484
19530
  audio: false
19485
19531
  };
@@ -19535,10 +19581,24 @@ var ScreenRecorder = class {
19535
19581
  });
19536
19582
  throw NOT_SHARED_SCREEN;
19537
19583
  }
19538
- const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs, this.options.onBufferSizeError, onBufferSizeErrorCallback);
19584
+ const {
19585
+ startRecording,
19586
+ stopRecording,
19587
+ getStartTime,
19588
+ getDuration
19589
+ } = recorder(
19590
+ this.screenStream,
19591
+ this.blobs,
19592
+ this.options.onBufferSizeError,
19593
+ onBufferSizeErrorCallback,
19594
+ { quality: (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.screenVideoQuality }
19595
+ );
19539
19596
  this.recordingStart = startRecording;
19540
19597
  this.recordingStop = stopRecording;
19598
+ this.getStartTime = getStartTime;
19599
+ this.getDuration = getDuration;
19541
19600
  this.recordingStart();
19601
+ this.isRecording = true;
19542
19602
  }
19543
19603
  async pauseRecording() {
19544
19604
  }
@@ -19548,6 +19608,7 @@ var ScreenRecorder = class {
19548
19608
  var _a2;
19549
19609
  this.recordingStop && await this.recordingStop();
19550
19610
  this.duration = Date.now() - ((_a2 = this.startTime) == null ? void 0 : _a2.getTime()) || 0;
19611
+ this.isRecording = false;
19551
19612
  }
19552
19613
  async saveOnSession(session) {
19553
19614
  if (isMobileDevice()) return;
@@ -23370,11 +23431,6 @@ var Proctoring = class {
23370
23431
  recordingBitrate: 128,
23371
23432
  noiseLimit: 40
23372
23433
  },
23373
- imageBehaviourParameters: {
23374
- useUploadImage: true,
23375
- uploadInterval: 20,
23376
- saveVideo: true
23377
- },
23378
23434
  videoBehaviourParameters: {
23379
23435
  detectFace: false,
23380
23436
  detectPerson: false,
@@ -23382,7 +23438,9 @@ var Proctoring = class {
23382
23438
  detectNoise: false,
23383
23439
  detectSpeech: false,
23384
23440
  realtimePackageSize: 10,
23385
- realtimeCaptureInterval: 2
23441
+ realtimeCaptureInterval: 2,
23442
+ cameraVideoQuality: 1,
23443
+ screenVideoQuality: 4
23386
23444
  }
23387
23445
  };
23388
23446
  this.proctoringId = "";
@@ -23518,6 +23576,8 @@ var Proctoring = class {
23518
23576
  return 25 /* FocusOff */;
23519
23577
  case "error_upload_package":
23520
23578
  return 44 /* RealtimeOffline */;
23579
+ case "audio_muted_on_stream":
23580
+ return 95 /* NoAudioFound */;
23521
23581
  default:
23522
23582
  return null;
23523
23583
  }
@@ -23581,7 +23641,7 @@ var Proctoring = class {
23581
23641
  }
23582
23642
  }
23583
23643
  async internalOnRealtimeAlerts(response) {
23584
- if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus" || response.type === "error_upload_package")) {
23644
+ if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus" || response.type === "error_upload_package" || response.type === "audio_muted_on_stream")) {
23585
23645
  await this.sendPendingRealtimeAlerts();
23586
23646
  if (response.status === "ALERT") {
23587
23647
  if (this.allRecorders.cameraRecorder.stopped) return;
@@ -23655,18 +23715,18 @@ var Proctoring = class {
23655
23715
  const screenRecorder = this.sessionOptions.captureScreen ? new ScreenRecorder({
23656
23716
  allowOnlyFirstMonitor: (_b = this.sessionOptions.allowOnlyFirstMonitor) != null ? _b : true,
23657
23717
  allowMultipleMonitors: (_c2 = this.sessionOptions.allowMultipleMonitors) != null ? _c2 : true,
23658
- screenRecorderOptions: this.sessionOptions.screenRecorderOptions,
23659
23718
  onStopSharingScreenCallback: () => this.onStopSharingScreenCallback(),
23660
23719
  onBufferSizeError: this.sessionOptions.onBufferSizeError,
23661
23720
  onBufferSizeErrorCallback: () => this.onBufferSizeErrorCallback()
23662
- }) : void 0;
23721
+ }, this.videoOptions, this.paramsConfig) : void 0;
23663
23722
  const alertRecorder = new AlertRecorder(
23664
23723
  {
23665
23724
  onFocusCallback: (response) => this.onFocusAlertRecorderCallback(response),
23666
23725
  onLostFocusCallback: (response) => this.onLostFocusAlertRecorderCallback(response),
23667
23726
  onRealtimeAlertCallback: (response) => this.onRealtimeAlertsCallback(response)
23668
23727
  },
23669
- options
23728
+ options,
23729
+ screenRecorder
23670
23730
  );
23671
23731
  const noiseRecorder = new NoiseRecorder(
23672
23732
  options,
@@ -23850,9 +23910,7 @@ Error: ${error}`
23850
23910
  this.appChecker && await this.appChecker.disconnectWebSocket();
23851
23911
  await this.recorder.saveAllOnSession();
23852
23912
  await this.sendPendingRealtimeAlerts();
23853
- trackers.registerError(this.proctoringId, `finish this.repository.save starting`);
23854
23913
  await this.repository.save(this.proctoringSession);
23855
- trackers.registerError(this.proctoringId, `finish this.repository.save finished`);
23856
23914
  let uploader;
23857
23915
  let uploaderServices;
23858
23916
  if (versionVerify() !== "1.0.0.0") {
@@ -24006,10 +24064,6 @@ Error: ` + error
24006
24064
  ...this.paramsConfig.audioBehaviourParameters,
24007
24065
  ...paramsConfig.audioBehaviourParameters
24008
24066
  },
24009
- imageBehaviourParameters: {
24010
- ...this.paramsConfig.imageBehaviourParameters,
24011
- ...paramsConfig.imageBehaviourParameters
24012
- },
24013
24067
  videoBehaviourParameters: {
24014
24068
  ...this.paramsConfig.videoBehaviourParameters,
24015
24069
  ...paramsConfig.videoBehaviourParameters