easyproctor-hml 0.0.61 → 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 +219 -199
- package/index.js +219 -199
- 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/esm/index.js
CHANGED
|
@@ -17335,9 +17335,12 @@ var UploadService = class {
|
|
|
17335
17335
|
onUploadProgress: (p3) => {
|
|
17336
17336
|
progressCallback({ loadedBytes: p3.loaded });
|
|
17337
17337
|
}
|
|
17338
|
-
}).then(() => {
|
|
17339
|
-
|
|
17340
|
-
|
|
17338
|
+
}).then((response) => {
|
|
17339
|
+
if (response.status == 200 || response.status == 201) {
|
|
17340
|
+
this.contImages++;
|
|
17341
|
+
return true;
|
|
17342
|
+
} else
|
|
17343
|
+
return false;
|
|
17341
17344
|
}).catch(() => false).finally(() => {
|
|
17342
17345
|
});
|
|
17343
17346
|
return {
|
|
@@ -21809,7 +21812,8 @@ var CameraRecorder = class {
|
|
|
21809
21812
|
this.blobs = [];
|
|
21810
21813
|
this.paramsConfig = {
|
|
21811
21814
|
audioBehaviourParameters: {
|
|
21812
|
-
recordingBitrate: 128
|
|
21815
|
+
recordingBitrate: 128,
|
|
21816
|
+
noiseLimit: 40
|
|
21813
21817
|
},
|
|
21814
21818
|
imageBehaviourParameters: {
|
|
21815
21819
|
frames: 40,
|
|
@@ -22015,6 +22019,7 @@ Setting: ${settings}`);
|
|
|
22015
22019
|
await this.filesToUpload.shift();
|
|
22016
22020
|
count++;
|
|
22017
22021
|
} else {
|
|
22022
|
+
console.log("erro no upload: " + this.filesToUpload[0].name);
|
|
22018
22023
|
}
|
|
22019
22024
|
}
|
|
22020
22025
|
}
|
|
@@ -22057,7 +22062,7 @@ Setting: ${settings}`);
|
|
|
22057
22062
|
});
|
|
22058
22063
|
}
|
|
22059
22064
|
onNoiseDetected() {
|
|
22060
|
-
var _a2;
|
|
22065
|
+
var _a2, _b;
|
|
22061
22066
|
if (!this.volumeMeter && this.cameraStream) {
|
|
22062
22067
|
this.volumeMeter = new VolumeMeter(this.cameraStream);
|
|
22063
22068
|
this.volumeMeter.start().catch((e3) => {
|
|
@@ -22065,7 +22070,7 @@ Setting: ${settings}`);
|
|
|
22065
22070
|
this.volumeMeter = void 0;
|
|
22066
22071
|
});
|
|
22067
22072
|
}
|
|
22068
|
-
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)) {
|
|
22069
22074
|
if (this.noiseWait >= 20) {
|
|
22070
22075
|
this.options.onRealtimeAlertsCallback({
|
|
22071
22076
|
status: "ALERT",
|
|
@@ -22394,9 +22399,193 @@ function validatePartialVideoOptions(options) {
|
|
|
22394
22399
|
}
|
|
22395
22400
|
}
|
|
22396
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
|
+
|
|
22397
22586
|
// src/proctoring/DeviceChecker.ts
|
|
22398
22587
|
var DeviceChecker = class {
|
|
22399
|
-
constructor() {
|
|
22588
|
+
constructor(context) {
|
|
22400
22589
|
this.videoOptions = { width: 1080, height: 720, minWidth: 0, minHeight: 0 };
|
|
22401
22590
|
this.volumeMedia = 0;
|
|
22402
22591
|
this.volumeSum = 0;
|
|
@@ -22406,9 +22595,16 @@ var DeviceChecker = class {
|
|
|
22406
22595
|
this.allowedAmbient = true;
|
|
22407
22596
|
this.allowedPositionFace = true;
|
|
22408
22597
|
this.allowedMicrophone = false;
|
|
22598
|
+
this.noiseLimit = 0;
|
|
22409
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
|
+
});
|
|
22410
22605
|
}
|
|
22411
22606
|
async checkDevices(options = getDefaultProctoringOptions, _videoOptions) {
|
|
22607
|
+
var _a2;
|
|
22412
22608
|
try {
|
|
22413
22609
|
this.options = {
|
|
22414
22610
|
...getDefaultProctoringOptions,
|
|
@@ -22418,6 +22614,8 @@ var DeviceChecker = class {
|
|
|
22418
22614
|
allowOnlyFirstMonitor: false
|
|
22419
22615
|
};
|
|
22420
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;
|
|
22421
22619
|
await this.faceDetection.initializeDetector();
|
|
22422
22620
|
const { cameraId, microphoneId, result } = await this.checkDevicesInterface();
|
|
22423
22621
|
return new Promise((resolve) => {
|
|
@@ -23053,7 +23251,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
|
|
|
23053
23251
|
index < Math.ceil(pillValue) ? item.style.backgroundColor = "rgb(22, 163, 74)" : item.style.backgroundColor = "rgba(0, 0, 0, .3)";
|
|
23054
23252
|
});
|
|
23055
23253
|
volumeText && (volumeText.innerText = value.toFixed(0).toString());
|
|
23056
|
-
if (value > this.
|
|
23254
|
+
if (value > this.noiseLimit) {
|
|
23057
23255
|
ambientVerifyAlert && (ambientVerifyAlert.style.color = "#FF0000");
|
|
23058
23256
|
alertDivAmbientVerify && alertDivAmbientVerify.setAttribute("title", `Ambiente apresentando muito ru\xEDdo!`);
|
|
23059
23257
|
this.allowedAmbient = false;
|
|
@@ -23275,190 +23473,6 @@ var onChangeDevices = class {
|
|
|
23275
23473
|
}
|
|
23276
23474
|
};
|
|
23277
23475
|
|
|
23278
|
-
// src/new-flow/backend/BackendService.ts
|
|
23279
|
-
var DEV_BASE_URL = "https://proctoring-api-dev.easyproctor.tech/api";
|
|
23280
|
-
var HOMOL_BASE_URL = "https://proctoring-api-hml.easyproctor.tech/api";
|
|
23281
|
-
var PROD_BASE_URL = "https://proctoring-api.easyproctor.tech/api";
|
|
23282
|
-
var BackendService = class {
|
|
23283
|
-
constructor(options) {
|
|
23284
|
-
this.options = options;
|
|
23285
|
-
this.baseUrl = this.selectBaseUrl(options.type);
|
|
23286
|
-
this.token = options.token;
|
|
23287
|
-
}
|
|
23288
|
-
selectBaseUrl(type) {
|
|
23289
|
-
if (type === "dev") {
|
|
23290
|
-
return DEV_BASE_URL;
|
|
23291
|
-
} else if (type === "homol") {
|
|
23292
|
-
return HOMOL_BASE_URL;
|
|
23293
|
-
} else if (type === "prod") {
|
|
23294
|
-
return PROD_BASE_URL;
|
|
23295
|
-
} else {
|
|
23296
|
-
return PROD_BASE_URL;
|
|
23297
|
-
}
|
|
23298
|
-
}
|
|
23299
|
-
async loginAuth(cpf, base64) {
|
|
23300
|
-
return await this.makeRequest({
|
|
23301
|
-
path: `/Auth`,
|
|
23302
|
-
method: "POST",
|
|
23303
|
-
body: {
|
|
23304
|
-
emailOrCpf: cpf,
|
|
23305
|
-
key: base64
|
|
23306
|
-
}
|
|
23307
|
-
});
|
|
23308
|
-
}
|
|
23309
|
-
async confirmStart(proctoringOptions, proctoringType, latitude, longitude) {
|
|
23310
|
-
return await this.makeRequest({
|
|
23311
|
-
path: `/proctoring/start/${proctoringOptions.examId}`,
|
|
23312
|
-
method: "POST",
|
|
23313
|
-
body: {
|
|
23314
|
-
clientId: proctoringOptions.clientId,
|
|
23315
|
-
proctoringType,
|
|
23316
|
-
latitude,
|
|
23317
|
-
longitude
|
|
23318
|
-
},
|
|
23319
|
-
jwt: proctoringOptions.token
|
|
23320
|
-
});
|
|
23321
|
-
}
|
|
23322
|
-
async getParamsConfig(proctoringOptions) {
|
|
23323
|
-
const paramsConfig = await this.makeRequestAxios({
|
|
23324
|
-
path: `/Client/params`,
|
|
23325
|
-
method: "GET",
|
|
23326
|
-
jwt: proctoringOptions.token
|
|
23327
|
-
}).catch((error) => {
|
|
23328
|
-
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
23329
|
-
});
|
|
23330
|
-
return paramsConfig.data;
|
|
23331
|
-
}
|
|
23332
|
-
async getSignedUrlImage(token, body) {
|
|
23333
|
-
const url = await this.makeRequestAxios({
|
|
23334
|
-
path: `/upload/signed-url-batch`,
|
|
23335
|
-
method: "POST",
|
|
23336
|
-
jwt: token,
|
|
23337
|
-
body
|
|
23338
|
-
});
|
|
23339
|
-
return url.data;
|
|
23340
|
-
}
|
|
23341
|
-
async getSignedUrl(token, file, proctoringId) {
|
|
23342
|
-
const url = await this.makeRequestAxios({
|
|
23343
|
-
path: `/upload/signed-url`,
|
|
23344
|
-
method: "POST",
|
|
23345
|
-
jwt: token,
|
|
23346
|
-
body: {
|
|
23347
|
-
objectName: `${proctoringId}/${file.name}`,
|
|
23348
|
-
contentType: file.type
|
|
23349
|
-
}
|
|
23350
|
-
});
|
|
23351
|
-
return url.data;
|
|
23352
|
-
}
|
|
23353
|
-
async saveScreenAlerts(proctoringOptions, proctoringSession) {
|
|
23354
|
-
await this.makeRequest({
|
|
23355
|
-
path: "/proctoring/save-screen",
|
|
23356
|
-
method: "POST",
|
|
23357
|
-
jwt: proctoringOptions.token,
|
|
23358
|
-
body: {
|
|
23359
|
-
proctoringId: proctoringSession.id,
|
|
23360
|
-
alerts: proctoringSession.alerts
|
|
23361
|
-
}
|
|
23362
|
-
});
|
|
23363
|
-
}
|
|
23364
|
-
async finishAndSendUrls(proctoringOptions, proctoringSession) {
|
|
23365
|
-
await this.makeRequest({
|
|
23366
|
-
path: `/proctoring/finish/${proctoringOptions.examId}`,
|
|
23367
|
-
method: "POST",
|
|
23368
|
-
body: {
|
|
23369
|
-
endDate: new Date().toISOString(),
|
|
23370
|
-
videoCameraUrl: "",
|
|
23371
|
-
audioCameraUrl: "",
|
|
23372
|
-
videoScreenUrl: ""
|
|
23373
|
-
},
|
|
23374
|
-
jwt: proctoringOptions.token
|
|
23375
|
-
});
|
|
23376
|
-
}
|
|
23377
|
-
async log(eventName, properties) {
|
|
23378
|
-
let entryType;
|
|
23379
|
-
if ((properties == null ? void 0 : properties.success) !== null && (properties == null ? void 0 : properties.success) !== void 0) {
|
|
23380
|
-
entryType = properties.success ? "4" : "1";
|
|
23381
|
-
} else {
|
|
23382
|
-
entryType = "4";
|
|
23383
|
-
}
|
|
23384
|
-
return await this.makeRequest({
|
|
23385
|
-
path: `/Log`,
|
|
23386
|
-
method: "POST",
|
|
23387
|
-
body: {
|
|
23388
|
-
entryType,
|
|
23389
|
-
eventName,
|
|
23390
|
-
message: properties
|
|
23391
|
-
},
|
|
23392
|
-
jwt: this.token
|
|
23393
|
-
});
|
|
23394
|
-
}
|
|
23395
|
-
async getServerHour(token) {
|
|
23396
|
-
return await this.makeRequest({
|
|
23397
|
-
path: `/Proctoring/server-hour`,
|
|
23398
|
-
method: "GET",
|
|
23399
|
-
jwt: token
|
|
23400
|
-
});
|
|
23401
|
-
}
|
|
23402
|
-
async makeRequest(data) {
|
|
23403
|
-
const { path, method, body, jwt } = data;
|
|
23404
|
-
const resp = await fetch(this.baseUrl + path, {
|
|
23405
|
-
method,
|
|
23406
|
-
body: body != null ? JSON.stringify(body) : void 0,
|
|
23407
|
-
headers: {
|
|
23408
|
-
Authorization: `Bearer ${jwt}`,
|
|
23409
|
-
"Content-Type": "application/json",
|
|
23410
|
-
"Access-Control-Allow-Origin": "*"
|
|
23411
|
-
}
|
|
23412
|
-
});
|
|
23413
|
-
if (resp.status >= 400) {
|
|
23414
|
-
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
23415
|
-
}
|
|
23416
|
-
const content = resp.headers.get("content-type");
|
|
23417
|
-
const isJson = content ? content.includes("application/json") : false;
|
|
23418
|
-
const responseData = isJson ? await resp.json() : null;
|
|
23419
|
-
return responseData;
|
|
23420
|
-
}
|
|
23421
|
-
async makeRequestAxios(data) {
|
|
23422
|
-
const { path, method, body, jwt } = data;
|
|
23423
|
-
const resp = await axios_default.request({
|
|
23424
|
-
url: this.baseUrl + path,
|
|
23425
|
-
method,
|
|
23426
|
-
headers: {
|
|
23427
|
-
Authorization: `Bearer ${jwt}`,
|
|
23428
|
-
"Access-Control-Allow-Origin": "*"
|
|
23429
|
-
},
|
|
23430
|
-
data: body
|
|
23431
|
-
});
|
|
23432
|
-
if (resp.status >= 400) {
|
|
23433
|
-
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
23434
|
-
}
|
|
23435
|
-
return resp;
|
|
23436
|
-
}
|
|
23437
|
-
async makeRequestPUT(data) {
|
|
23438
|
-
const { url, method, body, jwt } = data;
|
|
23439
|
-
const resp = await fetch(url, {
|
|
23440
|
-
method,
|
|
23441
|
-
body: body != null ? JSON.stringify(body) : void 0,
|
|
23442
|
-
headers: {
|
|
23443
|
-
Accept: "*/*",
|
|
23444
|
-
"Accept-Encoding": "gzip, deflate, br",
|
|
23445
|
-
Connection: "keep-alive",
|
|
23446
|
-
"aeg-event-type": "Notification",
|
|
23447
|
-
"Content-Type": "application/json",
|
|
23448
|
-
"Cache-Control": "no-cache",
|
|
23449
|
-
"x-ms-blob-type": "BlockBlob"
|
|
23450
|
-
}
|
|
23451
|
-
});
|
|
23452
|
-
if (resp.status >= 400) {
|
|
23453
|
-
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
23454
|
-
}
|
|
23455
|
-
const content = resp.headers.get("content-type");
|
|
23456
|
-
const isJson = content ? content.includes("application/json") : false;
|
|
23457
|
-
const responseData = isJson ? await resp.json() : null;
|
|
23458
|
-
return responseData;
|
|
23459
|
-
}
|
|
23460
|
-
};
|
|
23461
|
-
|
|
23462
23476
|
// src/new-flow/download/downloadService.ts
|
|
23463
23477
|
var DownloadService = class {
|
|
23464
23478
|
constructor(proctoringId) {
|
|
@@ -26023,7 +26037,7 @@ var NoiseRecorder = class {
|
|
|
26023
26037
|
async saveOnSession(session) {
|
|
26024
26038
|
}
|
|
26025
26039
|
async onNoiseDetectedRecord() {
|
|
26026
|
-
var _a2, _b;
|
|
26040
|
+
var _a2, _b, _c2;
|
|
26027
26041
|
if (!this.volumeMeter && this.cameraRecorder.cameraStream) {
|
|
26028
26042
|
this.volumeMeter = new VolumeMeter(this.cameraRecorder.cameraStream);
|
|
26029
26043
|
this.volumeMeter.start().catch((e3) => {
|
|
@@ -26031,8 +26045,8 @@ var NoiseRecorder = class {
|
|
|
26031
26045
|
this.volumeMeter = void 0;
|
|
26032
26046
|
});
|
|
26033
26047
|
}
|
|
26034
|
-
let noiseLimit = this.
|
|
26035
|
-
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;
|
|
26036
26050
|
this.isSpeech = this.isSpeech || this.hasDesiredResult(this.audioClassificationResult);
|
|
26037
26051
|
if (!this.isSpeech && !this.recordingInProgress)
|
|
26038
26052
|
noiseLimit = noiseLimit + noiseLimit * 0.25;
|
|
@@ -26044,7 +26058,7 @@ var NoiseRecorder = class {
|
|
|
26044
26058
|
const elapsedTime = Date.now() - this.recordingStartTime;
|
|
26045
26059
|
if (elapsedTime >= 3e3 && this.countLoopTimes > 4 && !this.hasDesiredResult(this.audioClassificationResult)) {
|
|
26046
26060
|
await this.stopSoundRecord();
|
|
26047
|
-
if (((
|
|
26061
|
+
if (((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectSpeech) && this.isSpeech) {
|
|
26048
26062
|
this.onRealtimeAlertsCallback({
|
|
26049
26063
|
status: "ALERT",
|
|
26050
26064
|
description: "Fala detectada",
|
|
@@ -26418,7 +26432,8 @@ var Proctoring = class {
|
|
|
26418
26432
|
this.context = context;
|
|
26419
26433
|
this.paramsConfig = {
|
|
26420
26434
|
audioBehaviourParameters: {
|
|
26421
|
-
recordingBitrate: 128
|
|
26435
|
+
recordingBitrate: 128,
|
|
26436
|
+
noiseLimit: 40
|
|
26422
26437
|
},
|
|
26423
26438
|
imageBehaviourParameters: {
|
|
26424
26439
|
frames: 40,
|
|
@@ -26492,7 +26507,6 @@ var Proctoring = class {
|
|
|
26492
26507
|
{
|
|
26493
26508
|
cameraId: this.sessionOptions.cameraId,
|
|
26494
26509
|
microphoneId: this.sessionOptions.microphoneId,
|
|
26495
|
-
noiseLimit: this.sessionOptions.noiseLimit,
|
|
26496
26510
|
onBufferSizeError: this.sessionOptions.onBufferSizeError,
|
|
26497
26511
|
onBufferSizeErrorCallback: () => this.onBufferSizeErrorCallback(),
|
|
26498
26512
|
proctoringType: this.sessionOptions.proctoringType,
|
|
@@ -26819,7 +26833,13 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
26819
26833
|
token: proctoringOptions.token,
|
|
26820
26834
|
credentials: proctoringOptions.credentials
|
|
26821
26835
|
});
|
|
26822
|
-
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
|
+
});
|
|
26823
26843
|
const photo = new CapturePhoto();
|
|
26824
26844
|
const login = proctoring.login.bind(proctoring);
|
|
26825
26845
|
const start = proctoring.start.bind(proctoring);
|