easyproctor-hml 2.5.38 → 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 +13 -13
- package/index.js +13 -13
- package/new-flow/recorders/CameraRecorder.d.ts +1 -0
- package/package.json +1 -1
- package/unpkg/easyproctor.min.js +24 -24
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", () =>
|
|
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 = `
|
|
@@ -9264,7 +9267,7 @@ var BaseDetection = class {
|
|
|
9264
9267
|
case "person_ok":
|
|
9265
9268
|
return "Pessoa detectada";
|
|
9266
9269
|
case "cellphone_ok":
|
|
9267
|
-
return "Nenhum celular
|
|
9270
|
+
return "Nenhum celular detectado";
|
|
9268
9271
|
case "face_ok":
|
|
9269
9272
|
return "Face detectada";
|
|
9270
9273
|
case "ok_position_face_detected":
|
|
@@ -12708,7 +12711,6 @@ function setRecorderProctoringId(id) {
|
|
|
12708
12711
|
}
|
|
12709
12712
|
function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCallback, audio = false) {
|
|
12710
12713
|
let resolvePromise;
|
|
12711
|
-
let stopped = false;
|
|
12712
12714
|
let onBufferSizeInterval;
|
|
12713
12715
|
let lastEvent;
|
|
12714
12716
|
let bufferSize;
|
|
@@ -12751,12 +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
|
-
const duration2 = Date.now() - startTime.getTime() || 0;
|
|
12758
|
-
console.log("duration no ondataavailable", duration2);
|
|
12759
|
-
}
|
|
12760
12756
|
};
|
|
12761
12757
|
return mediaRecorder2;
|
|
12762
12758
|
}
|
|
@@ -12808,7 +12804,6 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
|
|
|
12808
12804
|
await startRecorder(mediaRecorder);
|
|
12809
12805
|
if (mediaRecorder.state === "recording") {
|
|
12810
12806
|
bufferSize = 0;
|
|
12811
|
-
stopped = false;
|
|
12812
12807
|
return;
|
|
12813
12808
|
} else {
|
|
12814
12809
|
console.log("Recorder n\xE3o est\xE1 em estado recording ap\xF3s start");
|
|
@@ -12829,8 +12824,8 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
|
|
|
12829
12824
|
console.log("recorder onstop");
|
|
12830
12825
|
const duration2 = Date.now() - startTime.getTime() || 0;
|
|
12831
12826
|
console.log("duration no onstop", duration2);
|
|
12827
|
+
resolvePromise && resolvePromise();
|
|
12832
12828
|
};
|
|
12833
|
-
stopped = true;
|
|
12834
12829
|
mediaRecorder.stop();
|
|
12835
12830
|
duration = Date.now() - startTime.getTime() || 0;
|
|
12836
12831
|
console.log("duration imediatamente ap\xF3s mediaRecorder.stop()", duration);
|
|
@@ -13303,6 +13298,7 @@ var CameraRecorder = class {
|
|
|
13303
13298
|
this.internalClonedStream = null;
|
|
13304
13299
|
this.videoElement = null;
|
|
13305
13300
|
this.duration = 0;
|
|
13301
|
+
this.stopped = false;
|
|
13306
13302
|
this.currentRetries = 0;
|
|
13307
13303
|
this.packageCount = 0;
|
|
13308
13304
|
this.noiseWait = 20;
|
|
@@ -13512,6 +13508,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13512
13508
|
throw error;
|
|
13513
13509
|
}
|
|
13514
13510
|
}
|
|
13511
|
+
this.stopped = false;
|
|
13515
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)) {
|
|
13516
13513
|
await this.initializeDetectors();
|
|
13517
13514
|
}
|
|
@@ -13531,6 +13528,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13531
13528
|
async stopRecording() {
|
|
13532
13529
|
var _a2, _b, _c2;
|
|
13533
13530
|
console.log("Camera Recorder stopRecording");
|
|
13531
|
+
this.stopped = true;
|
|
13534
13532
|
this.isCanvasLoopActive = false;
|
|
13535
13533
|
this.faceDetection && this.faceDetection.detecting && this.faceDetection.stopDetection();
|
|
13536
13534
|
this.objectDetection && this.objectDetection.detecting && this.objectDetection.stopDetection();
|
|
@@ -22556,6 +22554,7 @@ var Proctoring = class {
|
|
|
22556
22554
|
async internalOnRealtimeAlerts(response) {
|
|
22557
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")) {
|
|
22558
22556
|
if (response.status === "ALERT") {
|
|
22557
|
+
if (this.allRecorders.cameraRecorder.stopped) return;
|
|
22559
22558
|
await this.backend.startRealtimeAlert({
|
|
22560
22559
|
proctoringId: this.proctoringId,
|
|
22561
22560
|
begin: response.begin,
|
|
@@ -22563,6 +22562,7 @@ var Proctoring = class {
|
|
|
22563
22562
|
alert: this.convertRealtimeCategoryToAlertCategory(response.category)
|
|
22564
22563
|
});
|
|
22565
22564
|
} else if (response.status === "OK") {
|
|
22565
|
+
if (this.allRecorders.cameraRecorder.stopped && response.description !== "face_stop") return;
|
|
22566
22566
|
await this.stopRealtimeAlert(response);
|
|
22567
22567
|
}
|
|
22568
22568
|
}
|
|
@@ -22645,7 +22645,7 @@ var Proctoring = class {
|
|
|
22645
22645
|
recorders.push(screenRecorder);
|
|
22646
22646
|
}
|
|
22647
22647
|
this.recorder = new ProctoringRecorder(this.proctoringSession, recorders);
|
|
22648
|
-
return {
|
|
22648
|
+
return { screenRecorder, alertRecorder, noiseRecorder, cameraRecorder };
|
|
22649
22649
|
}
|
|
22650
22650
|
async login() {
|
|
22651
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", () =>
|
|
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 = `
|
|
@@ -26549,7 +26552,7 @@ var BaseDetection = class {
|
|
|
26549
26552
|
case "person_ok":
|
|
26550
26553
|
return "Pessoa detectada";
|
|
26551
26554
|
case "cellphone_ok":
|
|
26552
|
-
return "Nenhum celular
|
|
26555
|
+
return "Nenhum celular detectado";
|
|
26553
26556
|
case "face_ok":
|
|
26554
26557
|
return "Face detectada";
|
|
26555
26558
|
case "ok_position_face_detected":
|
|
@@ -30805,7 +30808,6 @@ function setRecorderProctoringId(id) {
|
|
|
30805
30808
|
}
|
|
30806
30809
|
function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorCallback, audio = false) {
|
|
30807
30810
|
let resolvePromise;
|
|
30808
|
-
let stopped = false;
|
|
30809
30811
|
let onBufferSizeInterval;
|
|
30810
30812
|
let lastEvent;
|
|
30811
30813
|
let bufferSize;
|
|
@@ -30848,12 +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
|
-
const duration2 = Date.now() - startTime.getTime() || 0;
|
|
30855
|
-
console.log("duration no ondataavailable", duration2);
|
|
30856
|
-
}
|
|
30857
30853
|
};
|
|
30858
30854
|
return mediaRecorder2;
|
|
30859
30855
|
}
|
|
@@ -30905,7 +30901,6 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30905
30901
|
await startRecorder(mediaRecorder);
|
|
30906
30902
|
if (mediaRecorder.state === "recording") {
|
|
30907
30903
|
bufferSize = 0;
|
|
30908
|
-
stopped = false;
|
|
30909
30904
|
return;
|
|
30910
30905
|
} else {
|
|
30911
30906
|
console.log("Recorder n\xE3o est\xE1 em estado recording ap\xF3s start");
|
|
@@ -30926,8 +30921,8 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30926
30921
|
console.log("recorder onstop");
|
|
30927
30922
|
const duration2 = Date.now() - startTime.getTime() || 0;
|
|
30928
30923
|
console.log("duration no onstop", duration2);
|
|
30924
|
+
resolvePromise && resolvePromise();
|
|
30929
30925
|
};
|
|
30930
|
-
stopped = true;
|
|
30931
30926
|
mediaRecorder.stop();
|
|
30932
30927
|
duration = Date.now() - startTime.getTime() || 0;
|
|
30933
30928
|
console.log("duration imediatamente ap\xF3s mediaRecorder.stop()", duration);
|
|
@@ -31400,6 +31395,7 @@ var CameraRecorder = class {
|
|
|
31400
31395
|
this.internalClonedStream = null;
|
|
31401
31396
|
this.videoElement = null;
|
|
31402
31397
|
this.duration = 0;
|
|
31398
|
+
this.stopped = false;
|
|
31403
31399
|
this.currentRetries = 0;
|
|
31404
31400
|
this.packageCount = 0;
|
|
31405
31401
|
this.noiseWait = 20;
|
|
@@ -31609,6 +31605,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31609
31605
|
throw error;
|
|
31610
31606
|
}
|
|
31611
31607
|
}
|
|
31608
|
+
this.stopped = false;
|
|
31612
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)) {
|
|
31613
31610
|
await this.initializeDetectors();
|
|
31614
31611
|
}
|
|
@@ -31628,6 +31625,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31628
31625
|
async stopRecording() {
|
|
31629
31626
|
var _a2, _b, _c2;
|
|
31630
31627
|
console.log("Camera Recorder stopRecording");
|
|
31628
|
+
this.stopped = true;
|
|
31631
31629
|
this.isCanvasLoopActive = false;
|
|
31632
31630
|
this.faceDetection && this.faceDetection.detecting && this.faceDetection.stopDetection();
|
|
31633
31631
|
this.objectDetection && this.objectDetection.detecting && this.objectDetection.stopDetection();
|
|
@@ -37805,6 +37803,7 @@ var Proctoring = class {
|
|
|
37805
37803
|
async internalOnRealtimeAlerts(response) {
|
|
37806
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")) {
|
|
37807
37805
|
if (response.status === "ALERT") {
|
|
37806
|
+
if (this.allRecorders.cameraRecorder.stopped) return;
|
|
37808
37807
|
await this.backend.startRealtimeAlert({
|
|
37809
37808
|
proctoringId: this.proctoringId,
|
|
37810
37809
|
begin: response.begin,
|
|
@@ -37812,6 +37811,7 @@ var Proctoring = class {
|
|
|
37812
37811
|
alert: this.convertRealtimeCategoryToAlertCategory(response.category)
|
|
37813
37812
|
});
|
|
37814
37813
|
} else if (response.status === "OK") {
|
|
37814
|
+
if (this.allRecorders.cameraRecorder.stopped && response.description !== "face_stop") return;
|
|
37815
37815
|
await this.stopRealtimeAlert(response);
|
|
37816
37816
|
}
|
|
37817
37817
|
}
|
|
@@ -37894,7 +37894,7 @@ var Proctoring = class {
|
|
|
37894
37894
|
recorders.push(screenRecorder);
|
|
37895
37895
|
}
|
|
37896
37896
|
this.recorder = new ProctoringRecorder(this.proctoringSession, recorders);
|
|
37897
|
-
return {
|
|
37897
|
+
return { screenRecorder, alertRecorder, noiseRecorder, cameraRecorder };
|
|
37898
37898
|
}
|
|
37899
37899
|
async login() {
|
|
37900
37900
|
var _a2;
|