easyproctor-hml 2.5.38 → 2.6.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/errors/errors.d.ts +1 -0
- package/esm/index.js +79 -33
- package/index.js +79 -33
- package/new-flow/backend/SafeBrowserBackendService.d.ts +13 -0
- package/new-flow/recorders/CameraRecorder.d.ts +1 -0
- package/package.json +1 -1
- package/proctoring/options/ProctoringOptions.d.ts +1 -0
- package/proctoring/proctoring.d.ts +1 -0
- package/unpkg/easyproctor.min.js +35 -40
package/errors/errors.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const TOKEN_MISSING = "token_missing";
|
|
|
16
16
|
export declare const CREDENTIALS_MISSING = "credentials_missing";
|
|
17
17
|
export declare const CAMERA_BLOCKED = "camera_blocked";
|
|
18
18
|
export declare const SPY_SCAN_API_NOT_FOUND = "spy_scan_api_not_found";
|
|
19
|
+
export declare const SAFE_BROWSER_API_NOT_FOUND = "safe_browser_api_not_found";
|
|
19
20
|
export declare const ERROR_ON_MOBILE_APP_NOT_FOUND = "error_on_mobile_app_not_found";
|
|
20
21
|
export declare const EXTERNAL_CAMERA_NOT_STARTED = "external_camera_not_started";
|
|
21
22
|
export declare const EXTERNAL_CAMERA_CHECK_TRANSMISSION = "external_camera_timed_out";
|
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");
|
|
@@ -12827,10 +12822,10 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
|
|
|
12827
12822
|
resolvePromise = resolve;
|
|
12828
12823
|
mediaRecorder.onstop = () => {
|
|
12829
12824
|
console.log("recorder onstop");
|
|
12830
|
-
|
|
12831
|
-
console.log("duration no onstop",
|
|
12825
|
+
duration = Date.now() - startTime.getTime() || 0;
|
|
12826
|
+
console.log("duration no onstop", duration);
|
|
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);
|
|
@@ -13106,6 +13101,7 @@ var BROWSER_NOT_SUPPORTED = "browser_not_supported";
|
|
|
13106
13101
|
var TOKEN_MISSING = "token_missing";
|
|
13107
13102
|
var CREDENTIALS_MISSING = "credentials_missing";
|
|
13108
13103
|
var SPY_SCAN_API_NOT_FOUND = "spy_scan_api_not_found";
|
|
13104
|
+
var SAFE_BROWSER_API_NOT_FOUND = "safe_browser_api_not_found";
|
|
13109
13105
|
var EXTERNAL_CAMERA_NOT_STARTED = "external_camera_not_started";
|
|
13110
13106
|
|
|
13111
13107
|
// src/modules/objectDetection.ts
|
|
@@ -13303,6 +13299,7 @@ var CameraRecorder = class {
|
|
|
13303
13299
|
this.internalClonedStream = null;
|
|
13304
13300
|
this.videoElement = null;
|
|
13305
13301
|
this.duration = 0;
|
|
13302
|
+
this.stopped = false;
|
|
13306
13303
|
this.currentRetries = 0;
|
|
13307
13304
|
this.packageCount = 0;
|
|
13308
13305
|
this.noiseWait = 20;
|
|
@@ -13512,6 +13509,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13512
13509
|
throw error;
|
|
13513
13510
|
}
|
|
13514
13511
|
}
|
|
13512
|
+
this.stopped = false;
|
|
13515
13513
|
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
13514
|
await this.initializeDetectors();
|
|
13517
13515
|
}
|
|
@@ -13531,6 +13529,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13531
13529
|
async stopRecording() {
|
|
13532
13530
|
var _a2, _b, _c2;
|
|
13533
13531
|
console.log("Camera Recorder stopRecording");
|
|
13532
|
+
this.stopped = true;
|
|
13534
13533
|
this.isCanvasLoopActive = false;
|
|
13535
13534
|
this.faceDetection && this.faceDetection.detecting && this.faceDetection.stopDetection();
|
|
13536
13535
|
this.objectDetection && this.objectDetection.detecting && this.objectDetection.stopDetection();
|
|
@@ -13539,7 +13538,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13539
13538
|
this.volumeMeter && this.volumeMeter.stop();
|
|
13540
13539
|
this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
|
|
13541
13540
|
this.recordingStop && await this.recordingStop();
|
|
13542
|
-
this.duration = this.getDuration();
|
|
13541
|
+
this.duration = this.getDuration ? this.getDuration() : 0;
|
|
13543
13542
|
try {
|
|
13544
13543
|
if (this.animationFrameId) {
|
|
13545
13544
|
cancelAnimationFrame(this.animationFrameId);
|
|
@@ -13710,24 +13709,9 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13710
13709
|
type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
|
|
13711
13710
|
});
|
|
13712
13711
|
const fixedBlob = await (0, import_fix_webm_duration.default)(rawBlob, this.duration);
|
|
13713
|
-
const file = new File(
|
|
13714
|
-
[rawBlob],
|
|
13715
|
-
`EP_${session.id}_camera_0.webm`,
|
|
13716
|
-
{ type: rawBlob.type }
|
|
13717
|
-
);
|
|
13718
|
-
session.addRecording({
|
|
13719
|
-
device: `Audio
|
|
13720
|
-
Sample Rate: ${settingsAudio.sampleRate}
|
|
13721
|
-
Sample Size: ${settingsAudio.sampleSize}
|
|
13722
|
-
|
|
13723
|
-
Video:
|
|
13724
|
-
${JSON.stringify(this.recorderOptions)}`,
|
|
13725
|
-
file,
|
|
13726
|
-
origin: "Camera" /* Camera */
|
|
13727
|
-
});
|
|
13728
13712
|
const fileWithDuration = new File(
|
|
13729
13713
|
[fixedBlob],
|
|
13730
|
-
`EP_${session.id}
|
|
13714
|
+
`EP_${session.id}_camera_0.webm`,
|
|
13731
13715
|
{ type: rawBlob.type }
|
|
13732
13716
|
);
|
|
13733
13717
|
session.addRecording({
|
|
@@ -18794,6 +18778,49 @@ var Auth = class {
|
|
|
18794
18778
|
}
|
|
18795
18779
|
};
|
|
18796
18780
|
|
|
18781
|
+
// src/new-flow/backend/SafeBrowserBackendService.ts
|
|
18782
|
+
var SafeBrowserBackendService = class {
|
|
18783
|
+
constructor() {
|
|
18784
|
+
this.baseUrl = "http://localhost:7485/Station/api";
|
|
18785
|
+
}
|
|
18786
|
+
async isAlive() {
|
|
18787
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
18788
|
+
path: `/health`,
|
|
18789
|
+
method: "GET",
|
|
18790
|
+
jwt: this.token
|
|
18791
|
+
}).catch((error) => {
|
|
18792
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18793
|
+
});
|
|
18794
|
+
return paramsConfig.data;
|
|
18795
|
+
}
|
|
18796
|
+
async setProctoringId(proctoringId2) {
|
|
18797
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
18798
|
+
path: `/update-station/` + proctoringId2,
|
|
18799
|
+
method: "POST",
|
|
18800
|
+
jwt: this.token
|
|
18801
|
+
}).catch((error) => {
|
|
18802
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18803
|
+
});
|
|
18804
|
+
return paramsConfig.data;
|
|
18805
|
+
}
|
|
18806
|
+
async makeRequestAxios(data) {
|
|
18807
|
+
const { path, method, body, jwt } = data;
|
|
18808
|
+
const resp = await axios_default.request({
|
|
18809
|
+
url: this.baseUrl + path,
|
|
18810
|
+
method,
|
|
18811
|
+
headers: {
|
|
18812
|
+
Authorization: `Bearer ${jwt}`,
|
|
18813
|
+
"Access-Control-Allow-Origin": "*"
|
|
18814
|
+
},
|
|
18815
|
+
data: body
|
|
18816
|
+
});
|
|
18817
|
+
if (resp.status >= 400) {
|
|
18818
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18819
|
+
}
|
|
18820
|
+
return resp;
|
|
18821
|
+
}
|
|
18822
|
+
};
|
|
18823
|
+
|
|
18797
18824
|
// node_modules/@microsoft/signalr/dist/esm/Errors.js
|
|
18798
18825
|
var HttpError = class extends Error {
|
|
18799
18826
|
/** Constructs a new instance of {@link @microsoft/signalr.HttpError}.
|
|
@@ -22556,6 +22583,7 @@ var Proctoring = class {
|
|
|
22556
22583
|
async internalOnRealtimeAlerts(response) {
|
|
22557
22584
|
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
22585
|
if (response.status === "ALERT") {
|
|
22586
|
+
if (this.allRecorders.cameraRecorder.stopped) return;
|
|
22559
22587
|
await this.backend.startRealtimeAlert({
|
|
22560
22588
|
proctoringId: this.proctoringId,
|
|
22561
22589
|
begin: response.begin,
|
|
@@ -22563,6 +22591,7 @@ var Proctoring = class {
|
|
|
22563
22591
|
alert: this.convertRealtimeCategoryToAlertCategory(response.category)
|
|
22564
22592
|
});
|
|
22565
22593
|
} else if (response.status === "OK") {
|
|
22594
|
+
if (this.allRecorders.cameraRecorder.stopped && response.description !== "face_stop") return;
|
|
22566
22595
|
await this.stopRealtimeAlert(response);
|
|
22567
22596
|
}
|
|
22568
22597
|
}
|
|
@@ -22645,7 +22674,7 @@ var Proctoring = class {
|
|
|
22645
22674
|
recorders.push(screenRecorder);
|
|
22646
22675
|
}
|
|
22647
22676
|
this.recorder = new ProctoringRecorder(this.proctoringSession, recorders);
|
|
22648
|
-
return {
|
|
22677
|
+
return { screenRecorder, alertRecorder, noiseRecorder, cameraRecorder };
|
|
22649
22678
|
}
|
|
22650
22679
|
async login() {
|
|
22651
22680
|
var _a2;
|
|
@@ -22678,6 +22707,13 @@ var Proctoring = class {
|
|
|
22678
22707
|
} catch (error) {
|
|
22679
22708
|
throw SPY_SCAN_API_NOT_FOUND;
|
|
22680
22709
|
}
|
|
22710
|
+
try {
|
|
22711
|
+
if (options == null ? void 0 : options.useSafeBrowserAPI) {
|
|
22712
|
+
await this.safeBrowserBackendService.isAlive();
|
|
22713
|
+
}
|
|
22714
|
+
} catch (error) {
|
|
22715
|
+
throw SAFE_BROWSER_API_NOT_FOUND;
|
|
22716
|
+
}
|
|
22681
22717
|
if (this.state != "Stop" /* Stop */) {
|
|
22682
22718
|
throw PROCTORING_ALREADY_STARTED;
|
|
22683
22719
|
}
|
|
@@ -22713,6 +22749,13 @@ var Proctoring = class {
|
|
|
22713
22749
|
this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
|
|
22714
22750
|
this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
|
|
22715
22751
|
this.proctoringSession.setProctoringId(this.proctoringId);
|
|
22752
|
+
try {
|
|
22753
|
+
if (options == null ? void 0 : options.useSafeBrowserAPI) {
|
|
22754
|
+
await this.safeBrowserBackendService.setProctoringId(this.proctoringId);
|
|
22755
|
+
}
|
|
22756
|
+
} catch (error) {
|
|
22757
|
+
throw SAFE_BROWSER_API_NOT_FOUND;
|
|
22758
|
+
}
|
|
22716
22759
|
try {
|
|
22717
22760
|
console.log("Starting recorders");
|
|
22718
22761
|
await this.recorder.startAll();
|
|
@@ -22934,7 +22977,7 @@ Error: ` + error
|
|
|
22934
22977
|
}
|
|
22935
22978
|
}
|
|
22936
22979
|
async initConfig(useGeolocation) {
|
|
22937
|
-
var _a2;
|
|
22980
|
+
var _a2, _b;
|
|
22938
22981
|
try {
|
|
22939
22982
|
const paramsConfig = await this.backend.getParamsConfig(
|
|
22940
22983
|
this.context
|
|
@@ -22966,6 +23009,9 @@ Error: ` + error
|
|
|
22966
23009
|
onRealtimeAlertsCallback: (response) => this.onRealtimeAlertsCallback(response)
|
|
22967
23010
|
});
|
|
22968
23011
|
}
|
|
23012
|
+
if ((_b = this.sessionOptions) == null ? void 0 : _b.useSafeBrowserAPI) {
|
|
23013
|
+
this.safeBrowserBackendService = new SafeBrowserBackendService();
|
|
23014
|
+
}
|
|
22969
23015
|
} catch (err) {
|
|
22970
23016
|
this.proctoringId && trackers.registerError(this.proctoringId, "Erro no initConfig!");
|
|
22971
23017
|
await this.cancel();
|
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");
|
|
@@ -30924,10 +30919,10 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30924
30919
|
resolvePromise = resolve;
|
|
30925
30920
|
mediaRecorder.onstop = () => {
|
|
30926
30921
|
console.log("recorder onstop");
|
|
30927
|
-
|
|
30928
|
-
console.log("duration no onstop",
|
|
30922
|
+
duration = Date.now() - startTime.getTime() || 0;
|
|
30923
|
+
console.log("duration no onstop", duration);
|
|
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);
|
|
@@ -31203,6 +31198,7 @@ var BROWSER_NOT_SUPPORTED = "browser_not_supported";
|
|
|
31203
31198
|
var TOKEN_MISSING = "token_missing";
|
|
31204
31199
|
var CREDENTIALS_MISSING = "credentials_missing";
|
|
31205
31200
|
var SPY_SCAN_API_NOT_FOUND = "spy_scan_api_not_found";
|
|
31201
|
+
var SAFE_BROWSER_API_NOT_FOUND = "safe_browser_api_not_found";
|
|
31206
31202
|
var EXTERNAL_CAMERA_NOT_STARTED = "external_camera_not_started";
|
|
31207
31203
|
|
|
31208
31204
|
// src/modules/objectDetection.ts
|
|
@@ -31400,6 +31396,7 @@ var CameraRecorder = class {
|
|
|
31400
31396
|
this.internalClonedStream = null;
|
|
31401
31397
|
this.videoElement = null;
|
|
31402
31398
|
this.duration = 0;
|
|
31399
|
+
this.stopped = false;
|
|
31403
31400
|
this.currentRetries = 0;
|
|
31404
31401
|
this.packageCount = 0;
|
|
31405
31402
|
this.noiseWait = 20;
|
|
@@ -31609,6 +31606,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31609
31606
|
throw error;
|
|
31610
31607
|
}
|
|
31611
31608
|
}
|
|
31609
|
+
this.stopped = false;
|
|
31612
31610
|
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
31611
|
await this.initializeDetectors();
|
|
31614
31612
|
}
|
|
@@ -31628,6 +31626,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31628
31626
|
async stopRecording() {
|
|
31629
31627
|
var _a2, _b, _c2;
|
|
31630
31628
|
console.log("Camera Recorder stopRecording");
|
|
31629
|
+
this.stopped = true;
|
|
31631
31630
|
this.isCanvasLoopActive = false;
|
|
31632
31631
|
this.faceDetection && this.faceDetection.detecting && this.faceDetection.stopDetection();
|
|
31633
31632
|
this.objectDetection && this.objectDetection.detecting && this.objectDetection.stopDetection();
|
|
@@ -31636,7 +31635,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31636
31635
|
this.volumeMeter && this.volumeMeter.stop();
|
|
31637
31636
|
this.intervalNoiseDetection && clearInterval(this.intervalNoiseDetection);
|
|
31638
31637
|
this.recordingStop && await this.recordingStop();
|
|
31639
|
-
this.duration = this.getDuration();
|
|
31638
|
+
this.duration = this.getDuration ? this.getDuration() : 0;
|
|
31640
31639
|
try {
|
|
31641
31640
|
if (this.animationFrameId) {
|
|
31642
31641
|
cancelAnimationFrame(this.animationFrameId);
|
|
@@ -31807,24 +31806,9 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31807
31806
|
type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
|
|
31808
31807
|
});
|
|
31809
31808
|
const fixedBlob = await (0, import_fix_webm_duration.default)(rawBlob, this.duration);
|
|
31810
|
-
const file = new File(
|
|
31811
|
-
[rawBlob],
|
|
31812
|
-
`EP_${session.id}_camera_0.webm`,
|
|
31813
|
-
{ type: rawBlob.type }
|
|
31814
|
-
);
|
|
31815
|
-
session.addRecording({
|
|
31816
|
-
device: `Audio
|
|
31817
|
-
Sample Rate: ${settingsAudio.sampleRate}
|
|
31818
|
-
Sample Size: ${settingsAudio.sampleSize}
|
|
31819
|
-
|
|
31820
|
-
Video:
|
|
31821
|
-
${JSON.stringify(this.recorderOptions)}`,
|
|
31822
|
-
file,
|
|
31823
|
-
origin: "Camera" /* Camera */
|
|
31824
|
-
});
|
|
31825
31809
|
const fileWithDuration = new File(
|
|
31826
31810
|
[fixedBlob],
|
|
31827
|
-
`EP_${session.id}
|
|
31811
|
+
`EP_${session.id}_camera_0.webm`,
|
|
31828
31812
|
{ type: rawBlob.type }
|
|
31829
31813
|
);
|
|
31830
31814
|
session.addRecording({
|
|
@@ -36891,6 +36875,49 @@ var Auth = class {
|
|
|
36891
36875
|
}
|
|
36892
36876
|
};
|
|
36893
36877
|
|
|
36878
|
+
// src/new-flow/backend/SafeBrowserBackendService.ts
|
|
36879
|
+
var SafeBrowserBackendService = class {
|
|
36880
|
+
constructor() {
|
|
36881
|
+
this.baseUrl = "http://localhost:7485/Station/api";
|
|
36882
|
+
}
|
|
36883
|
+
async isAlive() {
|
|
36884
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
36885
|
+
path: `/health`,
|
|
36886
|
+
method: "GET",
|
|
36887
|
+
jwt: this.token
|
|
36888
|
+
}).catch((error) => {
|
|
36889
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
36890
|
+
});
|
|
36891
|
+
return paramsConfig.data;
|
|
36892
|
+
}
|
|
36893
|
+
async setProctoringId(proctoringId2) {
|
|
36894
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
36895
|
+
path: `/update-station/` + proctoringId2,
|
|
36896
|
+
method: "POST",
|
|
36897
|
+
jwt: this.token
|
|
36898
|
+
}).catch((error) => {
|
|
36899
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
36900
|
+
});
|
|
36901
|
+
return paramsConfig.data;
|
|
36902
|
+
}
|
|
36903
|
+
async makeRequestAxios(data) {
|
|
36904
|
+
const { path, method, body, jwt } = data;
|
|
36905
|
+
const resp = await axios_default.request({
|
|
36906
|
+
url: this.baseUrl + path,
|
|
36907
|
+
method,
|
|
36908
|
+
headers: {
|
|
36909
|
+
Authorization: `Bearer ${jwt}`,
|
|
36910
|
+
"Access-Control-Allow-Origin": "*"
|
|
36911
|
+
},
|
|
36912
|
+
data: body
|
|
36913
|
+
});
|
|
36914
|
+
if (resp.status >= 400) {
|
|
36915
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
36916
|
+
}
|
|
36917
|
+
return resp;
|
|
36918
|
+
}
|
|
36919
|
+
};
|
|
36920
|
+
|
|
36894
36921
|
// src/proctoring/ExternalCameraChecker.ts
|
|
36895
36922
|
var import_signalr = __toESM(require_cjs());
|
|
36896
36923
|
var import_qrcode = __toESM(require_lib());
|
|
@@ -37805,6 +37832,7 @@ var Proctoring = class {
|
|
|
37805
37832
|
async internalOnRealtimeAlerts(response) {
|
|
37806
37833
|
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
37834
|
if (response.status === "ALERT") {
|
|
37835
|
+
if (this.allRecorders.cameraRecorder.stopped) return;
|
|
37808
37836
|
await this.backend.startRealtimeAlert({
|
|
37809
37837
|
proctoringId: this.proctoringId,
|
|
37810
37838
|
begin: response.begin,
|
|
@@ -37812,6 +37840,7 @@ var Proctoring = class {
|
|
|
37812
37840
|
alert: this.convertRealtimeCategoryToAlertCategory(response.category)
|
|
37813
37841
|
});
|
|
37814
37842
|
} else if (response.status === "OK") {
|
|
37843
|
+
if (this.allRecorders.cameraRecorder.stopped && response.description !== "face_stop") return;
|
|
37815
37844
|
await this.stopRealtimeAlert(response);
|
|
37816
37845
|
}
|
|
37817
37846
|
}
|
|
@@ -37894,7 +37923,7 @@ var Proctoring = class {
|
|
|
37894
37923
|
recorders.push(screenRecorder);
|
|
37895
37924
|
}
|
|
37896
37925
|
this.recorder = new ProctoringRecorder(this.proctoringSession, recorders);
|
|
37897
|
-
return {
|
|
37926
|
+
return { screenRecorder, alertRecorder, noiseRecorder, cameraRecorder };
|
|
37898
37927
|
}
|
|
37899
37928
|
async login() {
|
|
37900
37929
|
var _a2;
|
|
@@ -37927,6 +37956,13 @@ var Proctoring = class {
|
|
|
37927
37956
|
} catch (error) {
|
|
37928
37957
|
throw SPY_SCAN_API_NOT_FOUND;
|
|
37929
37958
|
}
|
|
37959
|
+
try {
|
|
37960
|
+
if (options == null ? void 0 : options.useSafeBrowserAPI) {
|
|
37961
|
+
await this.safeBrowserBackendService.isAlive();
|
|
37962
|
+
}
|
|
37963
|
+
} catch (error) {
|
|
37964
|
+
throw SAFE_BROWSER_API_NOT_FOUND;
|
|
37965
|
+
}
|
|
37930
37966
|
if (this.state != "Stop" /* Stop */) {
|
|
37931
37967
|
throw PROCTORING_ALREADY_STARTED;
|
|
37932
37968
|
}
|
|
@@ -37962,6 +37998,13 @@ var Proctoring = class {
|
|
|
37962
37998
|
this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
|
|
37963
37999
|
this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
|
|
37964
38000
|
this.proctoringSession.setProctoringId(this.proctoringId);
|
|
38001
|
+
try {
|
|
38002
|
+
if (options == null ? void 0 : options.useSafeBrowserAPI) {
|
|
38003
|
+
await this.safeBrowserBackendService.setProctoringId(this.proctoringId);
|
|
38004
|
+
}
|
|
38005
|
+
} catch (error) {
|
|
38006
|
+
throw SAFE_BROWSER_API_NOT_FOUND;
|
|
38007
|
+
}
|
|
37965
38008
|
try {
|
|
37966
38009
|
console.log("Starting recorders");
|
|
37967
38010
|
await this.recorder.startAll();
|
|
@@ -38183,7 +38226,7 @@ Error: ` + error
|
|
|
38183
38226
|
}
|
|
38184
38227
|
}
|
|
38185
38228
|
async initConfig(useGeolocation) {
|
|
38186
|
-
var _a2;
|
|
38229
|
+
var _a2, _b;
|
|
38187
38230
|
try {
|
|
38188
38231
|
const paramsConfig = await this.backend.getParamsConfig(
|
|
38189
38232
|
this.context
|
|
@@ -38215,6 +38258,9 @@ Error: ` + error
|
|
|
38215
38258
|
onRealtimeAlertsCallback: (response) => this.onRealtimeAlertsCallback(response)
|
|
38216
38259
|
});
|
|
38217
38260
|
}
|
|
38261
|
+
if ((_b = this.sessionOptions) == null ? void 0 : _b.useSafeBrowserAPI) {
|
|
38262
|
+
this.safeBrowserBackendService = new SafeBrowserBackendService();
|
|
38263
|
+
}
|
|
38218
38264
|
} catch (err) {
|
|
38219
38265
|
this.proctoringId && trackers.registerError(this.proctoringId, "Erro no initConfig!");
|
|
38220
38266
|
await this.cancel();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class SafeBrowserBackendService {
|
|
2
|
+
private readonly baseUrl;
|
|
3
|
+
token: string;
|
|
4
|
+
constructor();
|
|
5
|
+
isAlive(): Promise<boolean>;
|
|
6
|
+
setProctoringId(proctoringId: string): Promise<any>;
|
|
7
|
+
makeRequestAxios<R>(data: {
|
|
8
|
+
path: string;
|
|
9
|
+
method: "GET" | "POST" | "PUT";
|
|
10
|
+
body?: any;
|
|
11
|
+
jwt: string;
|
|
12
|
+
}): Promise<R>;
|
|
13
|
+
}
|
package/package.json
CHANGED