easyproctor-hml 0.0.60 → 0.0.62
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 +229 -202
- package/index.js +229 -202
- package/interfaces/ParamsConfig.d.ts +1 -0
- package/new-flow/recorders/CameraRecorder.d.ts +0 -1
- package/package.json +1 -1
- package/proctoring/DeviceChecker.d.ts +5 -1
- package/unpkg/easyproctor.min.js +21 -21
- package/plugins/mouseTracker.d.ts +0 -15
- package/unpkg/easyproctor.min.js.map +0 -7
package/esm/index.js
CHANGED
|
@@ -17335,8 +17335,13 @@ var UploadService = class {
|
|
|
17335
17335
|
onUploadProgress: (p3) => {
|
|
17336
17336
|
progressCallback({ loadedBytes: p3.loaded });
|
|
17337
17337
|
}
|
|
17338
|
-
}).then(() =>
|
|
17339
|
-
|
|
17338
|
+
}).then((response) => {
|
|
17339
|
+
if (response.status == 200 || response.status == 201) {
|
|
17340
|
+
this.contImages++;
|
|
17341
|
+
return true;
|
|
17342
|
+
} else
|
|
17343
|
+
return false;
|
|
17344
|
+
}).catch(() => false).finally(() => {
|
|
17340
17345
|
});
|
|
17341
17346
|
return {
|
|
17342
17347
|
storage: "upload" /* none */,
|
|
@@ -21807,7 +21812,8 @@ var CameraRecorder = class {
|
|
|
21807
21812
|
this.blobs = [];
|
|
21808
21813
|
this.paramsConfig = {
|
|
21809
21814
|
audioBehaviourParameters: {
|
|
21810
|
-
recordingBitrate: 128
|
|
21815
|
+
recordingBitrate: 128,
|
|
21816
|
+
noiseLimit: 40
|
|
21811
21817
|
},
|
|
21812
21818
|
imageBehaviourParameters: {
|
|
21813
21819
|
frames: 40,
|
|
@@ -21998,17 +22004,23 @@ Setting: ${settings}`);
|
|
|
21998
22004
|
const packSize = this.paramsConfig.imageBehaviourParameters.uploadInterval;
|
|
21999
22005
|
this.sendFrameInterval = setInterval(async () => {
|
|
22000
22006
|
if (this.upload && this.backendToken) {
|
|
22001
|
-
|
|
22007
|
+
let count = 0;
|
|
22008
|
+
while (count < packSize) {
|
|
22002
22009
|
if (this.filesToUpload.length == 0)
|
|
22003
22010
|
break;
|
|
22004
|
-
await this.upload.uploadImages(
|
|
22011
|
+
const uploadResult = await this.upload.uploadImages(
|
|
22005
22012
|
{
|
|
22006
22013
|
file: this.filesToUpload[0]
|
|
22007
22014
|
},
|
|
22008
22015
|
this.backendToken,
|
|
22009
22016
|
packSize
|
|
22010
22017
|
);
|
|
22011
|
-
|
|
22018
|
+
if (uploadResult.uploaded == true) {
|
|
22019
|
+
await this.filesToUpload.shift();
|
|
22020
|
+
count++;
|
|
22021
|
+
} else {
|
|
22022
|
+
console.log("erro no upload: " + this.filesToUpload[0].name);
|
|
22023
|
+
}
|
|
22012
22024
|
}
|
|
22013
22025
|
}
|
|
22014
22026
|
}, packSize * 1e3);
|
|
@@ -22050,7 +22062,7 @@ Setting: ${settings}`);
|
|
|
22050
22062
|
});
|
|
22051
22063
|
}
|
|
22052
22064
|
onNoiseDetected() {
|
|
22053
|
-
var _a2;
|
|
22065
|
+
var _a2, _b;
|
|
22054
22066
|
if (!this.volumeMeter && this.cameraStream) {
|
|
22055
22067
|
this.volumeMeter = new VolumeMeter(this.cameraStream);
|
|
22056
22068
|
this.volumeMeter.start().catch((e3) => {
|
|
@@ -22058,7 +22070,7 @@ Setting: ${settings}`);
|
|
|
22058
22070
|
this.volumeMeter = void 0;
|
|
22059
22071
|
});
|
|
22060
22072
|
}
|
|
22061
|
-
if (((_a2 = this.volumeMeter) == null ? void 0 : _a2.getVolume()) >= (this.
|
|
22073
|
+
if (((_a2 = this.volumeMeter) == null ? void 0 : _a2.getVolume()) >= (((_b = this.paramsConfig.audioBehaviourParameters) == null ? void 0 : _b.noiseLimit) || 40)) {
|
|
22062
22074
|
if (this.noiseWait >= 20) {
|
|
22063
22075
|
this.options.onRealtimeAlertsCallback({
|
|
22064
22076
|
status: "ALERT",
|
|
@@ -22387,9 +22399,193 @@ function validatePartialVideoOptions(options) {
|
|
|
22387
22399
|
}
|
|
22388
22400
|
}
|
|
22389
22401
|
|
|
22402
|
+
// src/new-flow/backend/BackendService.ts
|
|
22403
|
+
var DEV_BASE_URL = "https://proctoring-api-dev.easyproctor.tech/api";
|
|
22404
|
+
var HOMOL_BASE_URL = "https://proctoring-api-hml.easyproctor.tech/api";
|
|
22405
|
+
var PROD_BASE_URL = "https://proctoring-api.easyproctor.tech/api";
|
|
22406
|
+
var BackendService = class {
|
|
22407
|
+
constructor(options) {
|
|
22408
|
+
this.options = options;
|
|
22409
|
+
this.baseUrl = this.selectBaseUrl(options.type);
|
|
22410
|
+
this.token = options.token;
|
|
22411
|
+
}
|
|
22412
|
+
selectBaseUrl(type) {
|
|
22413
|
+
if (type === "dev") {
|
|
22414
|
+
return DEV_BASE_URL;
|
|
22415
|
+
} else if (type === "homol") {
|
|
22416
|
+
return HOMOL_BASE_URL;
|
|
22417
|
+
} else if (type === "prod") {
|
|
22418
|
+
return PROD_BASE_URL;
|
|
22419
|
+
} else {
|
|
22420
|
+
return PROD_BASE_URL;
|
|
22421
|
+
}
|
|
22422
|
+
}
|
|
22423
|
+
async loginAuth(cpf, base64) {
|
|
22424
|
+
return await this.makeRequest({
|
|
22425
|
+
path: `/Auth`,
|
|
22426
|
+
method: "POST",
|
|
22427
|
+
body: {
|
|
22428
|
+
emailOrCpf: cpf,
|
|
22429
|
+
key: base64
|
|
22430
|
+
}
|
|
22431
|
+
});
|
|
22432
|
+
}
|
|
22433
|
+
async confirmStart(proctoringOptions, proctoringType, latitude, longitude) {
|
|
22434
|
+
return await this.makeRequest({
|
|
22435
|
+
path: `/proctoring/start/${proctoringOptions.examId}`,
|
|
22436
|
+
method: "POST",
|
|
22437
|
+
body: {
|
|
22438
|
+
clientId: proctoringOptions.clientId,
|
|
22439
|
+
proctoringType,
|
|
22440
|
+
latitude,
|
|
22441
|
+
longitude
|
|
22442
|
+
},
|
|
22443
|
+
jwt: proctoringOptions.token
|
|
22444
|
+
});
|
|
22445
|
+
}
|
|
22446
|
+
async getParamsConfig(proctoringOptions) {
|
|
22447
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
22448
|
+
path: `/Client/params`,
|
|
22449
|
+
method: "GET",
|
|
22450
|
+
jwt: proctoringOptions.token
|
|
22451
|
+
}).catch((error) => {
|
|
22452
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
22453
|
+
});
|
|
22454
|
+
return paramsConfig.data;
|
|
22455
|
+
}
|
|
22456
|
+
async getSignedUrlImage(token, body) {
|
|
22457
|
+
const url = await this.makeRequestAxios({
|
|
22458
|
+
path: `/upload/signed-url-batch`,
|
|
22459
|
+
method: "POST",
|
|
22460
|
+
jwt: token,
|
|
22461
|
+
body
|
|
22462
|
+
});
|
|
22463
|
+
return url.data;
|
|
22464
|
+
}
|
|
22465
|
+
async getSignedUrl(token, file, proctoringId) {
|
|
22466
|
+
const url = await this.makeRequestAxios({
|
|
22467
|
+
path: `/upload/signed-url`,
|
|
22468
|
+
method: "POST",
|
|
22469
|
+
jwt: token,
|
|
22470
|
+
body: {
|
|
22471
|
+
objectName: `${proctoringId}/${file.name}`,
|
|
22472
|
+
contentType: file.type
|
|
22473
|
+
}
|
|
22474
|
+
});
|
|
22475
|
+
return url.data;
|
|
22476
|
+
}
|
|
22477
|
+
async saveScreenAlerts(proctoringOptions, proctoringSession) {
|
|
22478
|
+
await this.makeRequest({
|
|
22479
|
+
path: "/proctoring/save-screen",
|
|
22480
|
+
method: "POST",
|
|
22481
|
+
jwt: proctoringOptions.token,
|
|
22482
|
+
body: {
|
|
22483
|
+
proctoringId: proctoringSession.id,
|
|
22484
|
+
alerts: proctoringSession.alerts
|
|
22485
|
+
}
|
|
22486
|
+
});
|
|
22487
|
+
}
|
|
22488
|
+
async finishAndSendUrls(proctoringOptions, proctoringSession) {
|
|
22489
|
+
await this.makeRequest({
|
|
22490
|
+
path: `/proctoring/finish/${proctoringOptions.examId}`,
|
|
22491
|
+
method: "POST",
|
|
22492
|
+
body: {
|
|
22493
|
+
endDate: new Date().toISOString(),
|
|
22494
|
+
videoCameraUrl: "",
|
|
22495
|
+
audioCameraUrl: "",
|
|
22496
|
+
videoScreenUrl: ""
|
|
22497
|
+
},
|
|
22498
|
+
jwt: proctoringOptions.token
|
|
22499
|
+
});
|
|
22500
|
+
}
|
|
22501
|
+
async log(eventName, properties) {
|
|
22502
|
+
let entryType;
|
|
22503
|
+
if ((properties == null ? void 0 : properties.success) !== null && (properties == null ? void 0 : properties.success) !== void 0) {
|
|
22504
|
+
entryType = properties.success ? "4" : "1";
|
|
22505
|
+
} else {
|
|
22506
|
+
entryType = "4";
|
|
22507
|
+
}
|
|
22508
|
+
return await this.makeRequest({
|
|
22509
|
+
path: `/Log`,
|
|
22510
|
+
method: "POST",
|
|
22511
|
+
body: {
|
|
22512
|
+
entryType,
|
|
22513
|
+
eventName,
|
|
22514
|
+
message: properties
|
|
22515
|
+
},
|
|
22516
|
+
jwt: this.token
|
|
22517
|
+
});
|
|
22518
|
+
}
|
|
22519
|
+
async getServerHour(token) {
|
|
22520
|
+
return await this.makeRequest({
|
|
22521
|
+
path: `/Proctoring/server-hour`,
|
|
22522
|
+
method: "GET",
|
|
22523
|
+
jwt: token
|
|
22524
|
+
});
|
|
22525
|
+
}
|
|
22526
|
+
async makeRequest(data) {
|
|
22527
|
+
const { path, method, body, jwt } = data;
|
|
22528
|
+
const resp = await fetch(this.baseUrl + path, {
|
|
22529
|
+
method,
|
|
22530
|
+
body: body != null ? JSON.stringify(body) : void 0,
|
|
22531
|
+
headers: {
|
|
22532
|
+
Authorization: `Bearer ${jwt}`,
|
|
22533
|
+
"Content-Type": "application/json",
|
|
22534
|
+
"Access-Control-Allow-Origin": "*"
|
|
22535
|
+
}
|
|
22536
|
+
});
|
|
22537
|
+
if (resp.status >= 400) {
|
|
22538
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
22539
|
+
}
|
|
22540
|
+
const content = resp.headers.get("content-type");
|
|
22541
|
+
const isJson = content ? content.includes("application/json") : false;
|
|
22542
|
+
const responseData = isJson ? await resp.json() : null;
|
|
22543
|
+
return responseData;
|
|
22544
|
+
}
|
|
22545
|
+
async makeRequestAxios(data) {
|
|
22546
|
+
const { path, method, body, jwt } = data;
|
|
22547
|
+
const resp = await axios_default.request({
|
|
22548
|
+
url: this.baseUrl + path,
|
|
22549
|
+
method,
|
|
22550
|
+
headers: {
|
|
22551
|
+
Authorization: `Bearer ${jwt}`,
|
|
22552
|
+
"Access-Control-Allow-Origin": "*"
|
|
22553
|
+
},
|
|
22554
|
+
data: body
|
|
22555
|
+
});
|
|
22556
|
+
if (resp.status >= 400) {
|
|
22557
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
22558
|
+
}
|
|
22559
|
+
return resp;
|
|
22560
|
+
}
|
|
22561
|
+
async makeRequestPUT(data) {
|
|
22562
|
+
const { url, method, body, jwt } = data;
|
|
22563
|
+
const resp = await fetch(url, {
|
|
22564
|
+
method,
|
|
22565
|
+
body: body != null ? JSON.stringify(body) : void 0,
|
|
22566
|
+
headers: {
|
|
22567
|
+
Accept: "*/*",
|
|
22568
|
+
"Accept-Encoding": "gzip, deflate, br",
|
|
22569
|
+
Connection: "keep-alive",
|
|
22570
|
+
"aeg-event-type": "Notification",
|
|
22571
|
+
"Content-Type": "application/json",
|
|
22572
|
+
"Cache-Control": "no-cache",
|
|
22573
|
+
"x-ms-blob-type": "BlockBlob"
|
|
22574
|
+
}
|
|
22575
|
+
});
|
|
22576
|
+
if (resp.status >= 400) {
|
|
22577
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
22578
|
+
}
|
|
22579
|
+
const content = resp.headers.get("content-type");
|
|
22580
|
+
const isJson = content ? content.includes("application/json") : false;
|
|
22581
|
+
const responseData = isJson ? await resp.json() : null;
|
|
22582
|
+
return responseData;
|
|
22583
|
+
}
|
|
22584
|
+
};
|
|
22585
|
+
|
|
22390
22586
|
// src/proctoring/DeviceChecker.ts
|
|
22391
22587
|
var DeviceChecker = class {
|
|
22392
|
-
constructor() {
|
|
22588
|
+
constructor(context) {
|
|
22393
22589
|
this.videoOptions = { width: 1080, height: 720, minWidth: 0, minHeight: 0 };
|
|
22394
22590
|
this.volumeMedia = 0;
|
|
22395
22591
|
this.volumeSum = 0;
|
|
@@ -22399,9 +22595,16 @@ var DeviceChecker = class {
|
|
|
22399
22595
|
this.allowedAmbient = true;
|
|
22400
22596
|
this.allowedPositionFace = true;
|
|
22401
22597
|
this.allowedMicrophone = false;
|
|
22598
|
+
this.noiseLimit = 0;
|
|
22402
22599
|
this.faceDetection = new FaceDetection({ onRealtimeAlertsCallback: (response) => this.realtimeAlerts(response) }, { videoBehaviourParameters: { detectFace: true } }, "cameraStream", "liveCheckDevices");
|
|
22600
|
+
this.context = context;
|
|
22601
|
+
this.backend = new BackendService({
|
|
22602
|
+
type: (context == null ? void 0 : context.type) || "prod",
|
|
22603
|
+
token: context.token
|
|
22604
|
+
});
|
|
22403
22605
|
}
|
|
22404
22606
|
async checkDevices(options = getDefaultProctoringOptions, _videoOptions) {
|
|
22607
|
+
var _a2;
|
|
22405
22608
|
try {
|
|
22406
22609
|
this.options = {
|
|
22407
22610
|
...getDefaultProctoringOptions,
|
|
@@ -22411,6 +22614,8 @@ var DeviceChecker = class {
|
|
|
22411
22614
|
allowOnlyFirstMonitor: false
|
|
22412
22615
|
};
|
|
22413
22616
|
this.videoOptions = { ...this.videoOptions, ..._videoOptions };
|
|
22617
|
+
const paramsConfig = await this.backend.getParamsConfig(this.context);
|
|
22618
|
+
this.noiseLimit = ((_a2 = paramsConfig.audioBehaviourParameters) == null ? void 0 : _a2.noiseLimit) || 40;
|
|
22414
22619
|
await this.faceDetection.initializeDetector();
|
|
22415
22620
|
const { cameraId, microphoneId, result } = await this.checkDevicesInterface();
|
|
22416
22621
|
return new Promise((resolve) => {
|
|
@@ -23046,7 +23251,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
|
|
|
23046
23251
|
index < Math.ceil(pillValue) ? item.style.backgroundColor = "rgb(22, 163, 74)" : item.style.backgroundColor = "rgba(0, 0, 0, .3)";
|
|
23047
23252
|
});
|
|
23048
23253
|
volumeText && (volumeText.innerText = value.toFixed(0).toString());
|
|
23049
|
-
if (value > this.
|
|
23254
|
+
if (value > this.noiseLimit) {
|
|
23050
23255
|
ambientVerifyAlert && (ambientVerifyAlert.style.color = "#FF0000");
|
|
23051
23256
|
alertDivAmbientVerify && alertDivAmbientVerify.setAttribute("title", `Ambiente apresentando muito ru\xEDdo!`);
|
|
23052
23257
|
this.allowedAmbient = false;
|
|
@@ -23268,190 +23473,6 @@ var onChangeDevices = class {
|
|
|
23268
23473
|
}
|
|
23269
23474
|
};
|
|
23270
23475
|
|
|
23271
|
-
// src/new-flow/backend/BackendService.ts
|
|
23272
|
-
var DEV_BASE_URL = "https://proctoring-api-dev.easyproctor.tech/api";
|
|
23273
|
-
var HOMOL_BASE_URL = "https://proctoring-api-hml.easyproctor.tech/api";
|
|
23274
|
-
var PROD_BASE_URL = "https://proctoring-api.easyproctor.tech/api";
|
|
23275
|
-
var BackendService = class {
|
|
23276
|
-
constructor(options) {
|
|
23277
|
-
this.options = options;
|
|
23278
|
-
this.baseUrl = this.selectBaseUrl(options.type);
|
|
23279
|
-
this.token = options.token;
|
|
23280
|
-
}
|
|
23281
|
-
selectBaseUrl(type) {
|
|
23282
|
-
if (type === "dev") {
|
|
23283
|
-
return DEV_BASE_URL;
|
|
23284
|
-
} else if (type === "homol") {
|
|
23285
|
-
return HOMOL_BASE_URL;
|
|
23286
|
-
} else if (type === "prod") {
|
|
23287
|
-
return PROD_BASE_URL;
|
|
23288
|
-
} else {
|
|
23289
|
-
return PROD_BASE_URL;
|
|
23290
|
-
}
|
|
23291
|
-
}
|
|
23292
|
-
async loginAuth(cpf, base64) {
|
|
23293
|
-
return await this.makeRequest({
|
|
23294
|
-
path: `/Auth`,
|
|
23295
|
-
method: "POST",
|
|
23296
|
-
body: {
|
|
23297
|
-
emailOrCpf: cpf,
|
|
23298
|
-
key: base64
|
|
23299
|
-
}
|
|
23300
|
-
});
|
|
23301
|
-
}
|
|
23302
|
-
async confirmStart(proctoringOptions, proctoringType, latitude, longitude) {
|
|
23303
|
-
return await this.makeRequest({
|
|
23304
|
-
path: `/proctoring/start/${proctoringOptions.examId}`,
|
|
23305
|
-
method: "POST",
|
|
23306
|
-
body: {
|
|
23307
|
-
clientId: proctoringOptions.clientId,
|
|
23308
|
-
proctoringType,
|
|
23309
|
-
latitude,
|
|
23310
|
-
longitude
|
|
23311
|
-
},
|
|
23312
|
-
jwt: proctoringOptions.token
|
|
23313
|
-
});
|
|
23314
|
-
}
|
|
23315
|
-
async getParamsConfig(proctoringOptions) {
|
|
23316
|
-
const paramsConfig = await this.makeRequestAxios({
|
|
23317
|
-
path: `/Client/params`,
|
|
23318
|
-
method: "GET",
|
|
23319
|
-
jwt: proctoringOptions.token
|
|
23320
|
-
}).catch((error) => {
|
|
23321
|
-
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
23322
|
-
});
|
|
23323
|
-
return paramsConfig.data;
|
|
23324
|
-
}
|
|
23325
|
-
async getSignedUrlImage(token, body) {
|
|
23326
|
-
const url = await this.makeRequestAxios({
|
|
23327
|
-
path: `/upload/signed-url-batch`,
|
|
23328
|
-
method: "POST",
|
|
23329
|
-
jwt: token,
|
|
23330
|
-
body
|
|
23331
|
-
});
|
|
23332
|
-
return url.data;
|
|
23333
|
-
}
|
|
23334
|
-
async getSignedUrl(token, file, proctoringId) {
|
|
23335
|
-
const url = await this.makeRequestAxios({
|
|
23336
|
-
path: `/upload/signed-url`,
|
|
23337
|
-
method: "POST",
|
|
23338
|
-
jwt: token,
|
|
23339
|
-
body: {
|
|
23340
|
-
objectName: `${proctoringId}/${file.name}`,
|
|
23341
|
-
contentType: file.type
|
|
23342
|
-
}
|
|
23343
|
-
});
|
|
23344
|
-
return url.data;
|
|
23345
|
-
}
|
|
23346
|
-
async saveScreenAlerts(proctoringOptions, proctoringSession) {
|
|
23347
|
-
await this.makeRequest({
|
|
23348
|
-
path: "/proctoring/save-screen",
|
|
23349
|
-
method: "POST",
|
|
23350
|
-
jwt: proctoringOptions.token,
|
|
23351
|
-
body: {
|
|
23352
|
-
proctoringId: proctoringSession.id,
|
|
23353
|
-
alerts: proctoringSession.alerts
|
|
23354
|
-
}
|
|
23355
|
-
});
|
|
23356
|
-
}
|
|
23357
|
-
async finishAndSendUrls(proctoringOptions, proctoringSession) {
|
|
23358
|
-
await this.makeRequest({
|
|
23359
|
-
path: `/proctoring/finish/${proctoringOptions.examId}`,
|
|
23360
|
-
method: "POST",
|
|
23361
|
-
body: {
|
|
23362
|
-
endDate: new Date().toISOString(),
|
|
23363
|
-
videoCameraUrl: "",
|
|
23364
|
-
audioCameraUrl: "",
|
|
23365
|
-
videoScreenUrl: ""
|
|
23366
|
-
},
|
|
23367
|
-
jwt: proctoringOptions.token
|
|
23368
|
-
});
|
|
23369
|
-
}
|
|
23370
|
-
async log(eventName, properties) {
|
|
23371
|
-
let entryType;
|
|
23372
|
-
if ((properties == null ? void 0 : properties.success) !== null && (properties == null ? void 0 : properties.success) !== void 0) {
|
|
23373
|
-
entryType = properties.success ? "4" : "1";
|
|
23374
|
-
} else {
|
|
23375
|
-
entryType = "4";
|
|
23376
|
-
}
|
|
23377
|
-
return await this.makeRequest({
|
|
23378
|
-
path: `/Log`,
|
|
23379
|
-
method: "POST",
|
|
23380
|
-
body: {
|
|
23381
|
-
entryType,
|
|
23382
|
-
eventName,
|
|
23383
|
-
message: properties
|
|
23384
|
-
},
|
|
23385
|
-
jwt: this.token
|
|
23386
|
-
});
|
|
23387
|
-
}
|
|
23388
|
-
async getServerHour(token) {
|
|
23389
|
-
return await this.makeRequest({
|
|
23390
|
-
path: `/Proctoring/server-hour`,
|
|
23391
|
-
method: "GET",
|
|
23392
|
-
jwt: token
|
|
23393
|
-
});
|
|
23394
|
-
}
|
|
23395
|
-
async makeRequest(data) {
|
|
23396
|
-
const { path, method, body, jwt } = data;
|
|
23397
|
-
const resp = await fetch(this.baseUrl + path, {
|
|
23398
|
-
method,
|
|
23399
|
-
body: body != null ? JSON.stringify(body) : void 0,
|
|
23400
|
-
headers: {
|
|
23401
|
-
Authorization: `Bearer ${jwt}`,
|
|
23402
|
-
"Content-Type": "application/json",
|
|
23403
|
-
"Access-Control-Allow-Origin": "*"
|
|
23404
|
-
}
|
|
23405
|
-
});
|
|
23406
|
-
if (resp.status >= 400) {
|
|
23407
|
-
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
23408
|
-
}
|
|
23409
|
-
const content = resp.headers.get("content-type");
|
|
23410
|
-
const isJson = content ? content.includes("application/json") : false;
|
|
23411
|
-
const responseData = isJson ? await resp.json() : null;
|
|
23412
|
-
return responseData;
|
|
23413
|
-
}
|
|
23414
|
-
async makeRequestAxios(data) {
|
|
23415
|
-
const { path, method, body, jwt } = data;
|
|
23416
|
-
const resp = await axios_default.request({
|
|
23417
|
-
url: this.baseUrl + path,
|
|
23418
|
-
method,
|
|
23419
|
-
headers: {
|
|
23420
|
-
Authorization: `Bearer ${jwt}`,
|
|
23421
|
-
"Access-Control-Allow-Origin": "*"
|
|
23422
|
-
},
|
|
23423
|
-
data: body
|
|
23424
|
-
});
|
|
23425
|
-
if (resp.status >= 400) {
|
|
23426
|
-
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
23427
|
-
}
|
|
23428
|
-
return resp;
|
|
23429
|
-
}
|
|
23430
|
-
async makeRequestPUT(data) {
|
|
23431
|
-
const { url, method, body, jwt } = data;
|
|
23432
|
-
const resp = await fetch(url, {
|
|
23433
|
-
method,
|
|
23434
|
-
body: body != null ? JSON.stringify(body) : void 0,
|
|
23435
|
-
headers: {
|
|
23436
|
-
Accept: "*/*",
|
|
23437
|
-
"Accept-Encoding": "gzip, deflate, br",
|
|
23438
|
-
Connection: "keep-alive",
|
|
23439
|
-
"aeg-event-type": "Notification",
|
|
23440
|
-
"Content-Type": "application/json",
|
|
23441
|
-
"Cache-Control": "no-cache",
|
|
23442
|
-
"x-ms-blob-type": "BlockBlob"
|
|
23443
|
-
}
|
|
23444
|
-
});
|
|
23445
|
-
if (resp.status >= 400) {
|
|
23446
|
-
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
23447
|
-
}
|
|
23448
|
-
const content = resp.headers.get("content-type");
|
|
23449
|
-
const isJson = content ? content.includes("application/json") : false;
|
|
23450
|
-
const responseData = isJson ? await resp.json() : null;
|
|
23451
|
-
return responseData;
|
|
23452
|
-
}
|
|
23453
|
-
};
|
|
23454
|
-
|
|
23455
23476
|
// src/new-flow/download/downloadService.ts
|
|
23456
23477
|
var DownloadService = class {
|
|
23457
23478
|
constructor(proctoringId) {
|
|
@@ -26000,7 +26021,7 @@ var NoiseRecorder = class {
|
|
|
26000
26021
|
this.examStartTime = Date.now();
|
|
26001
26022
|
await this.createAudioClassifier();
|
|
26002
26023
|
this.audioRecorder = new AudioRecorder(this.paramsConfig.audioBehaviourParameters);
|
|
26003
|
-
this.intervalNoiseDetection = setInterval(() => this.onNoiseDetectedRecord(),
|
|
26024
|
+
this.intervalNoiseDetection = setInterval(() => this.onNoiseDetectedRecord(), 200);
|
|
26004
26025
|
this.streamingAudioClassification();
|
|
26005
26026
|
}
|
|
26006
26027
|
async stopRecording() {
|
|
@@ -26016,7 +26037,7 @@ var NoiseRecorder = class {
|
|
|
26016
26037
|
async saveOnSession(session) {
|
|
26017
26038
|
}
|
|
26018
26039
|
async onNoiseDetectedRecord() {
|
|
26019
|
-
var _a2, _b;
|
|
26040
|
+
var _a2, _b, _c2;
|
|
26020
26041
|
if (!this.volumeMeter && this.cameraRecorder.cameraStream) {
|
|
26021
26042
|
this.volumeMeter = new VolumeMeter(this.cameraRecorder.cameraStream);
|
|
26022
26043
|
this.volumeMeter.start().catch((e3) => {
|
|
@@ -26024,8 +26045,8 @@ var NoiseRecorder = class {
|
|
|
26024
26045
|
this.volumeMeter = void 0;
|
|
26025
26046
|
});
|
|
26026
26047
|
}
|
|
26027
|
-
let noiseLimit = this.
|
|
26028
|
-
const currentVolume = ((
|
|
26048
|
+
let noiseLimit = ((_a2 = this.paramsConfig.audioBehaviourParameters) == null ? void 0 : _a2.noiseLimit) || 40;
|
|
26049
|
+
const currentVolume = ((_b = this.volumeMeter) == null ? void 0 : _b.getVolume()) || 0;
|
|
26029
26050
|
this.isSpeech = this.isSpeech || this.hasDesiredResult(this.audioClassificationResult);
|
|
26030
26051
|
if (!this.isSpeech && !this.recordingInProgress)
|
|
26031
26052
|
noiseLimit = noiseLimit + noiseLimit * 0.25;
|
|
@@ -26037,7 +26058,7 @@ var NoiseRecorder = class {
|
|
|
26037
26058
|
const elapsedTime = Date.now() - this.recordingStartTime;
|
|
26038
26059
|
if (elapsedTime >= 3e3 && this.countLoopTimes > 4 && !this.hasDesiredResult(this.audioClassificationResult)) {
|
|
26039
26060
|
await this.stopSoundRecord();
|
|
26040
|
-
if (((
|
|
26061
|
+
if (((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectSpeech) && this.isSpeech) {
|
|
26041
26062
|
this.onRealtimeAlertsCallback({
|
|
26042
26063
|
status: "ALERT",
|
|
26043
26064
|
description: "Fala detectada",
|
|
@@ -26411,7 +26432,8 @@ var Proctoring = class {
|
|
|
26411
26432
|
this.context = context;
|
|
26412
26433
|
this.paramsConfig = {
|
|
26413
26434
|
audioBehaviourParameters: {
|
|
26414
|
-
recordingBitrate: 128
|
|
26435
|
+
recordingBitrate: 128,
|
|
26436
|
+
noiseLimit: 40
|
|
26415
26437
|
},
|
|
26416
26438
|
imageBehaviourParameters: {
|
|
26417
26439
|
frames: 40,
|
|
@@ -26485,7 +26507,6 @@ var Proctoring = class {
|
|
|
26485
26507
|
{
|
|
26486
26508
|
cameraId: this.sessionOptions.cameraId,
|
|
26487
26509
|
microphoneId: this.sessionOptions.microphoneId,
|
|
26488
|
-
noiseLimit: this.sessionOptions.noiseLimit,
|
|
26489
26510
|
onBufferSizeError: this.sessionOptions.onBufferSizeError,
|
|
26490
26511
|
onBufferSizeErrorCallback: () => this.onBufferSizeErrorCallback(),
|
|
26491
26512
|
proctoringType: this.sessionOptions.proctoringType,
|
|
@@ -26812,7 +26833,13 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
26812
26833
|
token: proctoringOptions.token,
|
|
26813
26834
|
credentials: proctoringOptions.credentials
|
|
26814
26835
|
});
|
|
26815
|
-
const checker = new DeviceChecker(
|
|
26836
|
+
const checker = new DeviceChecker({
|
|
26837
|
+
type: enviromentConfig,
|
|
26838
|
+
clientId: proctoringOptions.clientId,
|
|
26839
|
+
examId: proctoringOptions.examId,
|
|
26840
|
+
token: proctoringOptions.token,
|
|
26841
|
+
credentials: proctoringOptions.credentials
|
|
26842
|
+
});
|
|
26816
26843
|
const photo = new CapturePhoto();
|
|
26817
26844
|
const login = proctoring.login.bind(proctoring);
|
|
26818
26845
|
const start = proctoring.start.bind(proctoring);
|