easyproctor 2.5.8 → 2.5.9
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 +36 -21
- package/index.js +36 -21
- package/new-flow/recorders/CameraRecorder.d.ts +2 -0
- package/package.json +1 -1
- package/plugins/recorder.d.ts +1 -0
- package/unpkg/easyproctor.min.js +17 -17
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 = `
|
|
@@ -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
|
|
9270
|
+
return "Nenhum celular detectado";
|
|
9267
9271
|
case "face_ok":
|
|
9268
9272
|
return "Face detectada";
|
|
9269
9273
|
case "ok_position_face_detected":
|
|
@@ -12707,12 +12711,12 @@ function setRecorderProctoringId(id) {
|
|
|
12707
12711
|
}
|
|
12708
12712
|
function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCallback, audio = false) {
|
|
12709
12713
|
let resolvePromise;
|
|
12710
|
-
let stopped = false;
|
|
12711
12714
|
let onBufferSizeInterval;
|
|
12712
12715
|
let lastEvent;
|
|
12713
12716
|
let bufferSize;
|
|
12714
12717
|
bufferSize = 0;
|
|
12715
12718
|
let startTime;
|
|
12719
|
+
let duration = 0;
|
|
12716
12720
|
let recorderOptions = {
|
|
12717
12721
|
// eslint-disable-next-line no-useless-escape
|
|
12718
12722
|
mimeType: "video/webm",
|
|
@@ -12749,10 +12753,6 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
|
|
|
12749
12753
|
if (e3.data.size > 0) {
|
|
12750
12754
|
buffer.push(e3.data);
|
|
12751
12755
|
}
|
|
12752
|
-
if (stopped) {
|
|
12753
|
-
console.log("buildMediaRecorder ondataavailable stopped");
|
|
12754
|
-
resolvePromise && resolvePromise();
|
|
12755
|
-
}
|
|
12756
12756
|
};
|
|
12757
12757
|
return mediaRecorder2;
|
|
12758
12758
|
}
|
|
@@ -12764,6 +12764,7 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
|
|
|
12764
12764
|
recorder2.onstart = () => {
|
|
12765
12765
|
started = true;
|
|
12766
12766
|
console.log("recorder onstart");
|
|
12767
|
+
startTime = new Date(Date.now());
|
|
12767
12768
|
resolve();
|
|
12768
12769
|
};
|
|
12769
12770
|
recorder2.onerror = (ev) => {
|
|
@@ -12803,7 +12804,6 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
|
|
|
12803
12804
|
await startRecorder(mediaRecorder);
|
|
12804
12805
|
if (mediaRecorder.state === "recording") {
|
|
12805
12806
|
bufferSize = 0;
|
|
12806
|
-
stopped = false;
|
|
12807
12807
|
return;
|
|
12808
12808
|
} else {
|
|
12809
12809
|
console.log("Recorder n\xE3o est\xE1 em estado recording ap\xF3s start");
|
|
@@ -12822,9 +12822,13 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
|
|
|
12822
12822
|
resolvePromise = resolve;
|
|
12823
12823
|
mediaRecorder.onstop = () => {
|
|
12824
12824
|
console.log("recorder onstop");
|
|
12825
|
+
duration = Date.now() - startTime.getTime() || 0;
|
|
12826
|
+
console.log("duration no onstop", duration);
|
|
12827
|
+
resolvePromise && resolvePromise();
|
|
12825
12828
|
};
|
|
12826
|
-
stopped = true;
|
|
12827
12829
|
mediaRecorder.stop();
|
|
12830
|
+
duration = Date.now() - startTime.getTime() || 0;
|
|
12831
|
+
console.log("duration imediatamente ap\xF3s mediaRecorder.stop()", duration);
|
|
12828
12832
|
} else {
|
|
12829
12833
|
console.log("stopRecording Recorder n\xE3o est\xE1 em estado recording");
|
|
12830
12834
|
resolve();
|
|
@@ -12860,6 +12864,9 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
|
|
|
12860
12864
|
function getStartTime() {
|
|
12861
12865
|
return startTime;
|
|
12862
12866
|
}
|
|
12867
|
+
function getDuration() {
|
|
12868
|
+
return duration;
|
|
12869
|
+
}
|
|
12863
12870
|
return {
|
|
12864
12871
|
startRecording,
|
|
12865
12872
|
stopRecording,
|
|
@@ -12867,7 +12874,8 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
|
|
|
12867
12874
|
resumeRecording,
|
|
12868
12875
|
recorderOptions,
|
|
12869
12876
|
getBufferSize,
|
|
12870
|
-
getStartTime
|
|
12877
|
+
getStartTime,
|
|
12878
|
+
getDuration
|
|
12871
12879
|
};
|
|
12872
12880
|
}
|
|
12873
12881
|
|
|
@@ -13290,6 +13298,7 @@ var CameraRecorder = class {
|
|
|
13290
13298
|
this.internalClonedStream = null;
|
|
13291
13299
|
this.videoElement = null;
|
|
13292
13300
|
this.duration = 0;
|
|
13301
|
+
this.stopped = false;
|
|
13293
13302
|
this.currentRetries = 0;
|
|
13294
13303
|
this.packageCount = 0;
|
|
13295
13304
|
this.noiseWait = 20;
|
|
@@ -13466,7 +13475,8 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13466
13475
|
resumeRecording,
|
|
13467
13476
|
recorderOptions,
|
|
13468
13477
|
getBufferSize,
|
|
13469
|
-
getStartTime
|
|
13478
|
+
getStartTime,
|
|
13479
|
+
getDuration
|
|
13470
13480
|
} = recorder(
|
|
13471
13481
|
this.cameraStream,
|
|
13472
13482
|
// streamToRecord,
|
|
@@ -13482,6 +13492,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13482
13492
|
this.recorderOptions = recorderOptions;
|
|
13483
13493
|
this.getBufferSize = getBufferSize;
|
|
13484
13494
|
this.getStartTime = getStartTime;
|
|
13495
|
+
this.getDuration = getDuration;
|
|
13485
13496
|
try {
|
|
13486
13497
|
await new Promise((r3) => setTimeout(r3, 500));
|
|
13487
13498
|
await this.recordingStart();
|
|
@@ -13497,6 +13508,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13497
13508
|
throw error;
|
|
13498
13509
|
}
|
|
13499
13510
|
}
|
|
13511
|
+
this.stopped = false;
|
|
13500
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)) {
|
|
13501
13513
|
await this.initializeDetectors();
|
|
13502
13514
|
}
|
|
@@ -13514,8 +13526,9 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13514
13526
|
console.log("Camera Recorder started OK");
|
|
13515
13527
|
}
|
|
13516
13528
|
async stopRecording() {
|
|
13517
|
-
var _a2, _b, _c2
|
|
13529
|
+
var _a2, _b, _c2;
|
|
13518
13530
|
console.log("Camera Recorder stopRecording");
|
|
13531
|
+
this.stopped = true;
|
|
13519
13532
|
this.isCanvasLoopActive = false;
|
|
13520
13533
|
this.faceDetection && this.faceDetection.detecting && this.faceDetection.stopDetection();
|
|
13521
13534
|
this.objectDetection && this.objectDetection.detecting && this.objectDetection.stopDetection();
|
|
@@ -13524,7 +13537,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13524
13537
|
this.volumeMeter && this.volumeMeter.stop();
|
|
13525
13538
|
this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
|
|
13526
13539
|
this.recordingStop && await this.recordingStop();
|
|
13527
|
-
this.duration =
|
|
13540
|
+
this.duration = this.getDuration();
|
|
13528
13541
|
try {
|
|
13529
13542
|
if (this.animationFrameId) {
|
|
13530
13543
|
cancelAnimationFrame(this.animationFrameId);
|
|
@@ -13542,14 +13555,14 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13542
13555
|
this.hardwareStream = null;
|
|
13543
13556
|
}
|
|
13544
13557
|
if (this.videoElement) {
|
|
13545
|
-
(
|
|
13558
|
+
(_a2 = this.videoElement) == null ? void 0 : _a2.remove();
|
|
13546
13559
|
this.videoElement = null;
|
|
13547
13560
|
}
|
|
13548
13561
|
if (this.video) {
|
|
13549
|
-
(
|
|
13562
|
+
(_b = this.video) == null ? void 0 : _b.remove();
|
|
13550
13563
|
}
|
|
13551
13564
|
if (this.canvas) {
|
|
13552
|
-
(
|
|
13565
|
+
(_c2 = this.canvas) == null ? void 0 : _c2.remove();
|
|
13553
13566
|
}
|
|
13554
13567
|
} catch (e3) {
|
|
13555
13568
|
console.error("Erro ao parar os streams de m\xEDdia.");
|
|
@@ -13695,8 +13708,8 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13695
13708
|
type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
|
|
13696
13709
|
});
|
|
13697
13710
|
const fixedBlob = await (0, import_fix_webm_duration.default)(rawBlob, this.duration);
|
|
13698
|
-
const
|
|
13699
|
-
[
|
|
13711
|
+
const fileWithDuration = new File(
|
|
13712
|
+
[fixedBlob],
|
|
13700
13713
|
`EP_${session.id}_camera_0.webm`,
|
|
13701
13714
|
{ type: rawBlob.type }
|
|
13702
13715
|
);
|
|
@@ -13707,7 +13720,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13707
13720
|
|
|
13708
13721
|
Video:
|
|
13709
13722
|
${JSON.stringify(this.recorderOptions)}`,
|
|
13710
|
-
file,
|
|
13723
|
+
file: fileWithDuration,
|
|
13711
13724
|
origin: "Camera" /* Camera */
|
|
13712
13725
|
});
|
|
13713
13726
|
}
|
|
@@ -22443,6 +22456,7 @@ var Proctoring = class {
|
|
|
22443
22456
|
async internalOnRealtimeAlerts(response) {
|
|
22444
22457
|
if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus")) {
|
|
22445
22458
|
if (response.status === "ALERT") {
|
|
22459
|
+
if (this.allRecorders.cameraRecorder.stopped) return;
|
|
22446
22460
|
await this.backend.startRealtimeAlert({
|
|
22447
22461
|
proctoringId: this.proctoringId,
|
|
22448
22462
|
begin: response.begin,
|
|
@@ -22450,6 +22464,7 @@ var Proctoring = class {
|
|
|
22450
22464
|
alert: this.convertRealtimeCategoryToAlertCategory(response.category)
|
|
22451
22465
|
});
|
|
22452
22466
|
} else if (response.status === "OK") {
|
|
22467
|
+
if (this.allRecorders.cameraRecorder.stopped && response.description !== "face_stop") return;
|
|
22453
22468
|
await this.stopRealtimeAlert(response);
|
|
22454
22469
|
}
|
|
22455
22470
|
}
|
|
@@ -22532,7 +22547,7 @@ var Proctoring = class {
|
|
|
22532
22547
|
recorders.push(screenRecorder);
|
|
22533
22548
|
}
|
|
22534
22549
|
this.recorder = new ProctoringRecorder(this.proctoringSession, recorders);
|
|
22535
|
-
return {
|
|
22550
|
+
return { screenRecorder, alertRecorder, noiseRecorder, cameraRecorder };
|
|
22536
22551
|
}
|
|
22537
22552
|
async login() {
|
|
22538
22553
|
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 = `
|
|
@@ -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
|
|
26555
|
+
return "Nenhum celular detectado";
|
|
26552
26556
|
case "face_ok":
|
|
26553
26557
|
return "Face detectada";
|
|
26554
26558
|
case "ok_position_face_detected":
|
|
@@ -30804,12 +30808,12 @@ function setRecorderProctoringId(id) {
|
|
|
30804
30808
|
}
|
|
30805
30809
|
function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorCallback, audio = false) {
|
|
30806
30810
|
let resolvePromise;
|
|
30807
|
-
let stopped = false;
|
|
30808
30811
|
let onBufferSizeInterval;
|
|
30809
30812
|
let lastEvent;
|
|
30810
30813
|
let bufferSize;
|
|
30811
30814
|
bufferSize = 0;
|
|
30812
30815
|
let startTime;
|
|
30816
|
+
let duration = 0;
|
|
30813
30817
|
let recorderOptions = {
|
|
30814
30818
|
// eslint-disable-next-line no-useless-escape
|
|
30815
30819
|
mimeType: "video/webm",
|
|
@@ -30846,10 +30850,6 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30846
30850
|
if (e3.data.size > 0) {
|
|
30847
30851
|
buffer.push(e3.data);
|
|
30848
30852
|
}
|
|
30849
|
-
if (stopped) {
|
|
30850
|
-
console.log("buildMediaRecorder ondataavailable stopped");
|
|
30851
|
-
resolvePromise && resolvePromise();
|
|
30852
|
-
}
|
|
30853
30853
|
};
|
|
30854
30854
|
return mediaRecorder2;
|
|
30855
30855
|
}
|
|
@@ -30861,6 +30861,7 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30861
30861
|
recorder2.onstart = () => {
|
|
30862
30862
|
started = true;
|
|
30863
30863
|
console.log("recorder onstart");
|
|
30864
|
+
startTime = new Date(Date.now());
|
|
30864
30865
|
resolve();
|
|
30865
30866
|
};
|
|
30866
30867
|
recorder2.onerror = (ev) => {
|
|
@@ -30900,7 +30901,6 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30900
30901
|
await startRecorder(mediaRecorder);
|
|
30901
30902
|
if (mediaRecorder.state === "recording") {
|
|
30902
30903
|
bufferSize = 0;
|
|
30903
|
-
stopped = false;
|
|
30904
30904
|
return;
|
|
30905
30905
|
} else {
|
|
30906
30906
|
console.log("Recorder n\xE3o est\xE1 em estado recording ap\xF3s start");
|
|
@@ -30919,9 +30919,13 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30919
30919
|
resolvePromise = resolve;
|
|
30920
30920
|
mediaRecorder.onstop = () => {
|
|
30921
30921
|
console.log("recorder onstop");
|
|
30922
|
+
duration = Date.now() - startTime.getTime() || 0;
|
|
30923
|
+
console.log("duration no onstop", duration);
|
|
30924
|
+
resolvePromise && resolvePromise();
|
|
30922
30925
|
};
|
|
30923
|
-
stopped = true;
|
|
30924
30926
|
mediaRecorder.stop();
|
|
30927
|
+
duration = Date.now() - startTime.getTime() || 0;
|
|
30928
|
+
console.log("duration imediatamente ap\xF3s mediaRecorder.stop()", duration);
|
|
30925
30929
|
} else {
|
|
30926
30930
|
console.log("stopRecording Recorder n\xE3o est\xE1 em estado recording");
|
|
30927
30931
|
resolve();
|
|
@@ -30957,6 +30961,9 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30957
30961
|
function getStartTime() {
|
|
30958
30962
|
return startTime;
|
|
30959
30963
|
}
|
|
30964
|
+
function getDuration() {
|
|
30965
|
+
return duration;
|
|
30966
|
+
}
|
|
30960
30967
|
return {
|
|
30961
30968
|
startRecording,
|
|
30962
30969
|
stopRecording,
|
|
@@ -30964,7 +30971,8 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30964
30971
|
resumeRecording,
|
|
30965
30972
|
recorderOptions,
|
|
30966
30973
|
getBufferSize,
|
|
30967
|
-
getStartTime
|
|
30974
|
+
getStartTime,
|
|
30975
|
+
getDuration
|
|
30968
30976
|
};
|
|
30969
30977
|
}
|
|
30970
30978
|
|
|
@@ -31387,6 +31395,7 @@ var CameraRecorder = class {
|
|
|
31387
31395
|
this.internalClonedStream = null;
|
|
31388
31396
|
this.videoElement = null;
|
|
31389
31397
|
this.duration = 0;
|
|
31398
|
+
this.stopped = false;
|
|
31390
31399
|
this.currentRetries = 0;
|
|
31391
31400
|
this.packageCount = 0;
|
|
31392
31401
|
this.noiseWait = 20;
|
|
@@ -31563,7 +31572,8 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31563
31572
|
resumeRecording,
|
|
31564
31573
|
recorderOptions,
|
|
31565
31574
|
getBufferSize,
|
|
31566
|
-
getStartTime
|
|
31575
|
+
getStartTime,
|
|
31576
|
+
getDuration
|
|
31567
31577
|
} = recorder(
|
|
31568
31578
|
this.cameraStream,
|
|
31569
31579
|
// streamToRecord,
|
|
@@ -31579,6 +31589,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31579
31589
|
this.recorderOptions = recorderOptions;
|
|
31580
31590
|
this.getBufferSize = getBufferSize;
|
|
31581
31591
|
this.getStartTime = getStartTime;
|
|
31592
|
+
this.getDuration = getDuration;
|
|
31582
31593
|
try {
|
|
31583
31594
|
await new Promise((r3) => setTimeout(r3, 500));
|
|
31584
31595
|
await this.recordingStart();
|
|
@@ -31594,6 +31605,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31594
31605
|
throw error;
|
|
31595
31606
|
}
|
|
31596
31607
|
}
|
|
31608
|
+
this.stopped = false;
|
|
31597
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)) {
|
|
31598
31610
|
await this.initializeDetectors();
|
|
31599
31611
|
}
|
|
@@ -31611,8 +31623,9 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31611
31623
|
console.log("Camera Recorder started OK");
|
|
31612
31624
|
}
|
|
31613
31625
|
async stopRecording() {
|
|
31614
|
-
var _a2, _b, _c2
|
|
31626
|
+
var _a2, _b, _c2;
|
|
31615
31627
|
console.log("Camera Recorder stopRecording");
|
|
31628
|
+
this.stopped = true;
|
|
31616
31629
|
this.isCanvasLoopActive = false;
|
|
31617
31630
|
this.faceDetection && this.faceDetection.detecting && this.faceDetection.stopDetection();
|
|
31618
31631
|
this.objectDetection && this.objectDetection.detecting && this.objectDetection.stopDetection();
|
|
@@ -31621,7 +31634,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31621
31634
|
this.volumeMeter && this.volumeMeter.stop();
|
|
31622
31635
|
this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
|
|
31623
31636
|
this.recordingStop && await this.recordingStop();
|
|
31624
|
-
this.duration =
|
|
31637
|
+
this.duration = this.getDuration();
|
|
31625
31638
|
try {
|
|
31626
31639
|
if (this.animationFrameId) {
|
|
31627
31640
|
cancelAnimationFrame(this.animationFrameId);
|
|
@@ -31639,14 +31652,14 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31639
31652
|
this.hardwareStream = null;
|
|
31640
31653
|
}
|
|
31641
31654
|
if (this.videoElement) {
|
|
31642
|
-
(
|
|
31655
|
+
(_a2 = this.videoElement) == null ? void 0 : _a2.remove();
|
|
31643
31656
|
this.videoElement = null;
|
|
31644
31657
|
}
|
|
31645
31658
|
if (this.video) {
|
|
31646
|
-
(
|
|
31659
|
+
(_b = this.video) == null ? void 0 : _b.remove();
|
|
31647
31660
|
}
|
|
31648
31661
|
if (this.canvas) {
|
|
31649
|
-
(
|
|
31662
|
+
(_c2 = this.canvas) == null ? void 0 : _c2.remove();
|
|
31650
31663
|
}
|
|
31651
31664
|
} catch {
|
|
31652
31665
|
console.error("Erro ao parar os streams de m\xEDdia.");
|
|
@@ -31792,8 +31805,8 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31792
31805
|
type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
|
|
31793
31806
|
});
|
|
31794
31807
|
const fixedBlob = await (0, import_fix_webm_duration.default)(rawBlob, this.duration);
|
|
31795
|
-
const
|
|
31796
|
-
[
|
|
31808
|
+
const fileWithDuration = new File(
|
|
31809
|
+
[fixedBlob],
|
|
31797
31810
|
`EP_${session.id}_camera_0.webm`,
|
|
31798
31811
|
{ type: rawBlob.type }
|
|
31799
31812
|
);
|
|
@@ -31804,7 +31817,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31804
31817
|
|
|
31805
31818
|
Video:
|
|
31806
31819
|
${JSON.stringify(this.recorderOptions)}`,
|
|
31807
|
-
file,
|
|
31820
|
+
file: fileWithDuration,
|
|
31808
31821
|
origin: "Camera" /* Camera */
|
|
31809
31822
|
});
|
|
31810
31823
|
}
|
|
@@ -37692,6 +37705,7 @@ var Proctoring = class {
|
|
|
37692
37705
|
async internalOnRealtimeAlerts(response) {
|
|
37693
37706
|
if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus")) {
|
|
37694
37707
|
if (response.status === "ALERT") {
|
|
37708
|
+
if (this.allRecorders.cameraRecorder.stopped) return;
|
|
37695
37709
|
await this.backend.startRealtimeAlert({
|
|
37696
37710
|
proctoringId: this.proctoringId,
|
|
37697
37711
|
begin: response.begin,
|
|
@@ -37699,6 +37713,7 @@ var Proctoring = class {
|
|
|
37699
37713
|
alert: this.convertRealtimeCategoryToAlertCategory(response.category)
|
|
37700
37714
|
});
|
|
37701
37715
|
} else if (response.status === "OK") {
|
|
37716
|
+
if (this.allRecorders.cameraRecorder.stopped && response.description !== "face_stop") return;
|
|
37702
37717
|
await this.stopRealtimeAlert(response);
|
|
37703
37718
|
}
|
|
37704
37719
|
}
|
|
@@ -37781,7 +37796,7 @@ var Proctoring = class {
|
|
|
37781
37796
|
recorders.push(screenRecorder);
|
|
37782
37797
|
}
|
|
37783
37798
|
this.recorder = new ProctoringRecorder(this.proctoringSession, recorders);
|
|
37784
|
-
return {
|
|
37799
|
+
return { screenRecorder, alertRecorder, noiseRecorder, cameraRecorder };
|
|
37785
37800
|
}
|
|
37786
37801
|
async login() {
|
|
37787
37802
|
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