easyproctor-hml 3.1.0 → 3.2.1
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 +38 -0
- package/esm/index.js +175 -119
- package/index.js +175 -119
- package/interfaces/ParamsConfig.d.ts +4 -6
- package/new-flow/proctoring/ProctoringSession.d.ts +1 -0
- package/new-flow/recorders/AlertRecorder.d.ts +5 -3
- package/new-flow/recorders/CameraRecorder.d.ts +1 -1
- package/new-flow/recorders/NoiseRecorder.d.ts +3 -0
- package/new-flow/recorders/ScreenRecorder.d.ts +8 -5
- package/package.json +1 -1
- package/plugins/recorder.d.ts +3 -1
- package/proctoring/options/ProctoringOptions.d.ts +1 -5
- package/unpkg/easyproctor.min.js +30 -30
package/README.md
CHANGED
|
@@ -264,11 +264,24 @@ const {
|
|
|
264
264
|
});
|
|
265
265
|
```
|
|
266
266
|
|
|
267
|
+
## Release Note V 3.2.0
|
|
268
|
+
- Fix: melhoria na sincronizacao dos alertas de tela
|
|
269
|
+
- Fix: melhoria no corte do audio para analise
|
|
270
|
+
- Fator de qualidade parametrizavel
|
|
271
|
+
- Alerta de microfone mutado adicionado
|
|
272
|
+
|
|
273
|
+
## Release Note V 3.1.0
|
|
274
|
+
- Fix: tratamento para ignorar bug do import pacote fix-webm-duration
|
|
275
|
+
- Analise da tela para capturar uso de ferramenta de captura de tela
|
|
276
|
+
|
|
267
277
|
## Release Note V 3.0.0
|
|
268
278
|
- Envio do vídeo por partes durante o exame para o proctoring REALTIME
|
|
269
279
|
- Fix: correção do bug do import pacote fix-webm-duration
|
|
270
280
|
- Possibilidade de check automático no check devices através do parametro 'auto'
|
|
271
281
|
|
|
282
|
+
## Release Note V 2.7.1
|
|
283
|
+
- Fix: removendo envio do video por incompatibilidade no iOS
|
|
284
|
+
|
|
272
285
|
## Release Note V 2.7.0
|
|
273
286
|
- Implementação da comunicação com a API para o proctoring do tipo realtime
|
|
274
287
|
- Envio do vídeo durante o exame
|
|
@@ -298,6 +311,31 @@ const {
|
|
|
298
311
|
- Melhorias de performance
|
|
299
312
|
- Ajuste Realtime para PC
|
|
300
313
|
|
|
314
|
+
## Release Note V 2.5.5
|
|
315
|
+
- Fix: Correção de bug de rotação do realtime
|
|
316
|
+
|
|
317
|
+
## Release Note V 2.6.0
|
|
318
|
+
- Implementação da comunicação entre componente e navegador seguro
|
|
319
|
+
|
|
320
|
+
## Release Note V 2.5.8
|
|
321
|
+
- removendo fechamento do webm com a duração para refinamento
|
|
322
|
+
|
|
323
|
+
## Release Note V 2.5.7
|
|
324
|
+
- Ajustes na verificação biometrica
|
|
325
|
+
- Estrategia de erro no upload final do video
|
|
326
|
+
- Fechando webm com a duração
|
|
327
|
+
- Ajustes na finalização da sessao para evitar alertas após o encerramento do stream
|
|
328
|
+
- Ajuste no onRealtimeAlerts
|
|
329
|
+
|
|
330
|
+
## Release Note V 2.5.6
|
|
331
|
+
- Novo método de gravação com tratamento de retry
|
|
332
|
+
- Ajuste parametrização do realtime
|
|
333
|
+
- Ajuste de sincronização dos alertas de acordo com a gravação
|
|
334
|
+
- Separação da visualização do stream (checkDevices e capturePhoto) da gravação
|
|
335
|
+
- Melhorias de performance
|
|
336
|
+
- Ajuste Realtime para PC
|
|
337
|
+
|
|
338
|
+
|
|
301
339
|
## Release Note V 2.5.5
|
|
302
340
|
- Fix: Correção de bug de rotação do realtime
|
|
303
341
|
|
package/esm/index.js
CHANGED
|
@@ -12695,14 +12695,13 @@ var getDefaultProctoringOptions = {
|
|
|
12695
12695
|
captureScreen: true,
|
|
12696
12696
|
noiseLimit: 40,
|
|
12697
12697
|
// deprecated
|
|
12698
|
-
proctoringType: "
|
|
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,
|
|
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:
|
|
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
|
-
},
|
|
12867
|
+
}, 1e4 * ((recorderOpts == null ? void 0 : recorderOpts.timeoutMultiplierFactor) || 1));
|
|
12873
12868
|
});
|
|
12874
12869
|
}
|
|
12875
12870
|
async function startRecording() {
|
|
@@ -13891,29 +13886,21 @@ 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,
|
|
13894
|
+
timeoutMultiplierFactor: 1
|
|
13903
13895
|
}
|
|
13904
13896
|
};
|
|
13905
|
-
// private imageParams: ImageParameters = {
|
|
13906
|
-
// useUploadImage: true,
|
|
13907
|
-
// uploadInterval: 20,
|
|
13908
|
-
// saveVideo: true
|
|
13909
|
-
// };
|
|
13910
13897
|
this.options = {
|
|
13911
13898
|
cameraId: void 0,
|
|
13912
13899
|
microphoneId: void 0,
|
|
13913
13900
|
onBufferSizeError: false,
|
|
13914
13901
|
onBufferSizeErrorCallback: (cameraStream) => {
|
|
13915
13902
|
},
|
|
13916
|
-
proctoringType: "
|
|
13903
|
+
proctoringType: "VIDEO",
|
|
13917
13904
|
onChangeDevicesCallback: (devices) => {
|
|
13918
13905
|
},
|
|
13919
13906
|
onRealtimeAlertsCallback: (response) => {
|
|
@@ -14220,14 +14207,16 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
14220
14207
|
await new Promise((r3) => setTimeout(r3, 300));
|
|
14221
14208
|
}
|
|
14222
14209
|
async startRecording() {
|
|
14223
|
-
var _a2, _b, _c2, _d, _e3, _f, _g, _h;
|
|
14210
|
+
var _a2, _b, _c2, _d, _e3, _f, _g, _h, _i3, _j;
|
|
14224
14211
|
await this.startStream();
|
|
14225
14212
|
await this.attachAndWarmup(this.cameraStream);
|
|
14226
14213
|
const recorderOpts = this.isChunkEnabled ? {
|
|
14227
14214
|
timeslice: _CameraRecorder.CHUNK_TIMESLICE_MS,
|
|
14228
14215
|
onChunkAvailable: (blob, idx) => {
|
|
14229
14216
|
this.handleNewChunk(blob, idx);
|
|
14230
|
-
}
|
|
14217
|
+
},
|
|
14218
|
+
quality: (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.cameraVideoQuality,
|
|
14219
|
+
timeoutMultiplierFactor: ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.timeoutMultiplierFactor) || 1
|
|
14231
14220
|
} : {};
|
|
14232
14221
|
const {
|
|
14233
14222
|
startRecording,
|
|
@@ -14244,7 +14233,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
14244
14233
|
this.blobs,
|
|
14245
14234
|
this.options.onBufferSizeError,
|
|
14246
14235
|
(e3) => this.bufferError(e3),
|
|
14247
|
-
false,
|
|
14248
14236
|
recorderOpts
|
|
14249
14237
|
);
|
|
14250
14238
|
this.recordingStart = startRecording;
|
|
@@ -14257,7 +14245,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
14257
14245
|
this.getDuration = getDuration;
|
|
14258
14246
|
this.chunkIndex = 0;
|
|
14259
14247
|
if (this.isChunkEnabled) {
|
|
14260
|
-
(
|
|
14248
|
+
(_c2 = this.backgroundUpload) == null ? void 0 : _c2.start();
|
|
14261
14249
|
this.setupLifecycleListeners();
|
|
14262
14250
|
}
|
|
14263
14251
|
try {
|
|
@@ -14266,7 +14254,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
14266
14254
|
} catch (error) {
|
|
14267
14255
|
console.log("Camera Recorder error", error);
|
|
14268
14256
|
this.stopRecording();
|
|
14269
|
-
const maxRetries = ((
|
|
14257
|
+
const maxRetries = ((_d = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _d.maxRetries) || 3;
|
|
14270
14258
|
if (this.currentRetries < maxRetries) {
|
|
14271
14259
|
console.log("Camera Recorder retry", this.currentRetries);
|
|
14272
14260
|
this.currentRetries++;
|
|
@@ -14276,13 +14264,13 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
14276
14264
|
}
|
|
14277
14265
|
}
|
|
14278
14266
|
this.stopped = false;
|
|
14279
|
-
if (((
|
|
14267
|
+
if (((_e3 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _e3.detectPerson) || ((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectCellPhone) || ((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectFace)) {
|
|
14280
14268
|
await this.initializeDetectors();
|
|
14281
14269
|
}
|
|
14282
|
-
if ((
|
|
14270
|
+
if ((_h = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _h.detectFace) {
|
|
14283
14271
|
await this.faceDetection.enableCam(this.cameraStream);
|
|
14284
14272
|
}
|
|
14285
|
-
if (((
|
|
14273
|
+
if (((_i3 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _i3.detectPerson) || ((_j = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _j.detectCellPhone)) {
|
|
14286
14274
|
await this.objectDetection.enableCam(this.cameraStream);
|
|
14287
14275
|
}
|
|
14288
14276
|
this.filesToUpload = [];
|
|
@@ -14517,7 +14505,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
14517
14505
|
window.URL.revokeObjectURL(url);
|
|
14518
14506
|
}
|
|
14519
14507
|
async saveOnSession(session) {
|
|
14520
|
-
var _a2
|
|
14508
|
+
var _a2;
|
|
14521
14509
|
if (this.blobs != null)
|
|
14522
14510
|
trackers.registerSaveOnSession(
|
|
14523
14511
|
this.proctoringId,
|
|
@@ -14525,42 +14513,40 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
14525
14513
|
);
|
|
14526
14514
|
const settings = this.cameraStream.getVideoTracks()[0].getSettings();
|
|
14527
14515
|
const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
if (this.
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
|
|
14548
|
-
finalBlob = rawBlob;
|
|
14549
|
-
}
|
|
14550
|
-
} else {
|
|
14551
|
-
console.warn("fixWebmDuration n\xE3o dispon\xEDvel");
|
|
14516
|
+
let isUploaded = false;
|
|
14517
|
+
if (this.isChunkEnabled) {
|
|
14518
|
+
if (this.backend && this.backendToken && this.proctoringId) {
|
|
14519
|
+
const fileName = `EP_${this.proctoringId}_camera_0.webm`;
|
|
14520
|
+
const objectName = `${this.proctoringId}/${fileName}`;
|
|
14521
|
+
isUploaded = await this.backend.checkUpload(this.backendToken, objectName, "video/webm");
|
|
14522
|
+
this.chunkStorage && await this.chunkStorage.clearAllChunks(session.id);
|
|
14523
|
+
}
|
|
14524
|
+
}
|
|
14525
|
+
if (!isUploaded) {
|
|
14526
|
+
const rawBlob = new Blob(this.blobs, {
|
|
14527
|
+
type: ((_a2 = this.recorderOptions) == null ? void 0 : _a2.mimeType) || "video/webm"
|
|
14528
|
+
});
|
|
14529
|
+
let finalBlob = rawBlob;
|
|
14530
|
+
if (typeof fixWebmDuration === "function") {
|
|
14531
|
+
try {
|
|
14532
|
+
finalBlob = await fixWebmDuration(rawBlob, this.duration);
|
|
14533
|
+
} catch (e3) {
|
|
14534
|
+
console.warn("Erro ao corrigir a dura\xE7\xE3o do v\xEDdeo", e3);
|
|
14535
|
+
finalBlob = rawBlob;
|
|
14552
14536
|
}
|
|
14553
|
-
|
|
14554
|
-
|
|
14537
|
+
} else {
|
|
14538
|
+
console.warn("fixWebmDuration n\xE3o dispon\xEDvel");
|
|
14539
|
+
}
|
|
14540
|
+
session.addRecording({
|
|
14541
|
+
device: `Audio
|
|
14555
14542
|
Sample Rate: ${settingsAudio.sampleRate}
|
|
14556
14543
|
Sample Size: ${settingsAudio.sampleSize}
|
|
14557
14544
|
|
|
14558
14545
|
Video:
|
|
14559
14546
|
${JSON.stringify(this.recorderOptions)}`,
|
|
14560
|
-
|
|
14561
|
-
|
|
14562
|
-
|
|
14563
|
-
}
|
|
14547
|
+
arrayBuffer: await finalBlob.arrayBuffer(),
|
|
14548
|
+
origin: "Camera" /* Camera */
|
|
14549
|
+
});
|
|
14564
14550
|
}
|
|
14565
14551
|
}
|
|
14566
14552
|
async getFile(file, name, type) {
|
|
@@ -16745,7 +16731,7 @@ Error: ${e3.message}
|
|
|
16745
16731
|
|
|
16746
16732
|
// src/new-flow/recorders/AlertRecorder.ts
|
|
16747
16733
|
var AlertRecorder = class {
|
|
16748
|
-
constructor(options, optionsProctoring) {
|
|
16734
|
+
constructor(options, optionsProctoring, screenRecorder) {
|
|
16749
16735
|
this.alerts = [];
|
|
16750
16736
|
// Variáveis para controle de inatividade
|
|
16751
16737
|
this.lastActivityTime = Date.now();
|
|
@@ -16761,35 +16747,21 @@ var AlertRecorder = class {
|
|
|
16761
16747
|
this.handleLostFocus();
|
|
16762
16748
|
}
|
|
16763
16749
|
};
|
|
16764
|
-
this.
|
|
16750
|
+
this.isFocused = true;
|
|
16765
16751
|
this.handleLostFocus = () => {
|
|
16766
|
-
if (this.
|
|
16767
|
-
|
|
16768
|
-
|
|
16769
|
-
|
|
16770
|
-
|
|
16771
|
-
type: 3 /* Screen */
|
|
16772
|
-
};
|
|
16773
|
-
this.onLostFocusCallback(alertPayload);
|
|
16774
|
-
this.alerts.push(alertPayload);
|
|
16775
|
-
this.lastLostFocusTime = Date.now();
|
|
16752
|
+
if (this.screenRecorder && !this.screenRecorder.isRecording) {
|
|
16753
|
+
return;
|
|
16754
|
+
}
|
|
16755
|
+
if (this.getRelativeTime() > 1e4) {
|
|
16756
|
+
this.setFocus(false);
|
|
16776
16757
|
}
|
|
16777
16758
|
};
|
|
16778
|
-
this.lastReturnFocusTime = Date.now();
|
|
16779
16759
|
this.handleReturnFocus = () => {
|
|
16780
|
-
|
|
16781
|
-
|
|
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();
|
|
16760
|
+
if (this.screenRecorder && !this.screenRecorder.isRecording) {
|
|
16761
|
+
return;
|
|
16791
16762
|
}
|
|
16792
|
-
this.
|
|
16763
|
+
if (this.alerts.length === 0) return;
|
|
16764
|
+
this.setFocus(true);
|
|
16793
16765
|
};
|
|
16794
16766
|
// 2. SPLIT SCREEN DETECTION
|
|
16795
16767
|
this.handleResize = () => {
|
|
@@ -16848,6 +16820,7 @@ var AlertRecorder = class {
|
|
|
16848
16820
|
this.onFocusCallback = options.onFocusCallback;
|
|
16849
16821
|
this.onRealtimeAlertCallback = options.onRealtimeAlertCallback;
|
|
16850
16822
|
this.optionsProctoring = optionsProctoring;
|
|
16823
|
+
this.screenRecorder = screenRecorder;
|
|
16851
16824
|
}
|
|
16852
16825
|
async startRecording() {
|
|
16853
16826
|
this.startTime = new Date(Date.now());
|
|
@@ -16891,6 +16864,33 @@ var AlertRecorder = class {
|
|
|
16891
16864
|
window.document.removeEventListener("cut", this.handleCut);
|
|
16892
16865
|
window.document.removeEventListener("paste", this.handlePaste);
|
|
16893
16866
|
}
|
|
16867
|
+
setFocus(focused) {
|
|
16868
|
+
if (this.isFocused === focused) {
|
|
16869
|
+
return;
|
|
16870
|
+
}
|
|
16871
|
+
this.isFocused = focused;
|
|
16872
|
+
if (focused) {
|
|
16873
|
+
const lastAlert = this.alerts[this.alerts.length - 1];
|
|
16874
|
+
if (lastAlert) {
|
|
16875
|
+
this.onFocusCallback({
|
|
16876
|
+
begin: lastAlert.begin,
|
|
16877
|
+
end: this.getRelativeTime(),
|
|
16878
|
+
alert: 25 /* FocusOff */,
|
|
16879
|
+
type: 3 /* Screen */
|
|
16880
|
+
});
|
|
16881
|
+
lastAlert.end = this.getRelativeTime();
|
|
16882
|
+
}
|
|
16883
|
+
} else {
|
|
16884
|
+
const alertPayload = {
|
|
16885
|
+
begin: this.getRelativeTime(),
|
|
16886
|
+
end: 0,
|
|
16887
|
+
alert: 25 /* FocusOff */,
|
|
16888
|
+
type: 3 /* Screen */
|
|
16889
|
+
};
|
|
16890
|
+
this.onLostFocusCallback(alertPayload);
|
|
16891
|
+
this.alerts.push(alertPayload);
|
|
16892
|
+
}
|
|
16893
|
+
}
|
|
16894
16894
|
// private startIdleChecker() {
|
|
16895
16895
|
// this.stopIdleChecker(); // Garante que não tenha duplicação
|
|
16896
16896
|
// this.idleCheckInterval = setInterval(() => {
|
|
@@ -16931,7 +16931,11 @@ var AlertRecorder = class {
|
|
|
16931
16931
|
// HELPERS
|
|
16932
16932
|
// ==========================================
|
|
16933
16933
|
getRelativeTime() {
|
|
16934
|
-
|
|
16934
|
+
var _a2;
|
|
16935
|
+
if (this.screenRecorder) {
|
|
16936
|
+
return Date.now() - (((_a2 = this.screenRecorder.getStartTime()) == null ? void 0 : _a2.getTime()) || 0);
|
|
16937
|
+
}
|
|
16938
|
+
return Date.now() - (this.startTime.getTime() || 0);
|
|
16935
16939
|
}
|
|
16936
16940
|
createAlert(category, type, description) {
|
|
16937
16941
|
this.alerts.push({
|
|
@@ -19205,7 +19209,12 @@ var NoiseRecorder = class {
|
|
|
19205
19209
|
this.MAX_PRE_ROLL_CHUNKS = 4;
|
|
19206
19210
|
this.lastNoiseTime = 0;
|
|
19207
19211
|
this.SILENCE_THRESHOLD = 3e3;
|
|
19212
|
+
this.MAX_RECORD_DURATION = 3e4;
|
|
19213
|
+
// 30 segundos
|
|
19208
19214
|
this.filesToUpload = [];
|
|
19215
|
+
// logica do mute
|
|
19216
|
+
this.acumulatedMuteTime = 0;
|
|
19217
|
+
this.startMuteTime = 0;
|
|
19209
19218
|
this.optionsProctoring = optionsProctoring;
|
|
19210
19219
|
this.proctoringSession = proctoringSession;
|
|
19211
19220
|
this.paramsConfig = paramsConfig;
|
|
@@ -19240,7 +19249,7 @@ var NoiseRecorder = class {
|
|
|
19240
19249
|
async saveOnSession(session) {
|
|
19241
19250
|
}
|
|
19242
19251
|
async onNoiseDetectedRecord() {
|
|
19243
|
-
var _a2, _b, _c2, _d, _e3, _f, _g, _h, _i3;
|
|
19252
|
+
var _a2, _b, _c2, _d, _e3, _f, _g, _h, _i3, _j, _k, _l;
|
|
19244
19253
|
if (!this.volumeMeter && this.cameraRecorder.cameraStream) {
|
|
19245
19254
|
this.volumeMeter = new VolumeMeter(this.cameraRecorder.cameraStream);
|
|
19246
19255
|
this.volumeMeter.start().catch((e3) => {
|
|
@@ -19250,6 +19259,25 @@ var NoiseRecorder = class {
|
|
|
19250
19259
|
}
|
|
19251
19260
|
let noiseLimit = ((_a2 = this.paramsConfig.audioBehaviourParameters) == null ? void 0 : _a2.noiseLimit) || 40;
|
|
19252
19261
|
const currentVolume = ((_b = this.volumeMeter) == null ? void 0 : _b.getVolume()) || 0;
|
|
19262
|
+
if (this.optionsProctoring.proctoringType == "REALTIME") {
|
|
19263
|
+
let muteThreshold = ((_c2 = this.paramsConfig.audioBehaviourParameters) == null ? void 0 : _c2.muteThreshold) || 60;
|
|
19264
|
+
if (currentVolume == 0) {
|
|
19265
|
+
if (this.acumulatedMuteTime == 0) this.startMuteTime = Date.now() - (((_d = this.cameraRecorder.getStartTime()) == null ? void 0 : _d.getTime()) || 0);
|
|
19266
|
+
this.acumulatedMuteTime = this.acumulatedMuteTime + 200;
|
|
19267
|
+
} else
|
|
19268
|
+
this.acumulatedMuteTime = 0;
|
|
19269
|
+
if (this.acumulatedMuteTime / 1e3 >= muteThreshold) {
|
|
19270
|
+
this.acumulatedMuteTime = 0;
|
|
19271
|
+
this.onRealtimeAlertsCallback({
|
|
19272
|
+
begin: this.startMuteTime,
|
|
19273
|
+
end: Date.now() - (((_e3 = this.cameraRecorder.getStartTime()) == null ? void 0 : _e3.getTime()) || 0),
|
|
19274
|
+
status: "ALERT",
|
|
19275
|
+
description: "Microfone mutado",
|
|
19276
|
+
type: "audio_muted_on_stream",
|
|
19277
|
+
category: "audio_muted_on_stream"
|
|
19278
|
+
});
|
|
19279
|
+
}
|
|
19280
|
+
}
|
|
19253
19281
|
this.isSpeech = this.isSpeech || this.hasDesiredResult(this.audioClassificationResult);
|
|
19254
19282
|
if (!this.isSpeech && !this.recordingInProgress)
|
|
19255
19283
|
noiseLimit = noiseLimit * 1.25;
|
|
@@ -19262,27 +19290,28 @@ var NoiseRecorder = class {
|
|
|
19262
19290
|
this.recordingChunks = [...this.preRollBuffer];
|
|
19263
19291
|
const totalSamplesInBuffer = this.preRollBuffer.reduce((acc, chunk) => acc + chunk.length, 0);
|
|
19264
19292
|
const bufferDurationMs = totalSamplesInBuffer / this.SAMPLE_RATE * 1e3;
|
|
19265
|
-
const triggerTime = Date.now() - (((
|
|
19293
|
+
const triggerTime = Date.now() - (((_f = this.cameraRecorder.getStartTime()) == null ? void 0 : _f.getTime()) || 0);
|
|
19266
19294
|
this.recordingStartTime = triggerTime - bufferDurationMs;
|
|
19267
19295
|
if (this.recordingStartTime < 0) this.recordingStartTime = 0;
|
|
19268
19296
|
} else if (this.recordingInProgress) {
|
|
19269
19297
|
const silenceDuration = Date.now() - this.lastNoiseTime;
|
|
19270
19298
|
const currentRecordDuration = Date.now() - this.recordingStartTime;
|
|
19271
|
-
|
|
19299
|
+
const isMaxDurationReached = currentRecordDuration >= this.MAX_RECORD_DURATION;
|
|
19300
|
+
if (silenceDuration >= this.SILENCE_THRESHOLD && currentRecordDuration >= 3e3 && this.countLoopTimes > 4 || isMaxDurationReached) {
|
|
19272
19301
|
await this.stopSoundRecord();
|
|
19273
|
-
if (((
|
|
19302
|
+
if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectNoise) && !this.isSpeech) {
|
|
19274
19303
|
this.onRealtimeAlertsCallback({
|
|
19275
|
-
begin: Date.now() - (((
|
|
19276
|
-
end: Date.now() - (((
|
|
19304
|
+
begin: Date.now() - (((_h = this.cameraRecorder.getStartTime()) == null ? void 0 : _h.getTime()) || 0),
|
|
19305
|
+
end: Date.now() - (((_i3 = this.cameraRecorder.getStartTime()) == null ? void 0 : _i3.getTime()) || 0),
|
|
19277
19306
|
status: "ALERT",
|
|
19278
19307
|
description: "Barulho detectado",
|
|
19279
19308
|
type: "audio_detection_on_stream"
|
|
19280
19309
|
});
|
|
19281
19310
|
}
|
|
19282
|
-
if (((
|
|
19311
|
+
if (((_j = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _j.detectSpeech) && this.isSpeech) {
|
|
19283
19312
|
this.onRealtimeAlertsCallback({
|
|
19284
|
-
begin: Date.now() - (((
|
|
19285
|
-
end: Date.now() - (((
|
|
19313
|
+
begin: Date.now() - (((_k = this.cameraRecorder.getStartTime()) == null ? void 0 : _k.getTime()) || 0),
|
|
19314
|
+
end: Date.now() - (((_l = this.cameraRecorder.getStartTime()) == null ? void 0 : _l.getTime()) || 0),
|
|
19286
19315
|
status: "ALERT",
|
|
19287
19316
|
description: "Fala detectada",
|
|
19288
19317
|
type: "audio_detection_on_stream"
|
|
@@ -19460,10 +19489,28 @@ registerProcessor("audio-processor", AudioProcessor);
|
|
|
19460
19489
|
var pkg2 = require_fix_webm_duration();
|
|
19461
19490
|
var fixWebmDuration2 = pkg2.default || pkg2;
|
|
19462
19491
|
var ScreenRecorder = class {
|
|
19463
|
-
constructor(options) {
|
|
19492
|
+
constructor(options, videoOptions, paramsConfig) {
|
|
19464
19493
|
this.blobs = [];
|
|
19465
19494
|
this.blobsFinal = [];
|
|
19495
|
+
this.isRecording = false;
|
|
19466
19496
|
this.duration = 0;
|
|
19497
|
+
this.videoOptions = {
|
|
19498
|
+
width: 640,
|
|
19499
|
+
height: 480,
|
|
19500
|
+
minWidth: 0,
|
|
19501
|
+
minHeight: 0
|
|
19502
|
+
};
|
|
19503
|
+
this.paramsConfig = {
|
|
19504
|
+
audioBehaviourParameters: {
|
|
19505
|
+
recordingBitrate: 128,
|
|
19506
|
+
noiseLimit: 40
|
|
19507
|
+
},
|
|
19508
|
+
videoBehaviourParameters: {
|
|
19509
|
+
screenVideoQuality: 3
|
|
19510
|
+
}
|
|
19511
|
+
};
|
|
19512
|
+
paramsConfig && (this.paramsConfig = paramsConfig);
|
|
19513
|
+
this.videoOptions = videoOptions;
|
|
19467
19514
|
this.options = options;
|
|
19468
19515
|
}
|
|
19469
19516
|
setProctoringId(proctoringId2) {
|
|
@@ -19471,15 +19518,16 @@ var ScreenRecorder = class {
|
|
|
19471
19518
|
setRecorderProctoringId(proctoringId2);
|
|
19472
19519
|
}
|
|
19473
19520
|
async startRecording() {
|
|
19474
|
-
|
|
19521
|
+
var _a2;
|
|
19475
19522
|
if (isMobileDevice()) return;
|
|
19476
19523
|
const { allowOnlyFirstMonitor, allowMultipleMonitors, onStopSharingScreenCallback, onBufferSizeErrorCallback } = this.options;
|
|
19477
19524
|
const complexConstraints = {
|
|
19478
19525
|
video: {
|
|
19479
19526
|
cursor: "always",
|
|
19480
|
-
width: this.
|
|
19481
|
-
height: this.
|
|
19482
|
-
displaySurface: "monitor"
|
|
19527
|
+
width: this.videoOptions.width,
|
|
19528
|
+
height: this.videoOptions.height,
|
|
19529
|
+
displaySurface: "monitor",
|
|
19530
|
+
frameRate: 15
|
|
19483
19531
|
},
|
|
19484
19532
|
audio: false
|
|
19485
19533
|
};
|
|
@@ -19535,10 +19583,24 @@ var ScreenRecorder = class {
|
|
|
19535
19583
|
});
|
|
19536
19584
|
throw NOT_SHARED_SCREEN;
|
|
19537
19585
|
}
|
|
19538
|
-
const {
|
|
19586
|
+
const {
|
|
19587
|
+
startRecording,
|
|
19588
|
+
stopRecording,
|
|
19589
|
+
getStartTime,
|
|
19590
|
+
getDuration
|
|
19591
|
+
} = recorder(
|
|
19592
|
+
this.screenStream,
|
|
19593
|
+
this.blobs,
|
|
19594
|
+
this.options.onBufferSizeError,
|
|
19595
|
+
onBufferSizeErrorCallback,
|
|
19596
|
+
{ quality: (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.screenVideoQuality }
|
|
19597
|
+
);
|
|
19539
19598
|
this.recordingStart = startRecording;
|
|
19540
19599
|
this.recordingStop = stopRecording;
|
|
19600
|
+
this.getStartTime = getStartTime;
|
|
19601
|
+
this.getDuration = getDuration;
|
|
19541
19602
|
this.recordingStart();
|
|
19603
|
+
this.isRecording = true;
|
|
19542
19604
|
}
|
|
19543
19605
|
async pauseRecording() {
|
|
19544
19606
|
}
|
|
@@ -19548,6 +19610,7 @@ var ScreenRecorder = class {
|
|
|
19548
19610
|
var _a2;
|
|
19549
19611
|
this.recordingStop && await this.recordingStop();
|
|
19550
19612
|
this.duration = Date.now() - ((_a2 = this.startTime) == null ? void 0 : _a2.getTime()) || 0;
|
|
19613
|
+
this.isRecording = false;
|
|
19551
19614
|
}
|
|
19552
19615
|
async saveOnSession(session) {
|
|
19553
19616
|
if (isMobileDevice()) return;
|
|
@@ -23370,11 +23433,6 @@ var Proctoring = class {
|
|
|
23370
23433
|
recordingBitrate: 128,
|
|
23371
23434
|
noiseLimit: 40
|
|
23372
23435
|
},
|
|
23373
|
-
imageBehaviourParameters: {
|
|
23374
|
-
useUploadImage: true,
|
|
23375
|
-
uploadInterval: 20,
|
|
23376
|
-
saveVideo: true
|
|
23377
|
-
},
|
|
23378
23436
|
videoBehaviourParameters: {
|
|
23379
23437
|
detectFace: false,
|
|
23380
23438
|
detectPerson: false,
|
|
@@ -23382,7 +23440,9 @@ var Proctoring = class {
|
|
|
23382
23440
|
detectNoise: false,
|
|
23383
23441
|
detectSpeech: false,
|
|
23384
23442
|
realtimePackageSize: 10,
|
|
23385
|
-
realtimeCaptureInterval: 2
|
|
23443
|
+
realtimeCaptureInterval: 2,
|
|
23444
|
+
cameraVideoQuality: 1,
|
|
23445
|
+
screenVideoQuality: 4
|
|
23386
23446
|
}
|
|
23387
23447
|
};
|
|
23388
23448
|
this.proctoringId = "";
|
|
@@ -23518,6 +23578,8 @@ var Proctoring = class {
|
|
|
23518
23578
|
return 25 /* FocusOff */;
|
|
23519
23579
|
case "error_upload_package":
|
|
23520
23580
|
return 44 /* RealtimeOffline */;
|
|
23581
|
+
case "audio_muted_on_stream":
|
|
23582
|
+
return 95 /* NoAudioFound */;
|
|
23521
23583
|
default:
|
|
23522
23584
|
return null;
|
|
23523
23585
|
}
|
|
@@ -23581,7 +23643,7 @@ var Proctoring = class {
|
|
|
23581
23643
|
}
|
|
23582
23644
|
}
|
|
23583
23645
|
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")) {
|
|
23646
|
+
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
23647
|
await this.sendPendingRealtimeAlerts();
|
|
23586
23648
|
if (response.status === "ALERT") {
|
|
23587
23649
|
if (this.allRecorders.cameraRecorder.stopped) return;
|
|
@@ -23655,18 +23717,18 @@ var Proctoring = class {
|
|
|
23655
23717
|
const screenRecorder = this.sessionOptions.captureScreen ? new ScreenRecorder({
|
|
23656
23718
|
allowOnlyFirstMonitor: (_b = this.sessionOptions.allowOnlyFirstMonitor) != null ? _b : true,
|
|
23657
23719
|
allowMultipleMonitors: (_c2 = this.sessionOptions.allowMultipleMonitors) != null ? _c2 : true,
|
|
23658
|
-
screenRecorderOptions: this.sessionOptions.screenRecorderOptions,
|
|
23659
23720
|
onStopSharingScreenCallback: () => this.onStopSharingScreenCallback(),
|
|
23660
23721
|
onBufferSizeError: this.sessionOptions.onBufferSizeError,
|
|
23661
23722
|
onBufferSizeErrorCallback: () => this.onBufferSizeErrorCallback()
|
|
23662
|
-
}) : void 0;
|
|
23723
|
+
}, this.videoOptions, this.paramsConfig) : void 0;
|
|
23663
23724
|
const alertRecorder = new AlertRecorder(
|
|
23664
23725
|
{
|
|
23665
23726
|
onFocusCallback: (response) => this.onFocusAlertRecorderCallback(response),
|
|
23666
23727
|
onLostFocusCallback: (response) => this.onLostFocusAlertRecorderCallback(response),
|
|
23667
23728
|
onRealtimeAlertCallback: (response) => this.onRealtimeAlertsCallback(response)
|
|
23668
23729
|
},
|
|
23669
|
-
options
|
|
23730
|
+
options,
|
|
23731
|
+
screenRecorder
|
|
23670
23732
|
);
|
|
23671
23733
|
const noiseRecorder = new NoiseRecorder(
|
|
23672
23734
|
options,
|
|
@@ -23850,9 +23912,7 @@ Error: ${error}`
|
|
|
23850
23912
|
this.appChecker && await this.appChecker.disconnectWebSocket();
|
|
23851
23913
|
await this.recorder.saveAllOnSession();
|
|
23852
23914
|
await this.sendPendingRealtimeAlerts();
|
|
23853
|
-
trackers.registerError(this.proctoringId, `finish this.repository.save starting`);
|
|
23854
23915
|
await this.repository.save(this.proctoringSession);
|
|
23855
|
-
trackers.registerError(this.proctoringId, `finish this.repository.save finished`);
|
|
23856
23916
|
let uploader;
|
|
23857
23917
|
let uploaderServices;
|
|
23858
23918
|
if (versionVerify() !== "1.0.0.0") {
|
|
@@ -24006,10 +24066,6 @@ Error: ` + error
|
|
|
24006
24066
|
...this.paramsConfig.audioBehaviourParameters,
|
|
24007
24067
|
...paramsConfig.audioBehaviourParameters
|
|
24008
24068
|
},
|
|
24009
|
-
imageBehaviourParameters: {
|
|
24010
|
-
...this.paramsConfig.imageBehaviourParameters,
|
|
24011
|
-
...paramsConfig.imageBehaviourParameters
|
|
24012
|
-
},
|
|
24013
24069
|
videoBehaviourParameters: {
|
|
24014
24070
|
...this.paramsConfig.videoBehaviourParameters,
|
|
24015
24071
|
...paramsConfig.videoBehaviourParameters
|