easyproctor 0.0.82 → 0.0.83
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 +3 -2
- package/esm/index.js +236 -145
- package/index.js +235 -144
- package/package.json +1 -1
- package/plugins/insights.d.ts +1 -0
- package/unpkg/easyproctor.min.js +31 -23
package/index.js
CHANGED
|
@@ -33386,7 +33386,9 @@ var eventNames = {
|
|
|
33386
33386
|
START: "start",
|
|
33387
33387
|
FINISH: "finish",
|
|
33388
33388
|
ERROR: "error",
|
|
33389
|
-
UPLOAD_VIDEO: "upload_video"
|
|
33389
|
+
UPLOAD_VIDEO: "upload_video",
|
|
33390
|
+
START_RECORD: "start_record",
|
|
33391
|
+
FILE: "file"
|
|
33390
33392
|
};
|
|
33391
33393
|
var trackError = (exception) => insights.trackException({ exception });
|
|
33392
33394
|
var registerCustomEvent = (eventName, properties) => insights.trackEvent({ name: eventName, properties });
|
|
@@ -33397,7 +33399,8 @@ var trackers = {
|
|
|
33397
33399
|
registerStart: (proctoringId, success, description) => registerCustomEvent(eventNames.START, { proctoringId, success, description }),
|
|
33398
33400
|
registerFinish: (proctoringId, success, description) => registerCustomEvent(eventNames.FINISH, { proctoringId, success, description }),
|
|
33399
33401
|
registerError: (proctoringId, description) => registerCustomEvent(eventNames.ERROR, { proctoringId, description }),
|
|
33400
|
-
registerUploadVideo: (proctoringId, success, description, uploadTime) => registerCustomEvent(eventNames.UPLOAD_VIDEO, { proctoringId, success, description, uploadTime })
|
|
33402
|
+
registerUploadVideo: (proctoringId, success, description, uploadTime) => registerCustomEvent(eventNames.UPLOAD_VIDEO, { proctoringId, success, description, uploadTime }),
|
|
33403
|
+
registerRecord: (proctoringId, success, description) => registerCustomEvent(eventNames.START_RECORD, { proctoringId, success, description })
|
|
33401
33404
|
};
|
|
33402
33405
|
|
|
33403
33406
|
// node_modules/axios/lib/helpers/bind.js
|
|
@@ -35790,7 +35793,6 @@ var axios_default2 = axios_default;
|
|
|
35790
35793
|
// src/modules/http.ts
|
|
35791
35794
|
var baseUrl = "https://proctoring-api.easyproctor.tech/api";
|
|
35792
35795
|
async function setBaseUrl(homol) {
|
|
35793
|
-
console.log("homol -> ", homol);
|
|
35794
35796
|
if (homol)
|
|
35795
35797
|
baseUrl = "https://proctoring-api-hml.easyproctor.tech/api";
|
|
35796
35798
|
}
|
|
@@ -35843,9 +35845,6 @@ async function setConfiguration(_account, _cointainerName, _sas) {
|
|
|
35843
35845
|
containerName = _cointainerName;
|
|
35844
35846
|
sas = _sas;
|
|
35845
35847
|
blobServiceClient = new import_storage_blob.BlobServiceClient(`https://${account}.blob.core.windows.net${sas}`);
|
|
35846
|
-
console.log(account);
|
|
35847
|
-
console.log(containerName);
|
|
35848
|
-
console.log(sas);
|
|
35849
35848
|
}
|
|
35850
35849
|
function sendError(proctoringId) {
|
|
35851
35850
|
trackers.registerError(proctoringId, message);
|
|
@@ -36123,16 +36122,33 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
36123
36122
|
try {
|
|
36124
36123
|
let _screenStream = void 0;
|
|
36125
36124
|
if (captureScreen) {
|
|
36126
|
-
|
|
36127
|
-
|
|
36128
|
-
|
|
36129
|
-
|
|
36130
|
-
|
|
36131
|
-
|
|
36125
|
+
try {
|
|
36126
|
+
const { screenStream, stopScreenRecorder } = await startScreenCapture(screenBuffer, {
|
|
36127
|
+
allowOnlyFirstMonitor,
|
|
36128
|
+
onStopSharingScreenCallback: () => onStopSharingScreenCallback && onStopSharingScreenCallback()
|
|
36129
|
+
});
|
|
36130
|
+
cancelScreenCapture = stopScreenRecorder;
|
|
36131
|
+
trackers.registerRecord(proctoringId, true, `Start Screen Recorder`);
|
|
36132
|
+
_screenStream = screenStream;
|
|
36133
|
+
} catch (e) {
|
|
36134
|
+
trackers.registerRecord(proctoringId, false, `Start Screen Recorder Error: ${e}`);
|
|
36135
|
+
}
|
|
36136
|
+
}
|
|
36137
|
+
let cameraStream = new MediaStream();
|
|
36138
|
+
try {
|
|
36139
|
+
const cameraCaptureResponse = await startCameraCapture(cameraBuffer, { cameraId, microphoneId }, videoOptions);
|
|
36140
|
+
cameraStream = cameraCaptureResponse.cameraStream;
|
|
36141
|
+
cancelCameraCapture = await cameraCaptureResponse.stopCameraRecording;
|
|
36142
|
+
trackers.registerRecord(proctoringId, true, `Start Camera Recorder`);
|
|
36143
|
+
} catch (e) {
|
|
36144
|
+
trackers.registerRecord(proctoringId, false, `Start Camera Recorder Error: ${e}`);
|
|
36145
|
+
}
|
|
36146
|
+
try {
|
|
36147
|
+
startAudio();
|
|
36148
|
+
trackers.registerRecord(proctoringId, true, `Start Audio Recorder`);
|
|
36149
|
+
} catch (e) {
|
|
36150
|
+
trackers.registerRecord(proctoringId, false, `Start Audio Recorder Error: ${e}`);
|
|
36132
36151
|
}
|
|
36133
|
-
const { cameraStream, stopCameraRecording } = await startCameraCapture(cameraBuffer, { cameraId, microphoneId }, videoOptions);
|
|
36134
|
-
startAudio();
|
|
36135
|
-
cancelCameraCapture = await stopCameraRecording;
|
|
36136
36152
|
if (captureScreen) {
|
|
36137
36153
|
cancelCallback = async function() {
|
|
36138
36154
|
await Promise.all([cancelCameraCapture(), cancelScreenCapture()]);
|
|
@@ -36199,11 +36215,34 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
36199
36215
|
const cameraFileName = `EP_${proctoringId}_camera_${index}.webm`;
|
|
36200
36216
|
const audioFileName = `EP_${proctoringId}_audio_${index}.mp3`;
|
|
36201
36217
|
const screenFIleName = `EP_${proctoringId}_screen_${index}.webm`;
|
|
36202
|
-
|
|
36203
|
-
|
|
36218
|
+
let cameraFile = new File([], "null");
|
|
36219
|
+
let audioFile = new File([], "null");
|
|
36204
36220
|
let screenFile;
|
|
36221
|
+
try {
|
|
36222
|
+
cameraFile = new File(finalCameraBuffer, cameraFileName, { type: "video/webm" });
|
|
36223
|
+
trackers.registerRecord(proctoringId, true, `Camera Recorder File
|
|
36224
|
+
name: ${cameraFile.name}
|
|
36225
|
+
size: ${cameraFile.size}`);
|
|
36226
|
+
} catch (e) {
|
|
36227
|
+
trackers.registerRecord(proctoringId, false, `Camera Recorder File Error: ${e}`);
|
|
36228
|
+
}
|
|
36229
|
+
try {
|
|
36230
|
+
audioFile = new File(finalAudioBuffer, audioFileName, { type: blob.type });
|
|
36231
|
+
trackers.registerRecord(proctoringId, true, `Audio Recorder File
|
|
36232
|
+
name: ${audioFile.name}
|
|
36233
|
+
size: ${audioFile.size}`);
|
|
36234
|
+
} catch (e) {
|
|
36235
|
+
trackers.registerRecord(proctoringId, false, `Audio Recorder File Error: ${e}`);
|
|
36236
|
+
}
|
|
36205
36237
|
if (finalScreenBuffer.length != 0) {
|
|
36206
|
-
|
|
36238
|
+
try {
|
|
36239
|
+
screenFile = new File(finalScreenBuffer, screenFIleName, { type: "video/webm" });
|
|
36240
|
+
trackers.registerRecord(proctoringId, true, `Screen Recorder File
|
|
36241
|
+
name: ${screenFile.name}
|
|
36242
|
+
size: ${screenFile.size}`);
|
|
36243
|
+
} catch (e) {
|
|
36244
|
+
trackers.registerRecord(proctoringId, false, `Screen Recorder File Error: ${e}`);
|
|
36245
|
+
}
|
|
36207
36246
|
}
|
|
36208
36247
|
return { cameraFile, audioFile, screenFile };
|
|
36209
36248
|
};
|
|
@@ -36219,7 +36258,6 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
36219
36258
|
init(config.insights);
|
|
36220
36259
|
}
|
|
36221
36260
|
async function start(options = defaultProctoringOptions, videoOptions = { width: 640, height: 480 }) {
|
|
36222
|
-
console.log(lastClick);
|
|
36223
36261
|
if (lastClick >= Date.now() - delay)
|
|
36224
36262
|
throw PROCTORING_ALREADY_STARTED;
|
|
36225
36263
|
lastClick = Date.now();
|
|
@@ -36271,7 +36309,6 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
36271
36309
|
sessions: []
|
|
36272
36310
|
});
|
|
36273
36311
|
proctoringId = resp.id;
|
|
36274
|
-
console.log("proctoringId", proctoringId);
|
|
36275
36312
|
trackers.registerStart(proctoringId, true, "");
|
|
36276
36313
|
_addListeners(captureScreen);
|
|
36277
36314
|
return resp;
|
|
@@ -36294,11 +36331,9 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
36294
36331
|
checkPermissions();
|
|
36295
36332
|
startAudio();
|
|
36296
36333
|
const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType }, videoOptions);
|
|
36297
|
-
console.log("Recording...");
|
|
36298
36334
|
return { cameraStream, _screenStream };
|
|
36299
36335
|
}
|
|
36300
36336
|
async function closeCheckDevices() {
|
|
36301
|
-
console.log("Stoping record...");
|
|
36302
36337
|
onStopSharingScreenCallback = void 0;
|
|
36303
36338
|
if (cancelCallback) {
|
|
36304
36339
|
await cancelCallback();
|
|
@@ -36311,7 +36346,6 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
36311
36346
|
screenBuffer = [];
|
|
36312
36347
|
alerts = [];
|
|
36313
36348
|
cancelCallback = null;
|
|
36314
|
-
console.log("Finish record");
|
|
36315
36349
|
return { cameraBlob, screenBlob };
|
|
36316
36350
|
}
|
|
36317
36351
|
async function pause() {
|
|
@@ -36387,157 +36421,214 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
36387
36421
|
trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!" + e);
|
|
36388
36422
|
}
|
|
36389
36423
|
proctoringId = record.id;
|
|
36390
|
-
console.log("procotoringId resume", proctoringId);
|
|
36391
36424
|
startDate = serverTime ? new Date(serverTime.toString()) : new Date();
|
|
36392
36425
|
startTime = startDate.getTime();
|
|
36393
36426
|
return { cameraStream, _screenStream };
|
|
36394
36427
|
}
|
|
36395
36428
|
async function finish(options = {}) {
|
|
36429
|
+
let step = 0;
|
|
36396
36430
|
const { onProgress } = options;
|
|
36397
36431
|
const record = await getRecord("exams");
|
|
36398
36432
|
if (!record) {
|
|
36399
36433
|
trackers.registerError(proctoringId, "Proctoring n\xE3o iniciado!");
|
|
36400
36434
|
throw PROCTORING_NOT_STARTED;
|
|
36401
36435
|
}
|
|
36436
|
+
let serverTime;
|
|
36437
|
+
let cameraFile = new File([], "null");
|
|
36438
|
+
let audioFile = new File([], "null");
|
|
36439
|
+
let screenFile;
|
|
36440
|
+
const allFiles = [];
|
|
36402
36441
|
try {
|
|
36403
|
-
|
|
36404
|
-
|
|
36405
|
-
|
|
36406
|
-
|
|
36407
|
-
|
|
36408
|
-
|
|
36442
|
+
try {
|
|
36443
|
+
if (azureBlobUrl == "") {
|
|
36444
|
+
setBaseUrl(homolConfig);
|
|
36445
|
+
config = await makeRequest({
|
|
36446
|
+
url: `/AzureKey`,
|
|
36447
|
+
method: "GET",
|
|
36448
|
+
jwt: proctoringOptions.token
|
|
36449
|
+
});
|
|
36450
|
+
setConfiguration(config.account, config.containerName, config.sas);
|
|
36451
|
+
azureBlobUrl = config.azureBlobUrl;
|
|
36452
|
+
}
|
|
36453
|
+
} catch (error) {
|
|
36454
|
+
trackers.registerError(proctoringId, "Erro ao buscar credenciais!");
|
|
36455
|
+
throw "Erro ao buscar credenciais!";
|
|
36456
|
+
}
|
|
36457
|
+
onStopSharingScreenCallback = void 0;
|
|
36458
|
+
if (cancelCallback) {
|
|
36459
|
+
await cancelCallback();
|
|
36460
|
+
step++;
|
|
36461
|
+
try {
|
|
36462
|
+
serverTime = await makeRequest({
|
|
36463
|
+
url: `/Proctoring/server-hour`,
|
|
36464
|
+
method: "GET",
|
|
36465
|
+
jwt: proctoringOptions.token
|
|
36466
|
+
});
|
|
36467
|
+
} catch (e) {
|
|
36468
|
+
trackers.registerError(proctoringId, "N\xE3o foi poss\xEDvel requisitar a data do servidor!" + e);
|
|
36469
|
+
throw "N\xE3o foi poss\xEDvel requisitar a data do servidor! -> " + e;
|
|
36470
|
+
}
|
|
36471
|
+
await closeSession();
|
|
36472
|
+
step++;
|
|
36473
|
+
record.sessions.push({
|
|
36474
|
+
alerts,
|
|
36475
|
+
cameraFile,
|
|
36476
|
+
audioFile,
|
|
36477
|
+
screenFile,
|
|
36478
|
+
id: "" + record.sessions.length + 1,
|
|
36479
|
+
start: startDate ? startDate.toISOString() : (serverTime ? new Date(serverTime.toString()) : new Date()).toISOString(),
|
|
36480
|
+
end: serverTime ? new Date(serverTime.toString()).toISOString() : new Date().toISOString()
|
|
36409
36481
|
});
|
|
36410
|
-
|
|
36411
|
-
|
|
36482
|
+
step++;
|
|
36483
|
+
}
|
|
36484
|
+
if (record.sessions.length == 0) {
|
|
36485
|
+
trackers.registerError(proctoringId, "Nenhum v\xEDdeo gravado!");
|
|
36486
|
+
throw NO_VIDEOS_RECORDED;
|
|
36487
|
+
}
|
|
36488
|
+
const time = serverTime ? new Date(serverTime.toString()).toISOString() : new Date().toISOString();
|
|
36489
|
+
pushAllFiles();
|
|
36490
|
+
step++;
|
|
36491
|
+
const totalFiles = allFiles.length;
|
|
36492
|
+
const uploadProgress = Array(totalFiles).fill(0);
|
|
36493
|
+
const handleOnProgress = () => {
|
|
36494
|
+
onProgress && onProgress(uploadProgress.reduce((acc, el) => acc += el, 0) / totalFiles);
|
|
36495
|
+
};
|
|
36496
|
+
const sessionsDto = [];
|
|
36497
|
+
record.sessions.forEach((session) => {
|
|
36498
|
+
sessionsDto.push({
|
|
36499
|
+
alerts: session.alerts,
|
|
36500
|
+
id: session.id,
|
|
36501
|
+
end: session.end,
|
|
36502
|
+
start: session.start,
|
|
36503
|
+
videoCameraUrl: session.cameraFile.name,
|
|
36504
|
+
audioCameraUrl: session.audioFile.name,
|
|
36505
|
+
videoScreenUrl: session.screenFile ? session.screenFile.name : ""
|
|
36506
|
+
});
|
|
36507
|
+
});
|
|
36508
|
+
try {
|
|
36509
|
+
await makeRequest({
|
|
36510
|
+
url: "/proctoring/save-screen",
|
|
36511
|
+
method: "POST",
|
|
36512
|
+
jwt: proctoringOptions.token,
|
|
36513
|
+
body: {
|
|
36514
|
+
proctoringId,
|
|
36515
|
+
alerts: [...sessionsDto[sessionsDto.length - 1].alerts]
|
|
36516
|
+
}
|
|
36517
|
+
});
|
|
36518
|
+
} catch (error) {
|
|
36519
|
+
trackers.registerFinish(proctoringId, false, "save-screen error: " + error);
|
|
36520
|
+
throw "save-screen error: " + error;
|
|
36412
36521
|
}
|
|
36413
|
-
} catch (error) {
|
|
36414
|
-
trackers.registerError(proctoringId, "Erro ao buscar credenciais!");
|
|
36415
|
-
throw "Erro ao buscar credenciais!";
|
|
36416
|
-
}
|
|
36417
|
-
onStopSharingScreenCallback = void 0;
|
|
36418
|
-
let serverTime;
|
|
36419
|
-
console.log("cancelCallback: ", cancelCallback);
|
|
36420
|
-
if (cancelCallback) {
|
|
36421
|
-
await cancelCallback();
|
|
36422
36522
|
try {
|
|
36423
|
-
|
|
36424
|
-
url: `/
|
|
36425
|
-
method: "
|
|
36523
|
+
await makeRequest({
|
|
36524
|
+
url: `/proctoring/finish/${proctoringOptions.examId}`,
|
|
36525
|
+
method: "POST",
|
|
36526
|
+
body: {
|
|
36527
|
+
endDate: time,
|
|
36528
|
+
videoCameraUrl: `${azureBlobUrl}/` + sessionsDto[sessionsDto.length - 1].videoCameraUrl,
|
|
36529
|
+
audioCameraUrl: `${azureBlobUrl}/` + sessionsDto[sessionsDto.length - 1].audioCameraUrl,
|
|
36530
|
+
videoScreenUrl: _captureScreen ? `${azureBlobUrl}/` + sessionsDto[sessionsDto.length - 1].videoScreenUrl : ""
|
|
36531
|
+
},
|
|
36426
36532
|
jwt: proctoringOptions.token
|
|
36427
36533
|
});
|
|
36428
|
-
|
|
36429
|
-
|
|
36534
|
+
trackers.registerFinish(proctoringId, true, "");
|
|
36535
|
+
} catch (error) {
|
|
36536
|
+
trackers.registerFinish(proctoringId, false, "finish error: " + error);
|
|
36430
36537
|
}
|
|
36431
|
-
|
|
36538
|
+
checkVersionAndDownload();
|
|
36539
|
+
if (versionVerify() === "1.0.0.0") {
|
|
36540
|
+
try {
|
|
36541
|
+
trackers.registerUploadVideo(proctoringId, true, "Starting upload");
|
|
36542
|
+
const timeBefore = performance.now();
|
|
36543
|
+
const uploadPromises = allFiles.map((c, i) => {
|
|
36544
|
+
trackers.registerUploadVideo(proctoringId, true, `file: ${c.name}, size ${c.size}`);
|
|
36545
|
+
return upload({
|
|
36546
|
+
file: c,
|
|
36547
|
+
onProgress: (progress) => {
|
|
36548
|
+
uploadProgress[i] = progress;
|
|
36549
|
+
handleOnProgress();
|
|
36550
|
+
}
|
|
36551
|
+
}, proctoringId, config, proctoringOptions.token);
|
|
36552
|
+
});
|
|
36553
|
+
const timeAfter = performance.now();
|
|
36554
|
+
await Promise.all(uploadPromises);
|
|
36555
|
+
const executionTime = timeAfter - timeBefore;
|
|
36556
|
+
trackers.registerUploadVideo(proctoringId, true, "Finish upload", executionTime);
|
|
36557
|
+
} catch (error) {
|
|
36558
|
+
trackers.registerUploadVideo(proctoringId, false, "" + error);
|
|
36559
|
+
}
|
|
36560
|
+
}
|
|
36561
|
+
} catch (e) {
|
|
36562
|
+
console.log("Erro no fluxo de finish, iniciando download de backup\nError: " + e);
|
|
36563
|
+
trackers.registerError(proctoringId, "Erro no fluxo de finish, iniciando download de backup\n" + e);
|
|
36564
|
+
switch (step) {
|
|
36565
|
+
case 0:
|
|
36566
|
+
if (cancelCallback) {
|
|
36567
|
+
await cancelCallback();
|
|
36568
|
+
}
|
|
36569
|
+
case 1: {
|
|
36570
|
+
await closeSession();
|
|
36571
|
+
}
|
|
36572
|
+
case 2:
|
|
36573
|
+
pushRecord();
|
|
36574
|
+
case 3: {
|
|
36575
|
+
pushAllFiles();
|
|
36576
|
+
}
|
|
36577
|
+
case 4: {
|
|
36578
|
+
checkVersionAndDownload();
|
|
36579
|
+
}
|
|
36580
|
+
}
|
|
36581
|
+
console.log("Enviando tracker de error");
|
|
36582
|
+
trackers.registerUploadVideo(proctoringId, false, "Download feito como backup no Catch");
|
|
36583
|
+
}
|
|
36584
|
+
cameraBuffer = [];
|
|
36585
|
+
screenBuffer = [];
|
|
36586
|
+
alerts = [];
|
|
36587
|
+
cancelCallback = null;
|
|
36588
|
+
async function closeSession() {
|
|
36589
|
+
const closeSessionReturn = await _closeSession(record.sessions.length);
|
|
36590
|
+
cameraFile = closeSessionReturn.cameraFile;
|
|
36591
|
+
audioFile = closeSessionReturn.audioFile;
|
|
36592
|
+
screenFile = closeSessionReturn.screenFile;
|
|
36593
|
+
}
|
|
36594
|
+
function pushRecord() {
|
|
36432
36595
|
record.sessions.push({
|
|
36433
36596
|
alerts,
|
|
36434
36597
|
cameraFile,
|
|
36435
36598
|
audioFile,
|
|
36436
36599
|
screenFile,
|
|
36437
36600
|
id: "" + record.sessions.length + 1,
|
|
36438
|
-
start: startDate ? startDate.toISOString() :
|
|
36439
|
-
end:
|
|
36601
|
+
start: startDate ? startDate.toISOString() : new Date().toISOString(),
|
|
36602
|
+
end: new Date().toISOString()
|
|
36440
36603
|
});
|
|
36604
|
+
_removeListeners();
|
|
36441
36605
|
}
|
|
36442
|
-
|
|
36443
|
-
|
|
36444
|
-
|
|
36445
|
-
|
|
36446
|
-
|
|
36447
|
-
|
|
36448
|
-
|
|
36449
|
-
|
|
36450
|
-
allFiles.push(session.cameraFile);
|
|
36451
|
-
if (session.audioFile)
|
|
36452
|
-
allFiles.push(session.audioFile);
|
|
36453
|
-
if (session.screenFile != void 0)
|
|
36454
|
-
allFiles.push(session.screenFile);
|
|
36455
|
-
});
|
|
36456
|
-
const totalFiles = allFiles.length;
|
|
36457
|
-
const uploadProgress = Array(totalFiles).fill(0);
|
|
36458
|
-
const handleOnProgress = () => {
|
|
36459
|
-
onProgress && onProgress(uploadProgress.reduce((acc, el) => acc += el, 0) / totalFiles);
|
|
36460
|
-
};
|
|
36461
|
-
_removeListeners();
|
|
36462
|
-
const sessionsDto = [];
|
|
36463
|
-
record.sessions.forEach((session) => {
|
|
36464
|
-
sessionsDto.push({
|
|
36465
|
-
alerts: session.alerts,
|
|
36466
|
-
id: session.id,
|
|
36467
|
-
end: session.end,
|
|
36468
|
-
start: session.start,
|
|
36469
|
-
videoCameraUrl: session.cameraFile.name,
|
|
36470
|
-
audioCameraUrl: session.audioFile.name,
|
|
36471
|
-
videoScreenUrl: session.screenFile ? session.screenFile.name : ""
|
|
36606
|
+
function pushAllFiles() {
|
|
36607
|
+
record.sessions.forEach((session) => {
|
|
36608
|
+
if (session.cameraFile)
|
|
36609
|
+
allFiles.push(session.cameraFile);
|
|
36610
|
+
if (session.audioFile)
|
|
36611
|
+
allFiles.push(session.audioFile);
|
|
36612
|
+
if (session.screenFile != void 0)
|
|
36613
|
+
allFiles.push(session.screenFile);
|
|
36472
36614
|
});
|
|
36473
|
-
});
|
|
36474
|
-
try {
|
|
36475
|
-
await makeRequest({
|
|
36476
|
-
url: "/proctoring/save-screen",
|
|
36477
|
-
method: "POST",
|
|
36478
|
-
jwt: proctoringOptions.token,
|
|
36479
|
-
body: {
|
|
36480
|
-
proctoringId,
|
|
36481
|
-
alerts: [...sessionsDto[sessionsDto.length - 1].alerts]
|
|
36482
|
-
}
|
|
36483
|
-
});
|
|
36484
|
-
} catch (error) {
|
|
36485
|
-
trackers.registerFinish(proctoringId, false, "save-screen error: " + error);
|
|
36486
36615
|
}
|
|
36487
|
-
|
|
36488
|
-
|
|
36489
|
-
|
|
36490
|
-
|
|
36491
|
-
|
|
36492
|
-
|
|
36493
|
-
|
|
36494
|
-
|
|
36495
|
-
|
|
36496
|
-
|
|
36497
|
-
|
|
36498
|
-
|
|
36499
|
-
|
|
36500
|
-
|
|
36501
|
-
trackers.registerFinish(proctoringId, false, "finish error: " + error);
|
|
36502
|
-
}
|
|
36503
|
-
if (versionVerify() !== "1.0.0.0") {
|
|
36504
|
-
try {
|
|
36505
|
-
trackers.registerUploadVideo(proctoringId, true, "Starting download");
|
|
36506
|
-
allFiles.map((c) => {
|
|
36507
|
-
download2(c);
|
|
36508
|
-
});
|
|
36509
|
-
onProgress && onProgress(Math.round(100));
|
|
36510
|
-
trackers.registerUploadVideo(proctoringId, true, "Finish download");
|
|
36511
|
-
} catch (error) {
|
|
36512
|
-
console.log("Enviando tracker de error");
|
|
36513
|
-
trackers.registerUploadVideo(proctoringId, false, "erro no download " + error);
|
|
36514
|
-
}
|
|
36515
|
-
} else {
|
|
36516
|
-
try {
|
|
36517
|
-
trackers.registerUploadVideo(proctoringId, true, "Starting upload");
|
|
36518
|
-
const timeBefore = performance.now();
|
|
36519
|
-
const uploadPromises = allFiles.map((c, i) => {
|
|
36520
|
-
return upload({
|
|
36521
|
-
file: c,
|
|
36522
|
-
onProgress: (progress) => {
|
|
36523
|
-
uploadProgress[i] = progress;
|
|
36524
|
-
handleOnProgress();
|
|
36525
|
-
}
|
|
36526
|
-
}, proctoringId, config, proctoringOptions.token);
|
|
36527
|
-
});
|
|
36528
|
-
const timeAfter = performance.now();
|
|
36529
|
-
await Promise.all(uploadPromises);
|
|
36530
|
-
const executionTime = timeAfter - timeBefore;
|
|
36531
|
-
trackers.registerUploadVideo(proctoringId, true, "Finish upload", executionTime);
|
|
36532
|
-
} catch (error) {
|
|
36533
|
-
console.log("Enviando tracker de error");
|
|
36534
|
-
trackers.registerUploadVideo(proctoringId, false, "" + error);
|
|
36616
|
+
function checkVersionAndDownload() {
|
|
36617
|
+
if (versionVerify() !== "1.0.0.0") {
|
|
36618
|
+
try {
|
|
36619
|
+
trackers.registerUploadVideo(proctoringId, true, "Starting download");
|
|
36620
|
+
allFiles.map((c) => {
|
|
36621
|
+
trackers.registerUploadVideo(proctoringId, true, `file: ${c.name}, size ${c.size}`);
|
|
36622
|
+
download2(c);
|
|
36623
|
+
});
|
|
36624
|
+
onProgress && onProgress(Math.round(100));
|
|
36625
|
+
trackers.registerUploadVideo(proctoringId, true, "Finish download");
|
|
36626
|
+
} catch (error) {
|
|
36627
|
+
console.log("Enviando tracker de error");
|
|
36628
|
+
trackers.registerUploadVideo(proctoringId, false, "erro no download " + error);
|
|
36629
|
+
}
|
|
36535
36630
|
}
|
|
36536
36631
|
}
|
|
36537
|
-
cameraBuffer = [];
|
|
36538
|
-
screenBuffer = [];
|
|
36539
|
-
alerts = [];
|
|
36540
|
-
cancelCallback = null;
|
|
36541
36632
|
}
|
|
36542
36633
|
function onFocus(cb) {
|
|
36543
36634
|
onFocusCallback = cb;
|
package/package.json
CHANGED
package/plugins/insights.d.ts
CHANGED
|
@@ -9,5 +9,6 @@ declare const trackers: {
|
|
|
9
9
|
registerFinish: (proctoringId: string, success: boolean, description: string) => void;
|
|
10
10
|
registerError: (proctoringId: string, description: string) => void;
|
|
11
11
|
registerUploadVideo: (proctoringId: string, success: boolean, description: string, uploadTime?: number) => void;
|
|
12
|
+
registerRecord: (proctoringId: string, success: boolean, description: string) => void;
|
|
12
13
|
};
|
|
13
14
|
export { trackers, init };
|