easyproctor 2.1.0 → 2.2.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/README.md +10 -0
- package/errors/errors.d.ts +1 -0
- package/esm/index.js +856 -148
- package/index.js +856 -148
- package/interfaces/ParamsConfig.d.ts +3 -0
- package/modules/SpyCam.d.ts +31 -0
- package/new-flow/backend/BackendService.d.ts +3 -1
- package/new-flow/backend/SpyCamBackendService.d.ts +27 -0
- package/new-flow/checkers/DeviceCheckerService.d.ts +6 -1
- package/new-flow/checkers/DeviceCheckerUI.d.ts +2 -0
- package/new-flow/proctoring/ProctoringSession.d.ts +12 -2
- package/new-flow/recorders/CameraRecorder.d.ts +8 -2
- package/new-flow/recorders/IRecorder.d.ts +3 -1
- package/package.json +2 -2
- package/plugins/insights.d.ts +3 -2
- package/plugins/recorder.d.ts +4 -1
- package/proctoring/SignTerm.d.ts +15 -0
- package/proctoring/options/ProctoringOptions.d.ts +1 -0
- package/proctoring/options/ProctoringVideoOptions.d.ts +1 -0
- package/proctoring/proctoring.d.ts +2 -1
- package/proctoring/useProctoring.d.ts +3 -2
- package/unpkg/easyproctor.min.js +34 -25
package/index.js
CHANGED
|
@@ -15213,34 +15213,6 @@ var FaceDetection = class extends BaseDetection {
|
|
|
15213
15213
|
}
|
|
15214
15214
|
};
|
|
15215
15215
|
|
|
15216
|
-
// src/proctoring/options/ProctoringOptions.ts
|
|
15217
|
-
var getDefaultProctoringOptions = {
|
|
15218
|
-
cameraId: void 0,
|
|
15219
|
-
microphoneId: void 0,
|
|
15220
|
-
allowMultipleMonitors: false,
|
|
15221
|
-
allowOnlyFirstMonitor: true,
|
|
15222
|
-
captureScreen: true,
|
|
15223
|
-
noiseLimit: 40,
|
|
15224
|
-
proctoringType: "IMAGE",
|
|
15225
|
-
insights: "",
|
|
15226
|
-
onBufferSizeError: false,
|
|
15227
|
-
useGeolocation: false
|
|
15228
|
-
};
|
|
15229
|
-
|
|
15230
|
-
// src/proctoring/options/ProctoringVideoOptions.ts
|
|
15231
|
-
function validatePartialVideoOptions(options) {
|
|
15232
|
-
if (!!options.width && !!options.height) {
|
|
15233
|
-
return {
|
|
15234
|
-
width: options.width,
|
|
15235
|
-
height: options.height,
|
|
15236
|
-
minWidth: options.minWidth,
|
|
15237
|
-
minHeight: options.minHeight
|
|
15238
|
-
};
|
|
15239
|
-
} else {
|
|
15240
|
-
return { width: 640, height: 480 };
|
|
15241
|
-
}
|
|
15242
|
-
}
|
|
15243
|
-
|
|
15244
15216
|
// node_modules/axios/lib/helpers/bind.js
|
|
15245
15217
|
function bind(fn3, thisArg) {
|
|
15246
15218
|
return function wrap() {
|
|
@@ -18166,21 +18138,21 @@ var BackendService = class {
|
|
|
18166
18138
|
});
|
|
18167
18139
|
return url2.data;
|
|
18168
18140
|
}
|
|
18169
|
-
async getSignedUrl(token, file,
|
|
18141
|
+
async getSignedUrl(token, file, proctoringId2) {
|
|
18170
18142
|
const url2 = await this.makeRequestAxios({
|
|
18171
18143
|
path: `/upload/signed-url`,
|
|
18172
18144
|
method: "POST",
|
|
18173
18145
|
jwt: token,
|
|
18174
18146
|
body: {
|
|
18175
|
-
objectName: `${
|
|
18147
|
+
objectName: `${proctoringId2}/${file.name}`,
|
|
18176
18148
|
contentType: file.type
|
|
18177
18149
|
}
|
|
18178
18150
|
});
|
|
18179
18151
|
return url2.data;
|
|
18180
18152
|
}
|
|
18181
|
-
async
|
|
18153
|
+
async saveAlerts(proctoringOptions, proctoringSession) {
|
|
18182
18154
|
await this.makeRequest({
|
|
18183
|
-
path: "/proctoring/save-
|
|
18155
|
+
path: "/proctoring/save-alerts",
|
|
18184
18156
|
method: "POST",
|
|
18185
18157
|
jwt: proctoringOptions.token,
|
|
18186
18158
|
body: {
|
|
@@ -18220,6 +18192,22 @@ var BackendService = class {
|
|
|
18220
18192
|
jwt: this.token
|
|
18221
18193
|
});
|
|
18222
18194
|
}
|
|
18195
|
+
async signTerm() {
|
|
18196
|
+
return await this.makeRequest({
|
|
18197
|
+
path: `/User/sign-terms`,
|
|
18198
|
+
method: "PATCH",
|
|
18199
|
+
body: {},
|
|
18200
|
+
jwt: this.token
|
|
18201
|
+
});
|
|
18202
|
+
}
|
|
18203
|
+
async signTermUrl() {
|
|
18204
|
+
const result = await this.makeRequestAxios({
|
|
18205
|
+
path: `/User/sign-terms-url`,
|
|
18206
|
+
method: "GET",
|
|
18207
|
+
jwt: this.token
|
|
18208
|
+
});
|
|
18209
|
+
return result.data;
|
|
18210
|
+
}
|
|
18223
18211
|
async getServerHour(token) {
|
|
18224
18212
|
return await this.makeRequest({
|
|
18225
18213
|
path: `/Proctoring/server-hour`,
|
|
@@ -18287,6 +18275,77 @@ var BackendService = class {
|
|
|
18287
18275
|
}
|
|
18288
18276
|
};
|
|
18289
18277
|
|
|
18278
|
+
// src/new-flow/backend/SpyCamBackendService.ts
|
|
18279
|
+
var SpyCamBackendService = class {
|
|
18280
|
+
constructor() {
|
|
18281
|
+
this.baseUrl = "https://localhost:5080";
|
|
18282
|
+
}
|
|
18283
|
+
async isAlive() {
|
|
18284
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
18285
|
+
path: `/api/usb-device-manager/is-alive`,
|
|
18286
|
+
method: "GET",
|
|
18287
|
+
jwt: this.token
|
|
18288
|
+
}).catch((error) => {
|
|
18289
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18290
|
+
});
|
|
18291
|
+
return paramsConfig.data;
|
|
18292
|
+
}
|
|
18293
|
+
async isPluggedIn() {
|
|
18294
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
18295
|
+
path: `/api/usb-device-manager/is-plugged-in`,
|
|
18296
|
+
method: "GET",
|
|
18297
|
+
jwt: this.token
|
|
18298
|
+
}).catch((error) => {
|
|
18299
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18300
|
+
});
|
|
18301
|
+
return paramsConfig.data;
|
|
18302
|
+
}
|
|
18303
|
+
async ConnectAndScan() {
|
|
18304
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
18305
|
+
path: `/api/usb-device-manager/connect-and-scan`,
|
|
18306
|
+
method: "GET",
|
|
18307
|
+
jwt: this.token
|
|
18308
|
+
}).catch((error) => {
|
|
18309
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18310
|
+
});
|
|
18311
|
+
return paramsConfig.data;
|
|
18312
|
+
}
|
|
18313
|
+
async Devices({
|
|
18314
|
+
deviceType,
|
|
18315
|
+
rssiThreshold,
|
|
18316
|
+
packageRateThreshold
|
|
18317
|
+
}) {
|
|
18318
|
+
const queryParams = [];
|
|
18319
|
+
deviceType && queryParams.push(`deviceType=${deviceType}`);
|
|
18320
|
+
rssiThreshold && queryParams.push(`rssiThreshold=${rssiThreshold}`);
|
|
18321
|
+
packageRateThreshold && queryParams.push(`packageRateThreshold=${packageRateThreshold}`);
|
|
18322
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
18323
|
+
path: `/api/usb-device-manager/devices?${queryParams.join("&")}`,
|
|
18324
|
+
method: "GET",
|
|
18325
|
+
jwt: this.token
|
|
18326
|
+
}).catch((error) => {
|
|
18327
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18328
|
+
});
|
|
18329
|
+
return paramsConfig.data;
|
|
18330
|
+
}
|
|
18331
|
+
async makeRequestAxios(data) {
|
|
18332
|
+
const { path, method, body, jwt } = data;
|
|
18333
|
+
const resp = await axios_default.request({
|
|
18334
|
+
url: this.baseUrl + path,
|
|
18335
|
+
method,
|
|
18336
|
+
headers: {
|
|
18337
|
+
Authorization: `Bearer ${jwt}`,
|
|
18338
|
+
"Access-Control-Allow-Origin": "*"
|
|
18339
|
+
},
|
|
18340
|
+
data: body
|
|
18341
|
+
});
|
|
18342
|
+
if (resp.status >= 400) {
|
|
18343
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18344
|
+
}
|
|
18345
|
+
return resp;
|
|
18346
|
+
}
|
|
18347
|
+
};
|
|
18348
|
+
|
|
18290
18349
|
// src/new-flow/proctoring/ProctoringSession.ts
|
|
18291
18350
|
var ProctoringSession = class {
|
|
18292
18351
|
constructor() {
|
|
@@ -18318,8 +18377,8 @@ var ProctoringSession = class {
|
|
|
18318
18377
|
this.state = "Ended" /* Ended */;
|
|
18319
18378
|
this.sessionDuration = Date.now() - this.startedAt.getTime();
|
|
18320
18379
|
}
|
|
18321
|
-
setProctoringId(
|
|
18322
|
-
this.id =
|
|
18380
|
+
setProctoringId(proctoringId2) {
|
|
18381
|
+
this.id = proctoringId2;
|
|
18323
18382
|
}
|
|
18324
18383
|
setEndConfirmed() {
|
|
18325
18384
|
this.state = "EndConfirmed" /* EndConfirmed */;
|
|
@@ -18338,6 +18397,164 @@ var ProctoringSession = class {
|
|
|
18338
18397
|
}
|
|
18339
18398
|
};
|
|
18340
18399
|
|
|
18400
|
+
// src/modules/SpyCam.ts
|
|
18401
|
+
var SpyCam = class {
|
|
18402
|
+
constructor(context, options) {
|
|
18403
|
+
this.backendService = new SpyCamBackendService();
|
|
18404
|
+
this.scanInterval = 5;
|
|
18405
|
+
this.options = {};
|
|
18406
|
+
this.options = options;
|
|
18407
|
+
this.context = context;
|
|
18408
|
+
this.backend = new BackendService({
|
|
18409
|
+
type: (context == null ? void 0 : context.type) || "prod",
|
|
18410
|
+
token: context.token
|
|
18411
|
+
});
|
|
18412
|
+
this.currentIsPlugged = true;
|
|
18413
|
+
}
|
|
18414
|
+
setProctoringId(proctoringId2) {
|
|
18415
|
+
this.proctoringId = proctoringId2;
|
|
18416
|
+
}
|
|
18417
|
+
async isPluggedIn(sendEvent = false) {
|
|
18418
|
+
var _a2, _b, _c2, _d;
|
|
18419
|
+
try {
|
|
18420
|
+
const isPlugged = await this.backendService.isPluggedIn();
|
|
18421
|
+
if (this.proctoringId && sendEvent) {
|
|
18422
|
+
if (isPlugged) {
|
|
18423
|
+
if (!this.currentIsPlugged) {
|
|
18424
|
+
(_b = (_a2 = this.options).onRealtimeAlertsCallback) == null ? void 0 : _b.call(_a2, {
|
|
18425
|
+
type: "spycam",
|
|
18426
|
+
message: "Spycam disconnected",
|
|
18427
|
+
description: "Dispositivo de varredura conectado.",
|
|
18428
|
+
status: "OK"
|
|
18429
|
+
});
|
|
18430
|
+
}
|
|
18431
|
+
} else {
|
|
18432
|
+
const session = new ProctoringSession();
|
|
18433
|
+
session.setProctoringId(this.proctoringId);
|
|
18434
|
+
session.addAlert({
|
|
18435
|
+
begin: Date.now() - this.startTime.getTime(),
|
|
18436
|
+
end: 0,
|
|
18437
|
+
alert: 33 /* SpyDeviceDisconnected */,
|
|
18438
|
+
type: 5 /* Environment */
|
|
18439
|
+
});
|
|
18440
|
+
await this.backend.saveAlerts(this.context, session);
|
|
18441
|
+
(_d = (_c2 = this.options).onRealtimeAlertsCallback) == null ? void 0 : _d.call(_c2, {
|
|
18442
|
+
type: "spycam",
|
|
18443
|
+
message: "Spycam disconnected",
|
|
18444
|
+
description: "Nenhum dispositivo de varredura conectado.",
|
|
18445
|
+
status: "ALERT"
|
|
18446
|
+
});
|
|
18447
|
+
}
|
|
18448
|
+
}
|
|
18449
|
+
this.currentIsPlugged = isPlugged;
|
|
18450
|
+
return this.currentIsPlugged;
|
|
18451
|
+
} catch (error) {
|
|
18452
|
+
throw error;
|
|
18453
|
+
}
|
|
18454
|
+
}
|
|
18455
|
+
async isAlive() {
|
|
18456
|
+
try {
|
|
18457
|
+
return await this.backendService.isAlive();
|
|
18458
|
+
} catch (error) {
|
|
18459
|
+
throw error;
|
|
18460
|
+
}
|
|
18461
|
+
}
|
|
18462
|
+
connectAndScan() {
|
|
18463
|
+
return this.backendService.ConnectAndScan();
|
|
18464
|
+
}
|
|
18465
|
+
async devices({
|
|
18466
|
+
deviceType,
|
|
18467
|
+
rssiThreshold,
|
|
18468
|
+
packageRateThreshold
|
|
18469
|
+
}) {
|
|
18470
|
+
var _a2, _b;
|
|
18471
|
+
const devices = await this.backendService.Devices(
|
|
18472
|
+
{
|
|
18473
|
+
deviceType,
|
|
18474
|
+
rssiThreshold,
|
|
18475
|
+
packageRateThreshold
|
|
18476
|
+
}
|
|
18477
|
+
);
|
|
18478
|
+
if (devices.length > 0) {
|
|
18479
|
+
(_b = (_a2 = this.options).onRealtimeAlertsCallback) == null ? void 0 : _b.call(_a2, {
|
|
18480
|
+
type: "spycam",
|
|
18481
|
+
message: "Spycam detected",
|
|
18482
|
+
description: "Dispositivo espi\xE3o detectado.",
|
|
18483
|
+
data: devices
|
|
18484
|
+
});
|
|
18485
|
+
if (this.proctoringId) {
|
|
18486
|
+
const session = new ProctoringSession();
|
|
18487
|
+
session.setProctoringId(this.proctoringId);
|
|
18488
|
+
session.addAlert({
|
|
18489
|
+
begin: Date.now() - this.startTime.getTime(),
|
|
18490
|
+
end: 0,
|
|
18491
|
+
alert: 32 /* PotentialCamera */,
|
|
18492
|
+
type: 5 /* Environment */
|
|
18493
|
+
});
|
|
18494
|
+
await this.backend.saveAlerts(this.context, session);
|
|
18495
|
+
}
|
|
18496
|
+
}
|
|
18497
|
+
return devices;
|
|
18498
|
+
}
|
|
18499
|
+
async startCheckSpyCam(spyScanInterval, {
|
|
18500
|
+
deviceType,
|
|
18501
|
+
rssiThreshold,
|
|
18502
|
+
packageRateThreshold
|
|
18503
|
+
}) {
|
|
18504
|
+
this.scanInterval = spyScanInterval;
|
|
18505
|
+
this.startTime = new Date(Date.now());
|
|
18506
|
+
await this.isPluggedIn(true);
|
|
18507
|
+
this.checkSpyCam = setInterval(async () => {
|
|
18508
|
+
const isPlugged = await this.isPluggedIn(true);
|
|
18509
|
+
if (isPlugged) {
|
|
18510
|
+
await this.devices({
|
|
18511
|
+
deviceType,
|
|
18512
|
+
rssiThreshold,
|
|
18513
|
+
packageRateThreshold
|
|
18514
|
+
});
|
|
18515
|
+
}
|
|
18516
|
+
}, this.scanInterval * 6e4);
|
|
18517
|
+
}
|
|
18518
|
+
stopCheckSpyCam() {
|
|
18519
|
+
clearInterval(this.checkSpyCam);
|
|
18520
|
+
}
|
|
18521
|
+
};
|
|
18522
|
+
|
|
18523
|
+
// src/proctoring/options/ProctoringOptions.ts
|
|
18524
|
+
var getDefaultProctoringOptions = {
|
|
18525
|
+
cameraId: void 0,
|
|
18526
|
+
microphoneId: void 0,
|
|
18527
|
+
allowMultipleMonitors: false,
|
|
18528
|
+
allowOnlyFirstMonitor: true,
|
|
18529
|
+
captureScreen: true,
|
|
18530
|
+
noiseLimit: 40,
|
|
18531
|
+
proctoringType: "IMAGE",
|
|
18532
|
+
insights: "",
|
|
18533
|
+
onBufferSizeError: false,
|
|
18534
|
+
useGeolocation: false,
|
|
18535
|
+
useSpyScan: false
|
|
18536
|
+
};
|
|
18537
|
+
|
|
18538
|
+
// src/proctoring/options/ProctoringVideoOptions.ts
|
|
18539
|
+
function validatePartialVideoOptions(options) {
|
|
18540
|
+
if (!!options.width && !!options.height) {
|
|
18541
|
+
return {
|
|
18542
|
+
width: options.width,
|
|
18543
|
+
height: options.height,
|
|
18544
|
+
minWidth: options.minWidth,
|
|
18545
|
+
minHeight: options.minHeight
|
|
18546
|
+
};
|
|
18547
|
+
} else {
|
|
18548
|
+
return { width: 640, height: 480 };
|
|
18549
|
+
}
|
|
18550
|
+
}
|
|
18551
|
+
var getDefaultProctoringVideoOptions = {
|
|
18552
|
+
width: 1280,
|
|
18553
|
+
height: 720,
|
|
18554
|
+
minWidth: 640,
|
|
18555
|
+
minHeight: 480
|
|
18556
|
+
};
|
|
18557
|
+
|
|
18341
18558
|
// src/plugins/insights.ts
|
|
18342
18559
|
var backendService;
|
|
18343
18560
|
var init = (backend) => {
|
|
@@ -18348,53 +18565,81 @@ var eventNames = {
|
|
|
18348
18565
|
START: "start",
|
|
18349
18566
|
FINISH: "finish",
|
|
18350
18567
|
ERROR: "error",
|
|
18351
|
-
|
|
18568
|
+
UPLOAD: "upload",
|
|
18569
|
+
UPLOAD_FILE: "upload_file",
|
|
18570
|
+
DOWNLOAD_VIDEO: "download_video",
|
|
18352
18571
|
BUFFER_SIZE: "buffer_size",
|
|
18353
18572
|
ANOTHER_STREAM: "another_stream",
|
|
18354
|
-
|
|
18573
|
+
CHANGE_DEVICE: "change_device",
|
|
18574
|
+
STOP_SHARING_SCREEN: "stop_sharing_screen",
|
|
18575
|
+
ERROR_RECORDER_RTC: "error_recorder_rtc",
|
|
18576
|
+
BROWSER_NOT_SUPPORTED: "browser_not_supported",
|
|
18577
|
+
SAVE_ON_SESSION: "save_on_session"
|
|
18355
18578
|
};
|
|
18356
18579
|
var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
|
|
18357
18580
|
var trackers = {
|
|
18358
|
-
registerStart: (
|
|
18359
|
-
registerFinish: (
|
|
18360
|
-
registerError: (
|
|
18361
|
-
registerBrowserNotSupported: (
|
|
18362
|
-
registerUpload: (
|
|
18363
|
-
registerUploadFile: (
|
|
18364
|
-
registerChangeDevice: (
|
|
18365
|
-
registerStopSharingScreen: (
|
|
18366
|
-
registerErrorRecorderRTC: (
|
|
18367
|
-
|
|
18368
|
-
|
|
18581
|
+
registerStart: (proctoringId2, success, description) => log(eventNames.START, { proctoringId: proctoringId2, success, description }),
|
|
18582
|
+
registerFinish: (proctoringId2, success, description) => log(eventNames.FINISH, { proctoringId: proctoringId2, success, description }),
|
|
18583
|
+
registerError: (proctoringId2, description) => log(eventNames.ERROR, { proctoringId: proctoringId2, description }),
|
|
18584
|
+
registerBrowserNotSupported: (proctoringId2, description) => log(eventNames.BROWSER_NOT_SUPPORTED, { proctoringId: proctoringId2, description }),
|
|
18585
|
+
registerUpload: (proctoringId2, success, description, serviceType, uploadTime) => log(eventNames.UPLOAD, { proctoringId: proctoringId2, success, description, serviceType, uploadTime }),
|
|
18586
|
+
registerUploadFile: (proctoringId2, description, fileType) => log(eventNames.UPLOAD_FILE, { proctoringId: proctoringId2, description, fileType }),
|
|
18587
|
+
registerChangeDevice: (proctoringId2, inOrOut, description) => log(eventNames.CHANGE_DEVICE, { proctoringId: proctoringId2, inOrOut, description }),
|
|
18588
|
+
registerStopSharingScreen: (proctoringId2, description) => log(eventNames.STOP_SHARING_SCREEN, { proctoringId: proctoringId2, description }),
|
|
18589
|
+
registerErrorRecorderRTC: (proctoringId2, description) => log(eventNames.ERROR_RECORDER_RTC, { proctoringId: proctoringId2, description }),
|
|
18590
|
+
registerDownloadFile: (proctoringId2, description) => log(eventNames.DOWNLOAD_VIDEO, { proctoringId: proctoringId2, description }),
|
|
18591
|
+
registerOnBufferSizeError: (proctoringId2, description) => log(eventNames.BUFFER_SIZE, { proctoringId: proctoringId2, description }),
|
|
18592
|
+
registerAnotherStream: (proctoringId2, description) => log(eventNames.ANOTHER_STREAM, { proctoringId: proctoringId2, description }),
|
|
18593
|
+
registerSaveOnSession: (proctoringId2, description) => log(eventNames.SAVE_ON_SESSION, { proctoringId: proctoringId2, description })
|
|
18369
18594
|
};
|
|
18370
18595
|
|
|
18371
18596
|
// src/plugins/recorder.ts
|
|
18372
|
-
|
|
18597
|
+
var proctoringId;
|
|
18598
|
+
function setRecorderProctoringId(id) {
|
|
18599
|
+
proctoringId = id;
|
|
18600
|
+
}
|
|
18601
|
+
function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorCallback, audio = false) {
|
|
18373
18602
|
let resolvePromise;
|
|
18374
18603
|
let stopped = false;
|
|
18375
18604
|
let onBufferSizeInterval;
|
|
18376
18605
|
let lastEvent;
|
|
18377
|
-
let
|
|
18606
|
+
let bufferSize;
|
|
18607
|
+
bufferSize = 0;
|
|
18608
|
+
let recorderOptions = {
|
|
18378
18609
|
mimeType: "video/webm",
|
|
18379
18610
|
videoBitsPerSecond: 128e3,
|
|
18380
18611
|
audioBitsPerSecond: 64 * 1e3
|
|
18381
18612
|
};
|
|
18613
|
+
if (MediaRecorder.isTypeSupported("video/webm;codecs=vp9")) {
|
|
18614
|
+
recorderOptions.mimeType = "video/webm;codecs=vp9";
|
|
18615
|
+
} else {
|
|
18616
|
+
console.warn(
|
|
18617
|
+
"vp9 codec not supported. Using default mimeType without vp9."
|
|
18618
|
+
);
|
|
18619
|
+
}
|
|
18382
18620
|
if (audio) {
|
|
18383
|
-
|
|
18621
|
+
recorderOptions = {
|
|
18384
18622
|
mimeType: "audio/webm",
|
|
18385
18623
|
audioBitsPerSecond: 64 * 1e3
|
|
18386
18624
|
};
|
|
18387
18625
|
}
|
|
18388
|
-
const mediaRecorder = new MediaRecorder(stream4,
|
|
18626
|
+
const mediaRecorder = new MediaRecorder(stream4, recorderOptions);
|
|
18389
18627
|
mediaRecorder.ondataavailable = (e3) => {
|
|
18628
|
+
bufferSize = bufferSize + e3.data.size;
|
|
18390
18629
|
if (e3.data.size > 0) {
|
|
18391
18630
|
buffer.push(e3.data);
|
|
18392
18631
|
}
|
|
18393
18632
|
if (!stopped) {
|
|
18394
18633
|
if (lastEvent && e3.data.size === lastEvent.data.size || e3.data.size === 0) {
|
|
18634
|
+
proctoringId && lastEvent && e3.data.size === lastEvent.data.size && trackers.registerOnBufferSizeError(
|
|
18635
|
+
proctoringId,
|
|
18636
|
+
`onBufferSizeError: Recorder size freezed: ${e3.data.size} Mb`
|
|
18637
|
+
);
|
|
18638
|
+
proctoringId && e3.data.size === 0 && trackers.registerOnBufferSizeError(
|
|
18639
|
+
proctoringId,
|
|
18640
|
+
`onBufferSizeError: Recorder size equal 0 Mb`
|
|
18641
|
+
);
|
|
18395
18642
|
onBufferSizeErrorCallback && onBufferSizeErrorCallback();
|
|
18396
|
-
proctoringId && lastEvent && e3.data.size === lastEvent.data.size && trackers.registerOnBufferSizeError(proctoringId, `onBufferSizeError: Recorder size freezed: ${e3.data.size} Mb`);
|
|
18397
|
-
proctoringId && e3.data.size === 0 && trackers.registerOnBufferSizeError(proctoringId, `onBufferSizeError: Recorder size equal 0 Mb`);
|
|
18398
18643
|
}
|
|
18399
18644
|
lastEvent = e3;
|
|
18400
18645
|
} else {
|
|
@@ -18409,6 +18654,7 @@ function recorder(stream4, buffer, proctoringId, onBufferSizeError = false, onBu
|
|
|
18409
18654
|
return new Promise((resolve) => {
|
|
18410
18655
|
resolvePromise = resolve;
|
|
18411
18656
|
mediaRecorder.start();
|
|
18657
|
+
bufferSize = 0;
|
|
18412
18658
|
stopped = false;
|
|
18413
18659
|
if (onBufferSizeError) {
|
|
18414
18660
|
onBufferSizeInterval = setInterval(async () => {
|
|
@@ -18452,17 +18698,27 @@ function recorder(stream4, buffer, proctoringId, onBufferSizeError = false, onBu
|
|
|
18452
18698
|
}
|
|
18453
18699
|
});
|
|
18454
18700
|
}
|
|
18455
|
-
|
|
18701
|
+
function getBufferSize() {
|
|
18702
|
+
return bufferSize;
|
|
18703
|
+
}
|
|
18704
|
+
return {
|
|
18705
|
+
startRecording,
|
|
18706
|
+
stopRecording,
|
|
18707
|
+
pauseRecording,
|
|
18708
|
+
resumeRecording,
|
|
18709
|
+
recorderOptions,
|
|
18710
|
+
getBufferSize
|
|
18711
|
+
};
|
|
18456
18712
|
}
|
|
18457
18713
|
|
|
18458
18714
|
// src/new-flow/upload/UploadService.ts
|
|
18459
18715
|
var UploadService = class {
|
|
18460
|
-
constructor(
|
|
18716
|
+
constructor(proctoringId2, backend) {
|
|
18461
18717
|
this.backend = backend;
|
|
18462
18718
|
this.imageUrlPackage = [];
|
|
18463
18719
|
this.imageBatchNum = 0;
|
|
18464
18720
|
this.contImages = 0;
|
|
18465
|
-
this.proctoringId =
|
|
18721
|
+
this.proctoringId = proctoringId2;
|
|
18466
18722
|
}
|
|
18467
18723
|
async uploadImages(data, token, packSize) {
|
|
18468
18724
|
const { file, onProgress } = data;
|
|
@@ -18604,6 +18860,7 @@ var STREAM_UNDER_MINIMUM_PERMITTED = "stream_under_minimum_permitted";
|
|
|
18604
18860
|
var BROWSER_NOT_SUPPORTED = "browser_not_supported";
|
|
18605
18861
|
var TOKEN_MISSING = "token_missing";
|
|
18606
18862
|
var CREDENTIALS_MISSING = "credentials_missing";
|
|
18863
|
+
var SPY_SCAN_API_NOT_FOUND = "spy_scan_api_not_found";
|
|
18607
18864
|
|
|
18608
18865
|
// src/modules/objectDetection.ts
|
|
18609
18866
|
var ObjectDetection = class extends BaseDetection {
|
|
@@ -18761,7 +19018,7 @@ var CameraRecorder = class {
|
|
|
18761
19018
|
cameraId: void 0,
|
|
18762
19019
|
microphoneId: void 0,
|
|
18763
19020
|
onBufferSizeError: false,
|
|
18764
|
-
onBufferSizeErrorCallback: () => {
|
|
19021
|
+
onBufferSizeErrorCallback: (cameraStream) => {
|
|
18765
19022
|
},
|
|
18766
19023
|
proctoringType: "IMAGE",
|
|
18767
19024
|
onChangeDevicesCallback: (devices) => {
|
|
@@ -18778,6 +19035,7 @@ var CameraRecorder = class {
|
|
|
18778
19035
|
this.blobsRTC = [];
|
|
18779
19036
|
this.imageCount = 0;
|
|
18780
19037
|
this.filesToUpload = [];
|
|
19038
|
+
this.currentRetries = 0;
|
|
18781
19039
|
this.noiseWait = 20;
|
|
18782
19040
|
this.options = options;
|
|
18783
19041
|
this.videoOptions = videoOptions;
|
|
@@ -18785,19 +19043,30 @@ var CameraRecorder = class {
|
|
|
18785
19043
|
this.backendToken = backendToken;
|
|
18786
19044
|
paramsConfig && (this.paramsConfig = paramsConfig);
|
|
18787
19045
|
}
|
|
18788
|
-
setProctoringId(
|
|
18789
|
-
this.proctoringId =
|
|
19046
|
+
setProctoringId(proctoringId2) {
|
|
19047
|
+
this.proctoringId = proctoringId2;
|
|
18790
19048
|
this.proctoringId && this.backend && (this.upload = new UploadService(this.proctoringId, this.backend));
|
|
19049
|
+
setRecorderProctoringId(proctoringId2);
|
|
18791
19050
|
}
|
|
18792
19051
|
async initializeDetectors() {
|
|
18793
19052
|
var _a2, _b, _c2;
|
|
18794
19053
|
buildVideoPreview();
|
|
18795
19054
|
if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone)) {
|
|
18796
|
-
this.objectDetection = new ObjectDetection(
|
|
19055
|
+
this.objectDetection = new ObjectDetection(
|
|
19056
|
+
{
|
|
19057
|
+
onRealtimeAlertsCallback: (response) => this.options.onRealtimeAlertsCallback(response)
|
|
19058
|
+
},
|
|
19059
|
+
this.paramsConfig
|
|
19060
|
+
);
|
|
18797
19061
|
await this.objectDetection.initializeDetector();
|
|
18798
19062
|
}
|
|
18799
19063
|
if ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace) {
|
|
18800
|
-
this.faceDetection = new FaceDetection(
|
|
19064
|
+
this.faceDetection = new FaceDetection(
|
|
19065
|
+
{
|
|
19066
|
+
onRealtimeAlertsCallback: (response) => this.options.onRealtimeAlertsCallback(response)
|
|
19067
|
+
},
|
|
19068
|
+
this.paramsConfig
|
|
19069
|
+
);
|
|
18801
19070
|
await this.faceDetection.initializeDetector();
|
|
18802
19071
|
}
|
|
18803
19072
|
}
|
|
@@ -18810,9 +19079,25 @@ var CameraRecorder = class {
|
|
|
18810
19079
|
this.canvas.width = this.videoOptions.width;
|
|
18811
19080
|
this.canvas.height = this.videoOptions.height;
|
|
18812
19081
|
}
|
|
18813
|
-
async
|
|
19082
|
+
async bufferError(e3) {
|
|
19083
|
+
var _a2, _b;
|
|
19084
|
+
console.log("buffer error Camera Recorder params " + this.paramsConfig.videoBehaviourParameters);
|
|
19085
|
+
const retryEnabled = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.retryEnabled) || false;
|
|
19086
|
+
const maxRetries = ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.maxRetries) || 3;
|
|
19087
|
+
if (retryEnabled && this.currentRetries < maxRetries) {
|
|
19088
|
+
await this.recordingStop();
|
|
19089
|
+
await this.startRecording({
|
|
19090
|
+
retry: true
|
|
19091
|
+
});
|
|
19092
|
+
this.currentRetries++;
|
|
19093
|
+
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback(this.cameraStream);
|
|
19094
|
+
} else {
|
|
19095
|
+
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback();
|
|
19096
|
+
}
|
|
19097
|
+
}
|
|
19098
|
+
async startRecording(options) {
|
|
18814
19099
|
var _a2, _b, _c2, _d, _e3, _f, _g;
|
|
18815
|
-
if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone) || ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace)) {
|
|
19100
|
+
if ((((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone) || ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace)) && !(options == null ? void 0 : options.retry)) {
|
|
18816
19101
|
await this.initializeDetectors();
|
|
18817
19102
|
}
|
|
18818
19103
|
const { cameraId, microphoneId, onBufferSizeErrorCallback } = this.options;
|
|
@@ -18826,26 +19111,50 @@ var CameraRecorder = class {
|
|
|
18826
19111
|
}
|
|
18827
19112
|
};
|
|
18828
19113
|
try {
|
|
18829
|
-
this.cameraStream = await navigator.mediaDevices.getUserMedia(
|
|
19114
|
+
this.cameraStream = await navigator.mediaDevices.getUserMedia(
|
|
19115
|
+
constraints
|
|
19116
|
+
);
|
|
18830
19117
|
} catch (error) {
|
|
18831
19118
|
if (error.toString() == "NotReadableError: Could not start video source")
|
|
18832
19119
|
throw "N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa";
|
|
18833
19120
|
throw error;
|
|
18834
19121
|
}
|
|
18835
|
-
const {
|
|
19122
|
+
const {
|
|
19123
|
+
startRecording,
|
|
19124
|
+
stopRecording,
|
|
19125
|
+
pauseRecording,
|
|
19126
|
+
resumeRecording,
|
|
19127
|
+
recorderOptions,
|
|
19128
|
+
getBufferSize
|
|
19129
|
+
} = recorder(
|
|
19130
|
+
this.cameraStream,
|
|
19131
|
+
this.blobs,
|
|
19132
|
+
this.options.onBufferSizeError,
|
|
19133
|
+
(e3) => this.bufferError(e3),
|
|
19134
|
+
false
|
|
19135
|
+
);
|
|
18836
19136
|
this.recordingStart = startRecording;
|
|
18837
19137
|
this.recordingStop = stopRecording;
|
|
18838
19138
|
this.recordingPause = pauseRecording;
|
|
18839
19139
|
this.recordingResume = resumeRecording;
|
|
19140
|
+
this.recorderOptions = recorderOptions;
|
|
19141
|
+
this.getBufferSize = getBufferSize;
|
|
18840
19142
|
this.recordingStart();
|
|
18841
19143
|
const tracks = this.cameraStream.getVideoTracks();
|
|
18842
19144
|
const settings = tracks[0].getSettings();
|
|
18843
19145
|
if (this.videoOptions.minWidth > settings.width || this.videoOptions.minHeight > settings.height) {
|
|
18844
19146
|
throw STREAM_UNDER_MINIMUM_PERMITTED;
|
|
18845
19147
|
} else if (this.videoOptions.width !== settings.width || this.videoOptions.height !== settings.height) {
|
|
18846
|
-
trackers.registerAnotherStream(
|
|
18847
|
-
|
|
18848
|
-
|
|
19148
|
+
trackers.registerAnotherStream(
|
|
19149
|
+
this.proctoringId,
|
|
19150
|
+
`Maybe have another stream active
|
|
19151
|
+
Video Options: ${JSON.stringify(
|
|
19152
|
+
this.videoOptions,
|
|
19153
|
+
null,
|
|
19154
|
+
2
|
|
19155
|
+
)}
|
|
19156
|
+
Setting: ${JSON.stringify(settings, null, 2)}`
|
|
19157
|
+
);
|
|
18849
19158
|
throw ANOTHER_STREAM_ACTIVE;
|
|
18850
19159
|
}
|
|
18851
19160
|
((_d = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _d.useUploadImage) && this.options.proctoringType == "IMAGE" && this.photoShotsCycle();
|
|
@@ -18869,8 +19178,13 @@ Setting: ${settings}`);
|
|
|
18869
19178
|
const packSize = this.paramsConfig.imageBehaviourParameters.uploadInterval;
|
|
18870
19179
|
for (let i3 = 0; i3 < size; i3++) {
|
|
18871
19180
|
if (i3 == size - 1 && this.filesToUpload[0]) {
|
|
18872
|
-
const imageName = this.filesToUpload[0].name.replace(
|
|
18873
|
-
|
|
19181
|
+
const imageName = this.filesToUpload[0].name.replace(
|
|
19182
|
+
".jpg",
|
|
19183
|
+
"_realtime.jpg"
|
|
19184
|
+
);
|
|
19185
|
+
const file = new File([this.filesToUpload[0]], imageName, {
|
|
19186
|
+
type: "image/jpeg"
|
|
19187
|
+
});
|
|
18874
19188
|
this.filesToUpload[0] = file;
|
|
18875
19189
|
}
|
|
18876
19190
|
this.filesToUpload[0] && await this.upload.uploadImages(
|
|
@@ -18896,9 +19210,19 @@ Setting: ${settings}`);
|
|
|
18896
19210
|
let imageFile;
|
|
18897
19211
|
this.configImageCapture();
|
|
18898
19212
|
this.imageInterval = setInterval(async () => {
|
|
18899
|
-
this.canvas.getContext("2d").drawImage(
|
|
19213
|
+
this.canvas.getContext("2d").drawImage(
|
|
19214
|
+
this.video,
|
|
19215
|
+
0,
|
|
19216
|
+
0,
|
|
19217
|
+
this.videoOptions.width,
|
|
19218
|
+
this.videoOptions.height
|
|
19219
|
+
);
|
|
18900
19220
|
const image_data_url = this.canvas.toDataURL("image/jpeg");
|
|
18901
|
-
imageFile = await this.getFile(
|
|
19221
|
+
imageFile = await this.getFile(
|
|
19222
|
+
image_data_url,
|
|
19223
|
+
`${this.proctoringId}_${this.imageCount + 1}.jpg`,
|
|
19224
|
+
"image/jpeg"
|
|
19225
|
+
);
|
|
18902
19226
|
if (imageFile && this.upload && this.backendToken) {
|
|
18903
19227
|
this.upload.upload(
|
|
18904
19228
|
{
|
|
@@ -18990,16 +19314,24 @@ Setting: ${settings}`);
|
|
|
18990
19314
|
window.URL.revokeObjectURL(url2);
|
|
18991
19315
|
}
|
|
18992
19316
|
async saveOnSession(session) {
|
|
18993
|
-
var _a2;
|
|
19317
|
+
var _a2, _b;
|
|
19318
|
+
if (this.blobs != null)
|
|
19319
|
+
trackers.registerSaveOnSession(
|
|
19320
|
+
this.proctoringId,
|
|
19321
|
+
`Blobs Length: ${this.blobs.length} Buffer Size: ${this.getBufferSize()} `
|
|
19322
|
+
);
|
|
18994
19323
|
const settings = this.cameraStream.getVideoTracks()[0].getSettings();
|
|
18995
19324
|
const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
|
|
18996
19325
|
if (this.options.proctoringType == "VIDEO" || this.options.proctoringType == "REALTIME" || this.options.proctoringType == "IMAGE" && ((_a2 = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _a2.saveVideo)) {
|
|
18997
19326
|
session.addRecording({
|
|
18998
19327
|
device: `Audio
|
|
18999
19328
|
Sample Rate: ${settingsAudio.sampleRate}
|
|
19000
|
-
Sample Size: ${settingsAudio.sampleSize}
|
|
19329
|
+
Sample Size: ${settingsAudio.sampleSize}
|
|
19330
|
+
|
|
19331
|
+
Video:
|
|
19332
|
+
${JSON.stringify(this.recorderOptions)}`,
|
|
19001
19333
|
file: new File(this.blobs, `EP_${session.id}_camera_0.webm`, {
|
|
19002
|
-
type: "video/webm"
|
|
19334
|
+
type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
|
|
19003
19335
|
}),
|
|
19004
19336
|
origin: "Camera" /* Camera */
|
|
19005
19337
|
});
|
|
@@ -19317,10 +19649,29 @@ var DeviceCheckerUI = class {
|
|
|
19317
19649
|
checkmark_AmbientVerify.appendChild(checkmark_kick_AmbientVerify);
|
|
19318
19650
|
alertDivAmbientVerify.appendChild(checkmark_AmbientVerify);
|
|
19319
19651
|
alertDivAmbientVerify.appendChild(ambientVerifyAlert);
|
|
19652
|
+
const alertDivSpyCam = document.createElement("div");
|
|
19653
|
+
alertDivSpyCam.setAttribute("class", "alert-div");
|
|
19654
|
+
alertDivSpyCam.setAttribute("id", "alertDivSpyCam");
|
|
19655
|
+
alertDivSpyCam.style.display = "none";
|
|
19656
|
+
const SpyCamAlert = document.createElement("error");
|
|
19657
|
+
SpyCamAlert.setAttribute("id", "SpyCamAlert");
|
|
19658
|
+
SpyCamAlert.innerText = "Verifica\xE7\xE3o de Spy Cam";
|
|
19659
|
+
SpyCamAlert.style.marginLeft = "10px";
|
|
19660
|
+
const checkmark_SpyCam = document.createElement("span");
|
|
19661
|
+
const checkmark_stem_SpyCam = document.createElement("div");
|
|
19662
|
+
const checkmark_kick_SpyCam = document.createElement("div");
|
|
19663
|
+
checkmark_SpyCam.setAttribute("id", "checkmark_SpyCam");
|
|
19664
|
+
checkmark_stem_SpyCam.setAttribute("id", "checkmark_stem_SpyCam");
|
|
19665
|
+
checkmark_kick_SpyCam.setAttribute("id", "checkmark_kick_SpyCam");
|
|
19666
|
+
checkmark_SpyCam.appendChild(checkmark_stem_SpyCam);
|
|
19667
|
+
checkmark_SpyCam.appendChild(checkmark_kick_SpyCam);
|
|
19668
|
+
alertDivSpyCam.appendChild(checkmark_SpyCam);
|
|
19669
|
+
alertDivSpyCam.appendChild(SpyCamAlert);
|
|
19320
19670
|
center.style.transform = "rotateY(180deg)";
|
|
19321
19671
|
center.appendChild(alertDivResolution);
|
|
19322
19672
|
center.appendChild(alertDivFacePosition);
|
|
19323
19673
|
center.appendChild(alertDivAmbientVerify);
|
|
19674
|
+
center.appendChild(alertDivSpyCam);
|
|
19324
19675
|
divCamera.appendChild(center);
|
|
19325
19676
|
videoDiv.appendChild(video);
|
|
19326
19677
|
divCamera.appendChild(videoDiv);
|
|
@@ -19499,10 +19850,13 @@ var DeviceCheckerUI = class {
|
|
|
19499
19850
|
fontWeight: "bold",
|
|
19500
19851
|
borderRadius: "10px",
|
|
19501
19852
|
paddingTop: "5px",
|
|
19502
|
-
paddingBottom: "5px"
|
|
19503
|
-
disabled: true
|
|
19853
|
+
paddingBottom: "5px"
|
|
19504
19854
|
};
|
|
19505
19855
|
this.applyStyles(button, buttonStyles);
|
|
19856
|
+
if (this.options.useSpyScan) {
|
|
19857
|
+
button.style.cursor = "not-allowed";
|
|
19858
|
+
button.setAttribute("disabled", "true");
|
|
19859
|
+
}
|
|
19506
19860
|
divBtn.appendChild(buttonCancel);
|
|
19507
19861
|
divBtn.appendChild(divider);
|
|
19508
19862
|
divBtn.appendChild(button);
|
|
@@ -19562,6 +19916,8 @@ var DeviceCheckerUI = class {
|
|
|
19562
19916
|
});
|
|
19563
19917
|
});
|
|
19564
19918
|
confirmBtn == null ? void 0 : confirmBtn.addEventListener("click", () => {
|
|
19919
|
+
if (confirmBtn.disabled)
|
|
19920
|
+
return;
|
|
19565
19921
|
closeCheckDevices();
|
|
19566
19922
|
this.closeModal();
|
|
19567
19923
|
resolve({
|
|
@@ -19612,6 +19968,68 @@ var DeviceCheckerUI = class {
|
|
|
19612
19968
|
}
|
|
19613
19969
|
}
|
|
19614
19970
|
}
|
|
19971
|
+
waitingSpyDevices(waiting) {
|
|
19972
|
+
const SpyCamAlert = document.getElementById("SpyCamAlert");
|
|
19973
|
+
const alertDivSpyCam = document.getElementById(
|
|
19974
|
+
"alertDivSpyCam"
|
|
19975
|
+
);
|
|
19976
|
+
alertDivSpyCam && (alertDivSpyCam.style.display = "flex");
|
|
19977
|
+
if (waiting) {
|
|
19978
|
+
SpyCamAlert && (SpyCamAlert.style.color = "#c7c7c7");
|
|
19979
|
+
SpyCamAlert && (SpyCamAlert.innerText = "Verificando Spy Cam...");
|
|
19980
|
+
const confirmBtn = document.getElementById("confirmBtn");
|
|
19981
|
+
if (confirmBtn)
|
|
19982
|
+
confirmBtn.setAttribute("disabled", "true");
|
|
19983
|
+
confirmBtn && (confirmBtn.style.cursor = "not-allowed");
|
|
19984
|
+
} else {
|
|
19985
|
+
SpyCamAlert && (SpyCamAlert.style.color = "#16A34A");
|
|
19986
|
+
SpyCamAlert && (SpyCamAlert.innerText = "Verifica\xE7\xE3o de Spy Cam");
|
|
19987
|
+
const confirmBtn = document.getElementById("confirmBtn");
|
|
19988
|
+
if (confirmBtn)
|
|
19989
|
+
confirmBtn.setAttribute("disabled", "false");
|
|
19990
|
+
confirmBtn && (confirmBtn.style.cursor = "pointer");
|
|
19991
|
+
}
|
|
19992
|
+
}
|
|
19993
|
+
isSpyDevicesUI(allowedDevices) {
|
|
19994
|
+
const SpyCamAlert = document.getElementById("SpyCamAlert");
|
|
19995
|
+
const confirmBtn = document.getElementById("confirmBtn");
|
|
19996
|
+
const alertDivSpyCam = document.getElementById(
|
|
19997
|
+
"alertDivSpyCam"
|
|
19998
|
+
);
|
|
19999
|
+
alertDivSpyCam && (alertDivSpyCam.style.display = "flex");
|
|
20000
|
+
const checkmark_SpyCam = document.getElementById(
|
|
20001
|
+
"checkmark_SpyCam"
|
|
20002
|
+
);
|
|
20003
|
+
const checkmark_stem_SpyCam = document.getElementById(
|
|
20004
|
+
"checkmark_stem_SpyCam"
|
|
20005
|
+
);
|
|
20006
|
+
const checkmark_kick_SpyCam = document.getElementById(
|
|
20007
|
+
"checkmark_kick_SpyCam"
|
|
20008
|
+
);
|
|
20009
|
+
if (allowedDevices) {
|
|
20010
|
+
SpyCamAlert && (SpyCamAlert.style.color = "#16A34A");
|
|
20011
|
+
if (checkmark_SpyCam) {
|
|
20012
|
+
checkmark_SpyCam.setAttribute("class", "checkmark");
|
|
20013
|
+
checkmark_stem_SpyCam.setAttribute("class", "checkmark_stem");
|
|
20014
|
+
checkmark_kick_SpyCam.setAttribute("class", "checkmark_kick");
|
|
20015
|
+
}
|
|
20016
|
+
} else {
|
|
20017
|
+
if (checkmark_SpyCam) {
|
|
20018
|
+
SpyCamAlert && (SpyCamAlert.style.color = "#FF0000");
|
|
20019
|
+
checkmark_SpyCam.setAttribute("class", "checkmark_error");
|
|
20020
|
+
checkmark_stem_SpyCam.setAttribute(
|
|
20021
|
+
"class",
|
|
20022
|
+
"checkmark_stem_error"
|
|
20023
|
+
);
|
|
20024
|
+
checkmark_kick_SpyCam.setAttribute(
|
|
20025
|
+
"class",
|
|
20026
|
+
"checkmark_kick_error"
|
|
20027
|
+
);
|
|
20028
|
+
}
|
|
20029
|
+
}
|
|
20030
|
+
this.options.useSpyScan && (confirmBtn == null ? void 0 : confirmBtn.removeAttribute("disabled"));
|
|
20031
|
+
confirmBtn && (confirmBtn.style.cursor = "pointer");
|
|
20032
|
+
}
|
|
19615
20033
|
isUnderResolutionUI(allowedResolution) {
|
|
19616
20034
|
const error = document.getElementById("resolutionAlert");
|
|
19617
20035
|
const alertDivResolution = document.getElementById("alertDivResolution");
|
|
@@ -19748,7 +20166,12 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
|
|
|
19748
20166
|
// src/new-flow/checkers/DeviceCheckerService.ts
|
|
19749
20167
|
var _DeviceCheckerService = class {
|
|
19750
20168
|
constructor(context) {
|
|
19751
|
-
this.videoOptions = {
|
|
20169
|
+
this.videoOptions = {
|
|
20170
|
+
width: 1080,
|
|
20171
|
+
height: 720,
|
|
20172
|
+
minWidth: 0,
|
|
20173
|
+
minHeight: 0
|
|
20174
|
+
};
|
|
19752
20175
|
this.volumeMedia = 0;
|
|
19753
20176
|
this.volumeSum = 0;
|
|
19754
20177
|
this.volumeCounter = 0;
|
|
@@ -19757,8 +20180,16 @@ var _DeviceCheckerService = class {
|
|
|
19757
20180
|
this.allowedAmbient = true;
|
|
19758
20181
|
this.allowedPositionFace = true;
|
|
19759
20182
|
this.allowedMicrophone = false;
|
|
20183
|
+
this.allowedSpyScan = null;
|
|
19760
20184
|
this.noiseLimit = 0;
|
|
19761
|
-
this.faceDetection = new FaceDetection(
|
|
20185
|
+
this.faceDetection = new FaceDetection(
|
|
20186
|
+
{
|
|
20187
|
+
onRealtimeAlertsCallback: (response) => this.realtimeAlerts(response)
|
|
20188
|
+
},
|
|
20189
|
+
{ videoBehaviourParameters: { detectFace: true } },
|
|
20190
|
+
"cameraStream",
|
|
20191
|
+
"liveCheckDevices"
|
|
20192
|
+
);
|
|
19762
20193
|
this.context = context;
|
|
19763
20194
|
this.backend = new BackendService({
|
|
19764
20195
|
type: (context == null ? void 0 : context.type) || "prod",
|
|
@@ -19769,41 +20200,55 @@ var _DeviceCheckerService = class {
|
|
|
19769
20200
|
if (_DeviceCheckerService.isModalOpen) {
|
|
19770
20201
|
return Promise.reject("Modal j\xE1 est\xE1 aberto");
|
|
19771
20202
|
}
|
|
20203
|
+
this.options = {
|
|
20204
|
+
...getDefaultProctoringOptions,
|
|
20205
|
+
...options,
|
|
20206
|
+
captureScreen: false,
|
|
20207
|
+
allowMultipleMonitors: true,
|
|
20208
|
+
allowOnlyFirstMonitor: false
|
|
20209
|
+
};
|
|
19772
20210
|
_DeviceCheckerService.isModalOpen = true;
|
|
19773
20211
|
try {
|
|
19774
20212
|
await this.faceDetection.initializeDetector();
|
|
19775
|
-
const { cameraStream } = await this.startCheckDevices(
|
|
20213
|
+
const { cameraStream } = await this.startCheckDevices(
|
|
20214
|
+
options,
|
|
20215
|
+
_videoOptions
|
|
20216
|
+
);
|
|
20217
|
+
this.checkSpyScan();
|
|
19776
20218
|
const returnData = { cameraStream: this.cameraRecorder.cameraStream };
|
|
19777
20219
|
this.onUpdateCb = (e3) => onUpdate(e3);
|
|
19778
|
-
const resultPromise = new Promise(
|
|
19779
|
-
|
|
19780
|
-
|
|
19781
|
-
|
|
19782
|
-
|
|
19783
|
-
|
|
19784
|
-
|
|
19785
|
-
|
|
19786
|
-
|
|
19787
|
-
|
|
19788
|
-
|
|
19789
|
-
|
|
19790
|
-
|
|
20220
|
+
const resultPromise = new Promise(
|
|
20221
|
+
(resolve, reject) => {
|
|
20222
|
+
onModalConfirm(() => {
|
|
20223
|
+
this.closeCheckDevices();
|
|
20224
|
+
resolve({
|
|
20225
|
+
result: true,
|
|
20226
|
+
cameraId: options.cameraId || "default",
|
|
20227
|
+
microphoneId: options.microphoneId || "default",
|
|
20228
|
+
volumeRange: this.volumeMedia,
|
|
20229
|
+
allowedResolution: this.allowedResolution,
|
|
20230
|
+
allowedPositionFace: this.allowedPositionFace,
|
|
20231
|
+
allowedAmbient: this.allowedAmbient,
|
|
20232
|
+
allowedMicrophone: this.allowedMicrophone,
|
|
20233
|
+
allowedSpyScan: this.allowedSpyScan,
|
|
20234
|
+
faceDetectionAlerts: this.faceDetectionAlerts
|
|
20235
|
+
});
|
|
20236
|
+
_DeviceCheckerService.isModalOpen = false;
|
|
19791
20237
|
});
|
|
19792
|
-
|
|
19793
|
-
|
|
19794
|
-
|
|
19795
|
-
|
|
19796
|
-
|
|
19797
|
-
|
|
20238
|
+
onModalCancel(() => {
|
|
20239
|
+
this.closeCheckDevices();
|
|
20240
|
+
resolve({
|
|
20241
|
+
result: false
|
|
20242
|
+
});
|
|
20243
|
+
_DeviceCheckerService.isModalOpen = false;
|
|
19798
20244
|
});
|
|
19799
|
-
|
|
19800
|
-
|
|
19801
|
-
});
|
|
20245
|
+
}
|
|
20246
|
+
);
|
|
19802
20247
|
return { ...returnData, result: resultPromise };
|
|
19803
20248
|
} catch (error) {
|
|
19804
20249
|
this.closeCheckDevices();
|
|
19805
20250
|
_DeviceCheckerService.isModalOpen = false;
|
|
19806
|
-
|
|
20251
|
+
throw error;
|
|
19807
20252
|
}
|
|
19808
20253
|
}
|
|
19809
20254
|
onUpdateCallback() {
|
|
@@ -19813,11 +20258,12 @@ var _DeviceCheckerService = class {
|
|
|
19813
20258
|
allowedPositionFace: this.allowedPositionFace,
|
|
19814
20259
|
allowedAmbient: this.allowedAmbient,
|
|
19815
20260
|
allowedMicrophone: this.allowedMicrophone,
|
|
20261
|
+
allowedSpyScan: this.allowedSpyScan,
|
|
19816
20262
|
faceDetectionAlerts: this.faceDetectionAlerts
|
|
19817
20263
|
});
|
|
19818
20264
|
}
|
|
19819
20265
|
}
|
|
19820
|
-
async checkDevices(options = getDefaultProctoringOptions, _videoOptions) {
|
|
20266
|
+
async checkDevices(options = getDefaultProctoringOptions, _videoOptions = getDefaultProctoringVideoOptions) {
|
|
19821
20267
|
var _a2;
|
|
19822
20268
|
if (_DeviceCheckerService.isModalOpen) {
|
|
19823
20269
|
return Promise.reject();
|
|
@@ -19833,11 +20279,14 @@ var _DeviceCheckerService = class {
|
|
|
19833
20279
|
allowOnlyFirstMonitor: false
|
|
19834
20280
|
};
|
|
19835
20281
|
this.videoOptions = { ...this.videoOptions, ..._videoOptions };
|
|
19836
|
-
const paramsConfig = await this.backend.getParamsConfig(
|
|
20282
|
+
const paramsConfig = await this.backend.getParamsConfig(
|
|
20283
|
+
this.context
|
|
20284
|
+
);
|
|
19837
20285
|
this.noiseLimit = ((_a2 = paramsConfig.audioBehaviourParameters) == null ? void 0 : _a2.noiseLimit) || 40;
|
|
19838
20286
|
await this.faceDetection.initializeDetector();
|
|
19839
20287
|
this.DeviceCheckerUI.checkDevicesInterface();
|
|
19840
20288
|
this.startCheckDevices(options, _videoOptions);
|
|
20289
|
+
await this.checkSpyScan();
|
|
19841
20290
|
const { cameraId, microphoneId, result } = await this.DeviceCheckerUI.modalActions(() => this.closeCheckDevices());
|
|
19842
20291
|
return new Promise((resolve) => {
|
|
19843
20292
|
resolve({
|
|
@@ -19849,6 +20298,7 @@ var _DeviceCheckerService = class {
|
|
|
19849
20298
|
allowedPositionFace: this.allowedPositionFace,
|
|
19850
20299
|
allowedAmbient: this.allowedAmbient,
|
|
19851
20300
|
allowedMicrophone: this.allowedMicrophone,
|
|
20301
|
+
allowedSpyScan: this.allowedSpyScan,
|
|
19852
20302
|
faceDetectionAlerts: this.faceDetectionAlerts
|
|
19853
20303
|
});
|
|
19854
20304
|
});
|
|
@@ -19915,10 +20365,7 @@ var _DeviceCheckerService = class {
|
|
|
19915
20365
|
this.DeviceCheckerUI && this.DeviceCheckerUI.audioDeviceInterfaceUIErrorExec();
|
|
19916
20366
|
});
|
|
19917
20367
|
}
|
|
19918
|
-
async changeSelectedDevice({
|
|
19919
|
-
cameraId,
|
|
19920
|
-
microphoneId
|
|
19921
|
-
}) {
|
|
20368
|
+
async changeSelectedDevice({ cameraId, microphoneId }) {
|
|
19922
20369
|
var _a2;
|
|
19923
20370
|
this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
|
|
19924
20371
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
@@ -19944,7 +20391,10 @@ var _DeviceCheckerService = class {
|
|
|
19944
20391
|
};
|
|
19945
20392
|
}
|
|
19946
20393
|
async startCheckDevices(options = getDefaultProctoringOptions, _videoOptions) {
|
|
19947
|
-
this.DeviceCheckerUI && this.DeviceCheckerUI.setSelectOption(
|
|
20394
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.setSelectOption(
|
|
20395
|
+
options,
|
|
20396
|
+
(e3) => this.changeSelectedDevice(e3)
|
|
20397
|
+
);
|
|
19948
20398
|
this.videoOptions = validatePartialVideoOptions(_videoOptions);
|
|
19949
20399
|
await checkPermissions();
|
|
19950
20400
|
this.cameraRecorder = new CameraRecorder(
|
|
@@ -19965,7 +20415,7 @@ var _DeviceCheckerService = class {
|
|
|
19965
20415
|
this.audioDeviceInterface(this.cameraRecorder.cameraStream);
|
|
19966
20416
|
if (this.DeviceCheckerUI) {
|
|
19967
20417
|
const button = document.querySelector("#confirmBtn");
|
|
19968
|
-
button.disabled = false;
|
|
20418
|
+
!this.options.useSpyScan && (button.disabled = false);
|
|
19969
20419
|
}
|
|
19970
20420
|
return {
|
|
19971
20421
|
cameraStream: this.cameraRecorder.cameraStream
|
|
@@ -19981,6 +20431,39 @@ var _DeviceCheckerService = class {
|
|
|
19981
20431
|
this.DeviceCheckerUI = void 0;
|
|
19982
20432
|
this.onUpdateCb = void 0;
|
|
19983
20433
|
}
|
|
20434
|
+
async checkSpyScan() {
|
|
20435
|
+
this.spycam = new SpyCam(this.context, {});
|
|
20436
|
+
this.allowedSpyScan = null;
|
|
20437
|
+
if (this.options.useSpyScan) {
|
|
20438
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.waitingSpyDevices(true);
|
|
20439
|
+
try {
|
|
20440
|
+
const isPlugged = await this.spycam.isPluggedIn();
|
|
20441
|
+
if (isPlugged) {
|
|
20442
|
+
await this.spycam.devices({
|
|
20443
|
+
deviceType: 3 /* POTENCIAL_CAMERA */
|
|
20444
|
+
}).then((devices) => {
|
|
20445
|
+
if ((devices == null ? void 0 : devices.length) > 0) {
|
|
20446
|
+
this.allowedSpyScan = false;
|
|
20447
|
+
} else {
|
|
20448
|
+
this.allowedSpyScan = true;
|
|
20449
|
+
}
|
|
20450
|
+
}).finally(() => {
|
|
20451
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.waitingSpyDevices(false);
|
|
20452
|
+
this.DeviceCheckerUI && this.allowedSpyScan != null && this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan);
|
|
20453
|
+
});
|
|
20454
|
+
} else {
|
|
20455
|
+
this.allowedSpyScan = false;
|
|
20456
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.waitingSpyDevices(false);
|
|
20457
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan);
|
|
20458
|
+
}
|
|
20459
|
+
} catch (error) {
|
|
20460
|
+
this.allowedSpyScan = false;
|
|
20461
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.waitingSpyDevices(false);
|
|
20462
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan);
|
|
20463
|
+
console.log(error);
|
|
20464
|
+
}
|
|
20465
|
+
}
|
|
20466
|
+
}
|
|
19984
20467
|
};
|
|
19985
20468
|
var DeviceCheckerService = _DeviceCheckerService;
|
|
19986
20469
|
DeviceCheckerService.isModalOpen = false;
|
|
@@ -20342,9 +20825,9 @@ var Extension = class {
|
|
|
20342
20825
|
|
|
20343
20826
|
// src/modules/onChangeDevices.ts
|
|
20344
20827
|
var onChangeDevices = class {
|
|
20345
|
-
constructor(repositoryDevices,
|
|
20828
|
+
constructor(repositoryDevices, proctoringId2) {
|
|
20346
20829
|
this.repositoryDevices = repositoryDevices;
|
|
20347
|
-
this.proctoringId =
|
|
20830
|
+
this.proctoringId = proctoringId2;
|
|
20348
20831
|
}
|
|
20349
20832
|
startRecording(options) {
|
|
20350
20833
|
navigator.mediaDevices.ondevicechange = () => {
|
|
@@ -20375,7 +20858,7 @@ var onChangeDevices = class {
|
|
|
20375
20858
|
};
|
|
20376
20859
|
await this.repositoryDevices.save({ ...devices, id: "devices", status: devices.cameras.length > (copy == null ? void 0 : copy.cameras.length) || devices.microphones.length > (copy == null ? void 0 : copy.microphones.length) ? "in" : "out" });
|
|
20377
20860
|
if (options.status && (devicesChanged.cameras.length != 0 || devicesChanged.microphones.length != 0)) {
|
|
20378
|
-
trackers.registerChangeDevice(this.proctoringId, devicesChanged.status, devicesChanged);
|
|
20861
|
+
trackers.registerChangeDevice(this.proctoringId, devicesChanged.status, JSON.stringify(devicesChanged, null, 2));
|
|
20379
20862
|
options.status(devicesChanged);
|
|
20380
20863
|
}
|
|
20381
20864
|
}
|
|
@@ -20384,18 +20867,26 @@ var onChangeDevices = class {
|
|
|
20384
20867
|
// src/new-flow/download/downloadService.ts
|
|
20385
20868
|
var import_file_saver = __toESM(require_FileSaver_min());
|
|
20386
20869
|
var DownloadService = class {
|
|
20387
|
-
constructor(
|
|
20870
|
+
constructor(proctoringId2) {
|
|
20388
20871
|
this.loadingBoolean = true;
|
|
20389
|
-
this.proctoringId =
|
|
20872
|
+
this.proctoringId = proctoringId2;
|
|
20390
20873
|
}
|
|
20391
20874
|
async upload(data, token) {
|
|
20875
|
+
const { file, onProgress } = data;
|
|
20392
20876
|
try {
|
|
20393
|
-
|
|
20877
|
+
trackers.registerDownloadFile(this.proctoringId, `File to download
|
|
20878
|
+
File name: ${file.name}
|
|
20879
|
+
File type: ${file.type}
|
|
20880
|
+
File size: ${file.size}}`);
|
|
20394
20881
|
(0, import_file_saver.saveAs)(file);
|
|
20395
20882
|
this.loadingBoolean = false;
|
|
20396
20883
|
clearInterval(this.loadingInterval);
|
|
20397
20884
|
onProgress && onProgress(Math.round(100));
|
|
20398
20885
|
} catch (err) {
|
|
20886
|
+
file && this.proctoringId && trackers.registerError(this.proctoringId, `Failed on machine download
|
|
20887
|
+
File name: ${file.name}
|
|
20888
|
+
File type: ${file.type}
|
|
20889
|
+
File size: ${file.size}`);
|
|
20399
20890
|
throw new Error(`Error on machine download`);
|
|
20400
20891
|
}
|
|
20401
20892
|
}
|
|
@@ -20410,7 +20901,7 @@ var ProctoringRecorder = class {
|
|
|
20410
20901
|
async startAll() {
|
|
20411
20902
|
this.session.start();
|
|
20412
20903
|
for (const rec of this.recorders) {
|
|
20413
|
-
await rec.startRecording();
|
|
20904
|
+
await rec.startRecording({ retry: false });
|
|
20414
20905
|
}
|
|
20415
20906
|
}
|
|
20416
20907
|
async pauseAll() {
|
|
@@ -20440,9 +20931,9 @@ var ProctoringRecorder = class {
|
|
|
20440
20931
|
|
|
20441
20932
|
// src/new-flow/proctoring/ProctoringUploader.ts
|
|
20442
20933
|
var ProctoringUploader = class {
|
|
20443
|
-
constructor(session,
|
|
20934
|
+
constructor(session, proctoringId2, uploadServices) {
|
|
20444
20935
|
this.session = session;
|
|
20445
|
-
this.proctoringId =
|
|
20936
|
+
this.proctoringId = proctoringId2;
|
|
20446
20937
|
this.uploadServices = uploadServices;
|
|
20447
20938
|
}
|
|
20448
20939
|
async upload(token, progress) {
|
|
@@ -20564,7 +21055,8 @@ var AlertRecorder = class {
|
|
|
20564
21055
|
this.alerts.push({
|
|
20565
21056
|
begin: Date.now() - this.startTime.getTime(),
|
|
20566
21057
|
end: 0,
|
|
20567
|
-
alert: 25 /* LostFocus
|
|
21058
|
+
alert: 25 /* LostFocus */,
|
|
21059
|
+
type: 3 /* Screen */
|
|
20568
21060
|
});
|
|
20569
21061
|
}
|
|
20570
21062
|
}
|
|
@@ -20596,7 +21088,7 @@ var AudioRecorder = class {
|
|
|
20596
21088
|
audio: { deviceId: this.options.microphoneId || "default" }
|
|
20597
21089
|
};
|
|
20598
21090
|
this.audioStream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
20599
|
-
const { startRecording, stopRecording, pauseRecording, resumeRecording } = recorder(this.audioStream, this.blobs, void 0, void 0,
|
|
21091
|
+
const { startRecording, stopRecording, pauseRecording, resumeRecording } = recorder(this.audioStream, this.blobs, void 0, void 0, true);
|
|
20600
21092
|
this.recordingStart = startRecording;
|
|
20601
21093
|
this.recordingStop = stopRecording;
|
|
20602
21094
|
this.recordingPause = pauseRecording;
|
|
@@ -22911,8 +23403,8 @@ var NoiseRecorder = class {
|
|
|
22911
23403
|
this.backend = backend;
|
|
22912
23404
|
this.backendToken = backendToken;
|
|
22913
23405
|
}
|
|
22914
|
-
setProctoringId(
|
|
22915
|
-
this.proctoringId =
|
|
23406
|
+
setProctoringId(proctoringId2) {
|
|
23407
|
+
this.proctoringId = proctoringId2;
|
|
22916
23408
|
this.proctoringId && this.backend && (this.upload = new UploadService(this.proctoringId, this.backend));
|
|
22917
23409
|
}
|
|
22918
23410
|
async startRecording() {
|
|
@@ -23123,8 +23615,9 @@ var ScreenRecorder = class {
|
|
|
23123
23615
|
this.blobsFinal = [];
|
|
23124
23616
|
this.options = options;
|
|
23125
23617
|
}
|
|
23126
|
-
setProctoringId(
|
|
23127
|
-
this.proctoringId =
|
|
23618
|
+
setProctoringId(proctoringId2) {
|
|
23619
|
+
this.proctoringId = proctoringId2;
|
|
23620
|
+
setRecorderProctoringId(proctoringId2);
|
|
23128
23621
|
}
|
|
23129
23622
|
async startRecording() {
|
|
23130
23623
|
this.startTime = new Date(Date.now());
|
|
@@ -23172,7 +23665,7 @@ var ScreenRecorder = class {
|
|
|
23172
23665
|
});
|
|
23173
23666
|
throw NOT_SHARED_SCREEN;
|
|
23174
23667
|
}
|
|
23175
|
-
const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs, this.
|
|
23668
|
+
const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs, this.options.onBufferSizeError, onBufferSizeErrorCallback);
|
|
23176
23669
|
this.recordingStart = startRecording;
|
|
23177
23670
|
this.recordingStop = stopRecording;
|
|
23178
23671
|
this.recordingStart();
|
|
@@ -23429,7 +23922,7 @@ var Proctoring = class {
|
|
|
23429
23922
|
this.onRealtimeAlertsCallback = (response) => {
|
|
23430
23923
|
return;
|
|
23431
23924
|
};
|
|
23432
|
-
this.onBufferSizeErrorCallback = () => {
|
|
23925
|
+
this.onBufferSizeErrorCallback = (cameraStream) => {
|
|
23433
23926
|
return;
|
|
23434
23927
|
};
|
|
23435
23928
|
var _a2;
|
|
@@ -23471,7 +23964,7 @@ var Proctoring = class {
|
|
|
23471
23964
|
this.onRealtimeAlertsCallback = (response) => options.data && options.data(response);
|
|
23472
23965
|
}
|
|
23473
23966
|
setOnBufferSizeErrorCallback(cb) {
|
|
23474
|
-
this.onBufferSizeErrorCallback = () => cb();
|
|
23967
|
+
this.onBufferSizeErrorCallback = (cameraStream) => cb(cameraStream);
|
|
23475
23968
|
}
|
|
23476
23969
|
createRecorders(options = getDefaultProctoringOptions) {
|
|
23477
23970
|
var _a2, _b;
|
|
@@ -23481,7 +23974,7 @@ var Proctoring = class {
|
|
|
23481
23974
|
cameraId: this.sessionOptions.cameraId,
|
|
23482
23975
|
microphoneId: this.sessionOptions.microphoneId,
|
|
23483
23976
|
onBufferSizeError: this.sessionOptions.onBufferSizeError,
|
|
23484
|
-
onBufferSizeErrorCallback: () => this.onBufferSizeErrorCallback(),
|
|
23977
|
+
onBufferSizeErrorCallback: (cameraStream) => this.onBufferSizeErrorCallback(cameraStream),
|
|
23485
23978
|
proctoringType: this.sessionOptions.proctoringType,
|
|
23486
23979
|
onChangeDevicesCallback: (devices) => this.onChangeDevicesCallback(devices),
|
|
23487
23980
|
onRealtimeAlertsCallback: (response) => this.onRealtimeAlertsCallback(response)
|
|
@@ -23535,6 +24028,7 @@ var Proctoring = class {
|
|
|
23535
24028
|
this.context.token = await this.auth.login();
|
|
23536
24029
|
}
|
|
23537
24030
|
async start(options = getDefaultProctoringOptions, _videoOptions = {}) {
|
|
24031
|
+
var _a2;
|
|
23538
24032
|
try {
|
|
23539
24033
|
if (this.context.token === void 0) {
|
|
23540
24034
|
throw TOKEN_MISSING;
|
|
@@ -23549,6 +24043,13 @@ var Proctoring = class {
|
|
|
23549
24043
|
await this.initConfig(options.useGeolocation);
|
|
23550
24044
|
await this.verifyBrowser();
|
|
23551
24045
|
this.sessionOptions.captureScreen && await this.verifyMultipleMonitors(this.sessionOptions);
|
|
24046
|
+
try {
|
|
24047
|
+
if (options == null ? void 0 : options.useSpyScan) {
|
|
24048
|
+
await this.spyCam.isAlive();
|
|
24049
|
+
}
|
|
24050
|
+
} catch (error) {
|
|
24051
|
+
throw SPY_SCAN_API_NOT_FOUND;
|
|
24052
|
+
}
|
|
23552
24053
|
if (this.state != "Stop" /* Stop */) {
|
|
23553
24054
|
throw PROCTORING_ALREADY_STARTED;
|
|
23554
24055
|
}
|
|
@@ -23573,6 +24074,12 @@ var Proctoring = class {
|
|
|
23573
24074
|
this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
|
|
23574
24075
|
this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
|
|
23575
24076
|
this.proctoringSession.setProctoringId(this.proctoringId);
|
|
24077
|
+
if (options == null ? void 0 : options.useSpyScan) {
|
|
24078
|
+
this.spyCam.setProctoringId(this.proctoringId);
|
|
24079
|
+
this.spyCam.startCheckSpyCam((_a2 = this.paramsConfig.spyScanInterval) != null ? _a2 : 5, {
|
|
24080
|
+
deviceType: 3 /* POTENCIAL_CAMERA */
|
|
24081
|
+
});
|
|
24082
|
+
}
|
|
23576
24083
|
await this.repository.save(this.proctoringSession);
|
|
23577
24084
|
const _navigator = {};
|
|
23578
24085
|
for (const i3 in navigator)
|
|
@@ -23606,6 +24113,7 @@ Error: ${error}`
|
|
|
23606
24113
|
async cancel() {
|
|
23607
24114
|
if (this.state === "Recording" /* Recording */ || this.state === "Starting" /* Starting */) {
|
|
23608
24115
|
await this.recorder.stopAll();
|
|
24116
|
+
this.spyCam && await this.spyCam.stopCheckSpyCam();
|
|
23609
24117
|
}
|
|
23610
24118
|
this.state = "Stop" /* Stop */;
|
|
23611
24119
|
}
|
|
@@ -23616,6 +24124,7 @@ Error: ${error}`
|
|
|
23616
24124
|
throw PROCTORING_NOT_STARTED;
|
|
23617
24125
|
}
|
|
23618
24126
|
await this.recorder.stopAll();
|
|
24127
|
+
this.spyCam && this.spyCam.stopCheckSpyCam();
|
|
23619
24128
|
await this.recorder.saveAllOnSession();
|
|
23620
24129
|
await this.repository.save(this.proctoringSession);
|
|
23621
24130
|
let uploader;
|
|
@@ -23693,13 +24202,15 @@ Upload Services: ${uploaderServices}`,
|
|
|
23693
24202
|
this.serviceType
|
|
23694
24203
|
);
|
|
23695
24204
|
}
|
|
23696
|
-
|
|
23697
|
-
|
|
23698
|
-
|
|
23699
|
-
|
|
23700
|
-
|
|
23701
|
-
|
|
23702
|
-
|
|
24205
|
+
if (this.proctoringSession.alerts.length > 0) {
|
|
24206
|
+
await this.backend.saveAlerts(this.context, this.proctoringSession).catch((err) => {
|
|
24207
|
+
trackers.registerFinish(
|
|
24208
|
+
this.proctoringSession.id,
|
|
24209
|
+
false,
|
|
24210
|
+
"save-screen error: " + err
|
|
24211
|
+
);
|
|
24212
|
+
});
|
|
24213
|
+
}
|
|
23703
24214
|
await this.backend.finishAndSendUrls(this.context, this.proctoringSession).then(() => {
|
|
23704
24215
|
trackers.registerFinish(this.proctoringSession.id, true, "");
|
|
23705
24216
|
}).catch((error) => {
|
|
@@ -23746,6 +24257,7 @@ Error: ` + error
|
|
|
23746
24257
|
}
|
|
23747
24258
|
}
|
|
23748
24259
|
async initConfig(useGeolocation) {
|
|
24260
|
+
var _a2;
|
|
23749
24261
|
try {
|
|
23750
24262
|
const paramsConfig = await this.backend.getParamsConfig(
|
|
23751
24263
|
this.context
|
|
@@ -23772,6 +24284,11 @@ Error: ` + error
|
|
|
23772
24284
|
});
|
|
23773
24285
|
}
|
|
23774
24286
|
init(this.backend);
|
|
24287
|
+
if ((_a2 = this.sessionOptions) == null ? void 0 : _a2.useSpyScan) {
|
|
24288
|
+
this.spyCam = new SpyCam(this.context, {
|
|
24289
|
+
onRealtimeAlertsCallback: (response) => this.onRealtimeAlertsCallback(response)
|
|
24290
|
+
});
|
|
24291
|
+
}
|
|
23775
24292
|
} catch (err) {
|
|
23776
24293
|
this.proctoringId && trackers.registerError(this.proctoringId, "Erro no initConfig!");
|
|
23777
24294
|
await this.cancel();
|
|
@@ -23817,6 +24334,200 @@ Error: ` + error
|
|
|
23817
24334
|
}
|
|
23818
24335
|
};
|
|
23819
24336
|
|
|
24337
|
+
// src/proctoring/SignTerm.ts
|
|
24338
|
+
var _SignTerm = class {
|
|
24339
|
+
constructor(context) {
|
|
24340
|
+
this.backend = new BackendService({
|
|
24341
|
+
type: (context == null ? void 0 : context.type) || "prod",
|
|
24342
|
+
token: context.token
|
|
24343
|
+
});
|
|
24344
|
+
}
|
|
24345
|
+
async signInTerms() {
|
|
24346
|
+
if (_SignTerm.isModalOpen) {
|
|
24347
|
+
return Promise.reject();
|
|
24348
|
+
}
|
|
24349
|
+
_SignTerm.isModalOpen = true;
|
|
24350
|
+
try {
|
|
24351
|
+
const response = await this.openModal();
|
|
24352
|
+
return new Promise((resolve) => {
|
|
24353
|
+
resolve(response);
|
|
24354
|
+
});
|
|
24355
|
+
} catch (error) {
|
|
24356
|
+
this.closeModal();
|
|
24357
|
+
return Promise.reject(error);
|
|
24358
|
+
}
|
|
24359
|
+
}
|
|
24360
|
+
openModal() {
|
|
24361
|
+
return new Promise((resolve, reject) => {
|
|
24362
|
+
const fullBg = document.createElement("div");
|
|
24363
|
+
fullBg.setAttribute("id", "signTermModal");
|
|
24364
|
+
const fullBgStyles = {
|
|
24365
|
+
backgroundColor: "rgba(0,0,0,0.4)",
|
|
24366
|
+
zIndex: "1000",
|
|
24367
|
+
position: "fixed",
|
|
24368
|
+
top: "0",
|
|
24369
|
+
left: "0",
|
|
24370
|
+
height: "100vh",
|
|
24371
|
+
width: "100%",
|
|
24372
|
+
display: "flex",
|
|
24373
|
+
alignItems: "center",
|
|
24374
|
+
justifyContent: "center"
|
|
24375
|
+
};
|
|
24376
|
+
this.applyStyles(fullBg, fullBgStyles);
|
|
24377
|
+
const modal = document.createElement("div");
|
|
24378
|
+
const modalStyles = {
|
|
24379
|
+
backgroundColor: "#fff",
|
|
24380
|
+
zIndex: "1001",
|
|
24381
|
+
width: "850px",
|
|
24382
|
+
maxHeight: "95%",
|
|
24383
|
+
borderRadius: "10px",
|
|
24384
|
+
display: "flex",
|
|
24385
|
+
flexDirection: "column",
|
|
24386
|
+
alignItems: "center"
|
|
24387
|
+
};
|
|
24388
|
+
this.applyStyles(modal, modalStyles);
|
|
24389
|
+
const h3 = document.createElement("h3");
|
|
24390
|
+
h3.innerText = "Termo de consentimento para coleta e uso de dados";
|
|
24391
|
+
const h3Styles = {
|
|
24392
|
+
color: "rgba(0, 0, 0, .7)",
|
|
24393
|
+
fontWeight: "bold",
|
|
24394
|
+
fontSize: "20px",
|
|
24395
|
+
marginBottom: "15px",
|
|
24396
|
+
padding: "20px 0px",
|
|
24397
|
+
borderBottom: "2px solid rgba(0, 0, 0, .1)",
|
|
24398
|
+
width: "100%",
|
|
24399
|
+
textAlign: "center"
|
|
24400
|
+
};
|
|
24401
|
+
this.applyStyles(h3, h3Styles);
|
|
24402
|
+
modal.appendChild(h3);
|
|
24403
|
+
const docEmbed = document.createElement("iframe");
|
|
24404
|
+
const defaultUrl = "https://docs.google.com/document/u/3/d/e/2PACX-1vRMgrLhDLyDP8BHmotfPDpwAFaDHqK-mA4eBJ0Cy1mDdvHcWLsx47H4otII_4qi4rhtSf6B0OO97e9c/pub";
|
|
24405
|
+
this.backend.signTermUrl().then((response) => {
|
|
24406
|
+
if (!response)
|
|
24407
|
+
throw new Error("N\xE3o foi poss\xEDvel obter o termo de consentimento");
|
|
24408
|
+
docEmbed.setAttribute("src", response);
|
|
24409
|
+
}).catch(() => {
|
|
24410
|
+
docEmbed.setAttribute("src", defaultUrl);
|
|
24411
|
+
});
|
|
24412
|
+
const docEmbedStyles = {
|
|
24413
|
+
width: "100%",
|
|
24414
|
+
height: "500px",
|
|
24415
|
+
border: "1px solid rgba(0, 0, 0, .1)",
|
|
24416
|
+
margin: "20px",
|
|
24417
|
+
borderRadius: "5px"
|
|
24418
|
+
};
|
|
24419
|
+
this.applyStyles(docEmbed, docEmbedStyles);
|
|
24420
|
+
modal.appendChild(docEmbed);
|
|
24421
|
+
const checkboxContainer = document.createElement("div");
|
|
24422
|
+
const checkbox = document.createElement("input");
|
|
24423
|
+
checkbox.setAttribute("type", "checkbox");
|
|
24424
|
+
checkbox.setAttribute("id", "termsCheckbox");
|
|
24425
|
+
const checkboxLabel = document.createElement("label");
|
|
24426
|
+
checkboxLabel.setAttribute("for", "termsCheckbox");
|
|
24427
|
+
checkboxLabel.innerText = "Li e aceito os termos e condi\xE7\xF5es";
|
|
24428
|
+
const checkboxContainerStyles = {
|
|
24429
|
+
display: "flex",
|
|
24430
|
+
alignItems: "center",
|
|
24431
|
+
gap: "10px",
|
|
24432
|
+
margin: "20px",
|
|
24433
|
+
width: "100%",
|
|
24434
|
+
paddingLeft: "20px"
|
|
24435
|
+
};
|
|
24436
|
+
this.applyStyles(checkboxContainer, checkboxContainerStyles);
|
|
24437
|
+
checkboxContainer.appendChild(checkbox);
|
|
24438
|
+
checkboxContainer.appendChild(checkboxLabel);
|
|
24439
|
+
modal.appendChild(checkboxContainer);
|
|
24440
|
+
const divBtn = document.createElement("div");
|
|
24441
|
+
const divBtnStyles = {
|
|
24442
|
+
width: "100%",
|
|
24443
|
+
display: "flex",
|
|
24444
|
+
alignItems: "center",
|
|
24445
|
+
justifyContent: "center",
|
|
24446
|
+
borderTop: "2px solid rgba(0, 0, 0, .1)"
|
|
24447
|
+
};
|
|
24448
|
+
this.applyStyles(divBtn, divBtnStyles);
|
|
24449
|
+
const buttonCancel = document.createElement("button");
|
|
24450
|
+
buttonCancel.innerText = "Cancelar";
|
|
24451
|
+
const buttonCancelStyles = {
|
|
24452
|
+
width: "100%",
|
|
24453
|
+
height: "70px",
|
|
24454
|
+
backgroundColor: "#FFF",
|
|
24455
|
+
border: "none",
|
|
24456
|
+
color: "rgba(0, 0, 0, .7)",
|
|
24457
|
+
fontWeight: "bold",
|
|
24458
|
+
borderRadius: "10px",
|
|
24459
|
+
paddingTop: "5px",
|
|
24460
|
+
paddingBottom: "5px"
|
|
24461
|
+
};
|
|
24462
|
+
this.applyStyles(buttonCancel, buttonCancelStyles);
|
|
24463
|
+
buttonCancel.addEventListener("click", () => {
|
|
24464
|
+
this.closeModal();
|
|
24465
|
+
resolve(false);
|
|
24466
|
+
});
|
|
24467
|
+
const divider = document.createElement("span");
|
|
24468
|
+
const dividerStyles = {
|
|
24469
|
+
width: "3px",
|
|
24470
|
+
height: "70px",
|
|
24471
|
+
margin: "0px 2px",
|
|
24472
|
+
background: "rgba(0, 0, 0, .1)"
|
|
24473
|
+
};
|
|
24474
|
+
this.applyStyles(divider, dividerStyles);
|
|
24475
|
+
const button = document.createElement("button");
|
|
24476
|
+
button.innerText = "Continuar";
|
|
24477
|
+
button.setAttribute("id", "confirmBtn");
|
|
24478
|
+
const buttonStyles = {
|
|
24479
|
+
width: "100%",
|
|
24480
|
+
height: "70px",
|
|
24481
|
+
backgroundColor: "#FFF",
|
|
24482
|
+
border: "none",
|
|
24483
|
+
color: "rgba(0, 0, 0, .7)",
|
|
24484
|
+
fontWeight: "bold",
|
|
24485
|
+
borderRadius: "10px",
|
|
24486
|
+
paddingTop: "5px",
|
|
24487
|
+
paddingBottom: "5px",
|
|
24488
|
+
disabled: true,
|
|
24489
|
+
cursor: "not-allowed"
|
|
24490
|
+
};
|
|
24491
|
+
this.applyStyles(button, buttonStyles);
|
|
24492
|
+
button.disabled = true;
|
|
24493
|
+
button.addEventListener("click", () => {
|
|
24494
|
+
this.closeModal();
|
|
24495
|
+
this.backend.signTerm().then(() => {
|
|
24496
|
+
resolve(true);
|
|
24497
|
+
});
|
|
24498
|
+
});
|
|
24499
|
+
checkbox.addEventListener("change", (e3) => {
|
|
24500
|
+
button.disabled = !e3.target.checked;
|
|
24501
|
+
if (e3.target.checked) {
|
|
24502
|
+
button.style.color = "#007bff";
|
|
24503
|
+
button.style.cursor = "pointer";
|
|
24504
|
+
} else {
|
|
24505
|
+
button.style.color = "rgba(0, 0, 0, .7)";
|
|
24506
|
+
button.style.cursor = "not-allowed";
|
|
24507
|
+
}
|
|
24508
|
+
});
|
|
24509
|
+
divBtn.appendChild(buttonCancel);
|
|
24510
|
+
divBtn.appendChild(divider);
|
|
24511
|
+
divBtn.appendChild(button);
|
|
24512
|
+
modal.appendChild(divBtn);
|
|
24513
|
+
fullBg.appendChild(modal);
|
|
24514
|
+
document.body.appendChild(fullBg);
|
|
24515
|
+
});
|
|
24516
|
+
}
|
|
24517
|
+
async closeModal() {
|
|
24518
|
+
_SignTerm.isModalOpen = false;
|
|
24519
|
+
const signTermModal = document.querySelector("#signTermModal");
|
|
24520
|
+
signTermModal == null ? void 0 : signTermModal.remove();
|
|
24521
|
+
}
|
|
24522
|
+
applyStyles(element, styles) {
|
|
24523
|
+
for (const [property, value] of Object.entries(styles)) {
|
|
24524
|
+
element.style[property] = value;
|
|
24525
|
+
}
|
|
24526
|
+
}
|
|
24527
|
+
};
|
|
24528
|
+
var SignTerm = _SignTerm;
|
|
24529
|
+
SignTerm.isModalOpen = false;
|
|
24530
|
+
|
|
23820
24531
|
// src/proctoring/useProctoring.ts
|
|
23821
24532
|
function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
23822
24533
|
if (!proctoringOptions.showConsole) {
|
|
@@ -23827,22 +24538,17 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
23827
24538
|
console.error = () => {
|
|
23828
24539
|
};
|
|
23829
24540
|
}
|
|
23830
|
-
const
|
|
23831
|
-
type: enviromentConfig,
|
|
23832
|
-
clientId: proctoringOptions.clientId,
|
|
23833
|
-
examId: proctoringOptions.examId,
|
|
23834
|
-
token: proctoringOptions.token,
|
|
23835
|
-
credentials: proctoringOptions.credentials,
|
|
23836
|
-
showConsole: proctoringOptions.showConsole
|
|
23837
|
-
});
|
|
23838
|
-
const checker = new DeviceCheckerService({
|
|
24541
|
+
const parameters = {
|
|
23839
24542
|
type: enviromentConfig,
|
|
23840
24543
|
clientId: proctoringOptions.clientId,
|
|
23841
24544
|
examId: proctoringOptions.examId,
|
|
23842
24545
|
token: proctoringOptions.token,
|
|
23843
24546
|
credentials: proctoringOptions.credentials,
|
|
23844
24547
|
showConsole: proctoringOptions.showConsole
|
|
23845
|
-
}
|
|
24548
|
+
};
|
|
24549
|
+
const proctoring = new Proctoring(parameters);
|
|
24550
|
+
const checker = new DeviceCheckerService(parameters);
|
|
24551
|
+
const signTerm = new SignTerm(parameters);
|
|
23846
24552
|
const photo = new CapturePhoto();
|
|
23847
24553
|
const login = proctoring.login.bind(proctoring);
|
|
23848
24554
|
const start = proctoring.start.bind(proctoring);
|
|
@@ -23855,6 +24561,7 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
23855
24561
|
const onBufferSizeError = proctoring.setOnBufferSizeErrorCallback.bind(proctoring);
|
|
23856
24562
|
const onStopSharingScreen = proctoring.setOnStopSharingScreenCallback.bind(proctoring);
|
|
23857
24563
|
const onRealtimeAlerts = proctoring.onRealtimeAlerts.bind(proctoring);
|
|
24564
|
+
const signInTerms = signTerm.signInTerms.bind(signTerm);
|
|
23858
24565
|
const checkDevices = checker.checkDevices.bind(checker);
|
|
23859
24566
|
const runCheckDevicesFlow = checker.runCheckDevicesFlow.bind(checker);
|
|
23860
24567
|
const changeSelectedDevice = checker.changeSelectedDevice.bind(checker);
|
|
@@ -23875,7 +24582,8 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
23875
24582
|
enumarateDevices,
|
|
23876
24583
|
checkPermissions,
|
|
23877
24584
|
checkIfhasMultipleMonitors,
|
|
23878
|
-
onStopSharingScreen
|
|
24585
|
+
onStopSharingScreen,
|
|
24586
|
+
signInTerms
|
|
23879
24587
|
};
|
|
23880
24588
|
}
|
|
23881
24589
|
|