easyproctor 2.5.4 → 2.5.6
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 +16 -0
- package/esm/index.js +344 -318
- package/index.js +343 -317
- package/modules/BaseDetection.d.ts +0 -1
- package/new-flow/recorders/CameraRecorder.d.ts +10 -7
- package/new-flow/recorders/NoiseRecorder.d.ts +0 -2
- package/new-flow/recorders/VolumeMeter.d.ts +2 -0
- package/package.json +1 -1
- package/plugins/recorder.d.ts +1 -0
- package/unpkg/easyproctor.min.js +41 -41
- package/new-flow/recorders/AudioRecorder.d.ts +0 -24
package/index.js
CHANGED
|
@@ -25978,7 +25978,6 @@ var BaseDetection = class {
|
|
|
25978
25978
|
}
|
|
25979
25979
|
cameraStream && !this.video.srcObject && (this.video.srcObject = cameraStream);
|
|
25980
25980
|
this.video.play();
|
|
25981
|
-
this.startTime = new Date(Date.now());
|
|
25982
25981
|
const that = this;
|
|
25983
25982
|
(_a2 = this.video) == null ? void 0 : _a2.addEventListener("loadeddata", () => that.predictWebcam());
|
|
25984
25983
|
const style = document.createElement("style");
|
|
@@ -26021,8 +26020,8 @@ var BaseDetection = class {
|
|
|
26021
26020
|
description: this.alertTranslate(description),
|
|
26022
26021
|
type,
|
|
26023
26022
|
category: description,
|
|
26024
|
-
begin:
|
|
26025
|
-
end:
|
|
26023
|
+
begin: 0,
|
|
26024
|
+
end: 0
|
|
26026
26025
|
});
|
|
26027
26026
|
if (this.options.onRealtimeAlertsCallback == null)
|
|
26028
26027
|
this.error && (this.error.innerText = description);
|
|
@@ -26033,8 +26032,8 @@ var BaseDetection = class {
|
|
|
26033
26032
|
description: this.alertTranslate(description),
|
|
26034
26033
|
type,
|
|
26035
26034
|
category: description,
|
|
26036
|
-
begin:
|
|
26037
|
-
end:
|
|
26035
|
+
begin: 0,
|
|
26036
|
+
end: 0
|
|
26038
26037
|
});
|
|
26039
26038
|
this.error && (this.error.innerText = "");
|
|
26040
26039
|
}
|
|
@@ -30306,46 +30305,6 @@ function isMobileDevice() {
|
|
|
30306
30305
|
return /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
|
|
30307
30306
|
}
|
|
30308
30307
|
|
|
30309
|
-
// src/plugins/insights.ts
|
|
30310
|
-
var backendService;
|
|
30311
|
-
var init = (backend) => {
|
|
30312
|
-
backendService = backend;
|
|
30313
|
-
return backendService;
|
|
30314
|
-
};
|
|
30315
|
-
var eventNames = {
|
|
30316
|
-
DEVICES_CHECKED: "devices_checked",
|
|
30317
|
-
START: "start",
|
|
30318
|
-
FINISH: "finish",
|
|
30319
|
-
ERROR: "error",
|
|
30320
|
-
UPLOAD: "upload",
|
|
30321
|
-
UPLOAD_FILE: "upload_file",
|
|
30322
|
-
DOWNLOAD_VIDEO: "download_video",
|
|
30323
|
-
BUFFER_SIZE: "buffer_size",
|
|
30324
|
-
ANOTHER_STREAM: "another_stream",
|
|
30325
|
-
CHANGE_DEVICE: "change_device",
|
|
30326
|
-
STOP_SHARING_SCREEN: "stop_sharing_screen",
|
|
30327
|
-
ERROR_RECORDER_RTC: "error_recorder_rtc",
|
|
30328
|
-
BROWSER_NOT_SUPPORTED: "browser_not_supported",
|
|
30329
|
-
SAVE_ON_SESSION: "save_on_session"
|
|
30330
|
-
};
|
|
30331
|
-
var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
|
|
30332
|
-
var trackers = {
|
|
30333
|
-
registerDevicesChecked: (proctoringId2, success, description) => log(eventNames.DEVICES_CHECKED, { proctoringId: proctoringId2, success, description }),
|
|
30334
|
-
registerStart: (proctoringId2, success, description) => log(eventNames.START, { proctoringId: proctoringId2, success, description }),
|
|
30335
|
-
registerFinish: (proctoringId2, success, description) => log(eventNames.FINISH, { proctoringId: proctoringId2, success, description }),
|
|
30336
|
-
registerError: (proctoringId2, description) => log(eventNames.ERROR, { proctoringId: proctoringId2, description }),
|
|
30337
|
-
registerBrowserNotSupported: (proctoringId2, description) => log(eventNames.BROWSER_NOT_SUPPORTED, { proctoringId: proctoringId2, description }),
|
|
30338
|
-
registerUpload: (proctoringId2, success, description, serviceType, uploadTime) => log(eventNames.UPLOAD, { proctoringId: proctoringId2, success, description, serviceType, uploadTime }),
|
|
30339
|
-
registerUploadFile: (proctoringId2, description, fileType) => log(eventNames.UPLOAD_FILE, { proctoringId: proctoringId2, description, fileType }),
|
|
30340
|
-
registerChangeDevice: (proctoringId2, inOrOut, description) => log(eventNames.CHANGE_DEVICE, { proctoringId: proctoringId2, inOrOut, description }),
|
|
30341
|
-
registerStopSharingScreen: (proctoringId2, description) => log(eventNames.STOP_SHARING_SCREEN, { proctoringId: proctoringId2, description }),
|
|
30342
|
-
registerErrorRecorderRTC: (proctoringId2, description) => log(eventNames.ERROR_RECORDER_RTC, { proctoringId: proctoringId2, description }),
|
|
30343
|
-
registerDownloadFile: (proctoringId2, description) => log(eventNames.DOWNLOAD_VIDEO, { proctoringId: proctoringId2, description }),
|
|
30344
|
-
registerOnBufferSizeError: (proctoringId2, description) => log(eventNames.BUFFER_SIZE, { proctoringId: proctoringId2, description }),
|
|
30345
|
-
registerAnotherStream: (proctoringId2, description) => log(eventNames.ANOTHER_STREAM, { proctoringId: proctoringId2, description }),
|
|
30346
|
-
registerSaveOnSession: (proctoringId2, description) => log(eventNames.SAVE_ON_SESSION, { proctoringId: proctoringId2, description })
|
|
30347
|
-
};
|
|
30348
|
-
|
|
30349
30308
|
// src/plugins/recorder.ts
|
|
30350
30309
|
var proctoringId;
|
|
30351
30310
|
function setRecorderProctoringId(id) {
|
|
@@ -30358,6 +30317,7 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30358
30317
|
let lastEvent;
|
|
30359
30318
|
let bufferSize;
|
|
30360
30319
|
bufferSize = 0;
|
|
30320
|
+
let startTime;
|
|
30361
30321
|
let recorderOptions = {
|
|
30362
30322
|
// eslint-disable-next-line no-useless-escape
|
|
30363
30323
|
mimeType: "video/webm",
|
|
@@ -30377,59 +30337,102 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30377
30337
|
audioBitsPerSecond: 64 * 1e3
|
|
30378
30338
|
};
|
|
30379
30339
|
}
|
|
30380
|
-
|
|
30381
|
-
|
|
30382
|
-
|
|
30383
|
-
|
|
30384
|
-
buffer.push(e3.data);
|
|
30340
|
+
function buildMediaRecorder(stream5, recorderOptions2) {
|
|
30341
|
+
const tracks = stream5.getTracks();
|
|
30342
|
+
if (tracks.length == 0) {
|
|
30343
|
+
throw new Error("No tracks found");
|
|
30385
30344
|
}
|
|
30386
|
-
|
|
30387
|
-
|
|
30388
|
-
|
|
30389
|
-
|
|
30390
|
-
|
|
30391
|
-
|
|
30392
|
-
|
|
30393
|
-
|
|
30394
|
-
|
|
30395
|
-
|
|
30396
|
-
|
|
30345
|
+
const invalidTracks = tracks.find((t3) => t3.readyState != "live");
|
|
30346
|
+
if (invalidTracks) {
|
|
30347
|
+
throw new Error("Track not live: " + invalidTracks.label);
|
|
30348
|
+
}
|
|
30349
|
+
console.log("buildMediaRecorder tracks OK");
|
|
30350
|
+
let mediaRecorder2 = new MediaRecorder(stream5, recorderOptions2);
|
|
30351
|
+
console.log("buildMediaRecorder mediaRecorder OK");
|
|
30352
|
+
mediaRecorder2.ondataavailable = (e3) => {
|
|
30353
|
+
bufferSize = bufferSize + e3.data.size;
|
|
30354
|
+
if (e3.data.size > 0) {
|
|
30355
|
+
buffer.push(e3.data);
|
|
30397
30356
|
}
|
|
30398
|
-
|
|
30399
|
-
|
|
30400
|
-
if (audio && mediaRecorder.state == "inactive") {
|
|
30401
|
-
const blob = new Blob(buffer, { type: "audio/webm" });
|
|
30402
|
-
buffer = [blob];
|
|
30357
|
+
if (stopped) {
|
|
30358
|
+
resolvePromise && resolvePromise();
|
|
30403
30359
|
}
|
|
30404
|
-
|
|
30405
|
-
|
|
30406
|
-
}
|
|
30407
|
-
|
|
30408
|
-
|
|
30409
|
-
|
|
30410
|
-
|
|
30411
|
-
|
|
30412
|
-
|
|
30413
|
-
|
|
30414
|
-
|
|
30415
|
-
|
|
30416
|
-
|
|
30360
|
+
};
|
|
30361
|
+
return mediaRecorder2;
|
|
30362
|
+
}
|
|
30363
|
+
let mediaRecorder = buildMediaRecorder(stream4, recorderOptions);
|
|
30364
|
+
async function startRecorder(recorder2) {
|
|
30365
|
+
return new Promise((resolve, reject) => {
|
|
30366
|
+
var _a2, _b;
|
|
30367
|
+
let started = false;
|
|
30368
|
+
recorder2.onstart = () => {
|
|
30369
|
+
started = true;
|
|
30370
|
+
console.log("recorder onstart");
|
|
30371
|
+
resolve();
|
|
30372
|
+
};
|
|
30373
|
+
recorder2.onerror = (ev) => {
|
|
30374
|
+
console.error("Recorder error event:", ev);
|
|
30375
|
+
stream4.getTracks().forEach((t3) => console.log(t3.readyState));
|
|
30376
|
+
if ("error" in ev) {
|
|
30377
|
+
const err = ev.error;
|
|
30378
|
+
console.error("Error name:", err == null ? void 0 : err.name);
|
|
30379
|
+
console.error("Error message:", err == null ? void 0 : err.message);
|
|
30380
|
+
reject(err || ev);
|
|
30381
|
+
} else {
|
|
30382
|
+
console.warn("Evento sem propriedade error");
|
|
30383
|
+
reject(ev);
|
|
30384
|
+
}
|
|
30385
|
+
};
|
|
30386
|
+
try {
|
|
30387
|
+
console.log("State antes do start:", recorder2.state);
|
|
30388
|
+
recorder2.start(1e4);
|
|
30389
|
+
startTime = new Date(Date.now());
|
|
30390
|
+
} catch (e3) {
|
|
30391
|
+
console.error("Recorder erro ao chamar start event:", e3);
|
|
30392
|
+
console.error("Erro real:", e3, e3 == null ? void 0 : e3.error, (_a2 = e3 == null ? void 0 : e3.error) == null ? void 0 : _a2.name, (_b = e3 == null ? void 0 : e3.error) == null ? void 0 : _b.message);
|
|
30393
|
+
console.error("Erro real 2:", e3, e3 == null ? void 0 : e3.message, e3 == null ? void 0 : e3.name);
|
|
30394
|
+
stream4.getTracks().forEach((t3) => console.log(t3.readyState));
|
|
30395
|
+
return reject(e3);
|
|
30417
30396
|
}
|
|
30397
|
+
setTimeout(() => {
|
|
30398
|
+
if (!started) {
|
|
30399
|
+
console.error("Timeout ao iniciar o recorder");
|
|
30400
|
+
reject(new Error("Timeout ao iniciar o recorder"));
|
|
30401
|
+
}
|
|
30402
|
+
}, 2e3);
|
|
30418
30403
|
});
|
|
30419
30404
|
}
|
|
30405
|
+
async function startRecording() {
|
|
30406
|
+
try {
|
|
30407
|
+
await startRecorder(mediaRecorder);
|
|
30408
|
+
if (mediaRecorder.state === "recording") {
|
|
30409
|
+
bufferSize = 0;
|
|
30410
|
+
stopped = false;
|
|
30411
|
+
return;
|
|
30412
|
+
} else {
|
|
30413
|
+
console.log("Recorder n\xE3o est\xE1 em estado recording ap\xF3s start");
|
|
30414
|
+
}
|
|
30415
|
+
} catch (e3) {
|
|
30416
|
+
console.error("Erro ao iniciar o recorder:", e3);
|
|
30417
|
+
await new Promise((r3) => setTimeout(r3, 300));
|
|
30418
|
+
throw e3;
|
|
30419
|
+
}
|
|
30420
|
+
return;
|
|
30421
|
+
}
|
|
30420
30422
|
function stopRecording() {
|
|
30421
30423
|
return new Promise((resolve) => {
|
|
30422
30424
|
if (mediaRecorder.state == "recording") {
|
|
30425
|
+
console.log("stopRecording Recorder est\xE1 em estado recording, iniciando stop");
|
|
30423
30426
|
resolvePromise = resolve;
|
|
30424
|
-
mediaRecorder.stop();
|
|
30425
30427
|
stopped = true;
|
|
30426
|
-
|
|
30427
|
-
stream4.getTracks().forEach((el) => {
|
|
30428
|
-
el.stop();
|
|
30429
|
-
});
|
|
30428
|
+
mediaRecorder.stop();
|
|
30430
30429
|
} else {
|
|
30430
|
+
console.log("stopRecording Recorder n\xE3o est\xE1 em estado recording");
|
|
30431
30431
|
resolve();
|
|
30432
30432
|
}
|
|
30433
|
+
stream4.getTracks().forEach((el) => {
|
|
30434
|
+
el.stop();
|
|
30435
|
+
});
|
|
30433
30436
|
});
|
|
30434
30437
|
}
|
|
30435
30438
|
function pauseRecording() {
|
|
@@ -30455,16 +30458,60 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30455
30458
|
function getBufferSize() {
|
|
30456
30459
|
return bufferSize;
|
|
30457
30460
|
}
|
|
30461
|
+
function getStartTime() {
|
|
30462
|
+
return startTime;
|
|
30463
|
+
}
|
|
30458
30464
|
return {
|
|
30459
30465
|
startRecording,
|
|
30460
30466
|
stopRecording,
|
|
30461
30467
|
pauseRecording,
|
|
30462
30468
|
resumeRecording,
|
|
30463
30469
|
recorderOptions,
|
|
30464
|
-
getBufferSize
|
|
30470
|
+
getBufferSize,
|
|
30471
|
+
getStartTime
|
|
30465
30472
|
};
|
|
30466
30473
|
}
|
|
30467
30474
|
|
|
30475
|
+
// src/plugins/insights.ts
|
|
30476
|
+
var backendService;
|
|
30477
|
+
var init = (backend) => {
|
|
30478
|
+
backendService = backend;
|
|
30479
|
+
return backendService;
|
|
30480
|
+
};
|
|
30481
|
+
var eventNames = {
|
|
30482
|
+
DEVICES_CHECKED: "devices_checked",
|
|
30483
|
+
START: "start",
|
|
30484
|
+
FINISH: "finish",
|
|
30485
|
+
ERROR: "error",
|
|
30486
|
+
UPLOAD: "upload",
|
|
30487
|
+
UPLOAD_FILE: "upload_file",
|
|
30488
|
+
DOWNLOAD_VIDEO: "download_video",
|
|
30489
|
+
BUFFER_SIZE: "buffer_size",
|
|
30490
|
+
ANOTHER_STREAM: "another_stream",
|
|
30491
|
+
CHANGE_DEVICE: "change_device",
|
|
30492
|
+
STOP_SHARING_SCREEN: "stop_sharing_screen",
|
|
30493
|
+
ERROR_RECORDER_RTC: "error_recorder_rtc",
|
|
30494
|
+
BROWSER_NOT_SUPPORTED: "browser_not_supported",
|
|
30495
|
+
SAVE_ON_SESSION: "save_on_session"
|
|
30496
|
+
};
|
|
30497
|
+
var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
|
|
30498
|
+
var trackers = {
|
|
30499
|
+
registerDevicesChecked: (proctoringId2, success, description) => log(eventNames.DEVICES_CHECKED, { proctoringId: proctoringId2, success, description }),
|
|
30500
|
+
registerStart: (proctoringId2, success, description) => log(eventNames.START, { proctoringId: proctoringId2, success, description }),
|
|
30501
|
+
registerFinish: (proctoringId2, success, description) => log(eventNames.FINISH, { proctoringId: proctoringId2, success, description }),
|
|
30502
|
+
registerError: (proctoringId2, description) => log(eventNames.ERROR, { proctoringId: proctoringId2, description }),
|
|
30503
|
+
registerBrowserNotSupported: (proctoringId2, description) => log(eventNames.BROWSER_NOT_SUPPORTED, { proctoringId: proctoringId2, description }),
|
|
30504
|
+
registerUpload: (proctoringId2, success, description, serviceType, uploadTime) => log(eventNames.UPLOAD, { proctoringId: proctoringId2, success, description, serviceType, uploadTime }),
|
|
30505
|
+
registerUploadFile: (proctoringId2, description, fileType) => log(eventNames.UPLOAD_FILE, { proctoringId: proctoringId2, description, fileType }),
|
|
30506
|
+
registerChangeDevice: (proctoringId2, inOrOut, description) => log(eventNames.CHANGE_DEVICE, { proctoringId: proctoringId2, inOrOut, description }),
|
|
30507
|
+
registerStopSharingScreen: (proctoringId2, description) => log(eventNames.STOP_SHARING_SCREEN, { proctoringId: proctoringId2, description }),
|
|
30508
|
+
registerErrorRecorderRTC: (proctoringId2, description) => log(eventNames.ERROR_RECORDER_RTC, { proctoringId: proctoringId2, description }),
|
|
30509
|
+
registerDownloadFile: (proctoringId2, description) => log(eventNames.DOWNLOAD_VIDEO, { proctoringId: proctoringId2, description }),
|
|
30510
|
+
registerOnBufferSizeError: (proctoringId2, description) => log(eventNames.BUFFER_SIZE, { proctoringId: proctoringId2, description }),
|
|
30511
|
+
registerAnotherStream: (proctoringId2, description) => log(eventNames.ANOTHER_STREAM, { proctoringId: proctoringId2, description }),
|
|
30512
|
+
registerSaveOnSession: (proctoringId2, description) => log(eventNames.SAVE_ON_SESSION, { proctoringId: proctoringId2, description })
|
|
30513
|
+
};
|
|
30514
|
+
|
|
30468
30515
|
// src/new-flow/upload/UploadService.ts
|
|
30469
30516
|
var UploadService = class {
|
|
30470
30517
|
constructor(proctoringId2, backend) {
|
|
@@ -30750,12 +30797,12 @@ var VolumeMeter = class {
|
|
|
30750
30797
|
async start(options = {}) {
|
|
30751
30798
|
return new Promise((resolve, reject) => {
|
|
30752
30799
|
try {
|
|
30753
|
-
|
|
30754
|
-
this.analyser = audioContext.createAnalyser();
|
|
30755
|
-
|
|
30800
|
+
this.audioContext = new AudioContext();
|
|
30801
|
+
this.analyser = this.audioContext.createAnalyser();
|
|
30802
|
+
this.microphone = this.audioContext.createMediaStreamSource(this.stream);
|
|
30756
30803
|
this.analyser.smoothingTimeConstant = 0.8;
|
|
30757
30804
|
this.analyser.fftSize = 1024;
|
|
30758
|
-
microphone.connect(this.analyser);
|
|
30805
|
+
this.microphone.connect(this.analyser);
|
|
30759
30806
|
const processAudio = () => {
|
|
30760
30807
|
const array = new Uint8Array(this.analyser.frequencyBinCount);
|
|
30761
30808
|
this.analyser.getByteFrequencyData(array);
|
|
@@ -30774,9 +30821,13 @@ var VolumeMeter = class {
|
|
|
30774
30821
|
});
|
|
30775
30822
|
}
|
|
30776
30823
|
stop() {
|
|
30824
|
+
var _a2, _b, _c2;
|
|
30777
30825
|
if (this.animationFrameId !== null) {
|
|
30778
30826
|
cancelAnimationFrame(this.animationFrameId);
|
|
30779
30827
|
}
|
|
30828
|
+
(_a2 = this.audioContext) == null ? void 0 : _a2.close();
|
|
30829
|
+
(_b = this.microphone) == null ? void 0 : _b.disconnect();
|
|
30830
|
+
(_c2 = this.analyser) == null ? void 0 : _c2.disconnect();
|
|
30780
30831
|
}
|
|
30781
30832
|
getVolume() {
|
|
30782
30833
|
return this.volume;
|
|
@@ -30837,6 +30888,7 @@ var CameraRecorder = class {
|
|
|
30837
30888
|
this.isCanvasLoopActive = false;
|
|
30838
30889
|
this.hardwareStream = null;
|
|
30839
30890
|
this.internalClonedStream = null;
|
|
30891
|
+
this.videoElement = null;
|
|
30840
30892
|
this.currentRetries = 0;
|
|
30841
30893
|
this.packageCount = 0;
|
|
30842
30894
|
this.noiseWait = 20;
|
|
@@ -30857,7 +30909,12 @@ var CameraRecorder = class {
|
|
|
30857
30909
|
if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone)) {
|
|
30858
30910
|
this.objectDetection = new ObjectDetection(
|
|
30859
30911
|
{
|
|
30860
|
-
onRealtimeAlertsCallback: (response) =>
|
|
30912
|
+
onRealtimeAlertsCallback: (response) => {
|
|
30913
|
+
var _a3, _b2;
|
|
30914
|
+
response.begin = Date.now() - (((_a3 = this.getStartTime()) == null ? void 0 : _a3.getTime()) || 0);
|
|
30915
|
+
response.end = Date.now() - (((_b2 = this.getStartTime()) == null ? void 0 : _b2.getTime()) || 0);
|
|
30916
|
+
this.options.onRealtimeAlertsCallback(response);
|
|
30917
|
+
}
|
|
30861
30918
|
},
|
|
30862
30919
|
this.paramsConfig
|
|
30863
30920
|
);
|
|
@@ -30866,7 +30923,12 @@ var CameraRecorder = class {
|
|
|
30866
30923
|
if ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace) {
|
|
30867
30924
|
this.faceDetection = new FaceDetection(
|
|
30868
30925
|
{
|
|
30869
|
-
onRealtimeAlertsCallback: (response) =>
|
|
30926
|
+
onRealtimeAlertsCallback: (response) => {
|
|
30927
|
+
var _a3, _b2;
|
|
30928
|
+
response.begin = Date.now() - (((_a3 = this.getStartTime()) == null ? void 0 : _a3.getTime()) || 0);
|
|
30929
|
+
response.end = Date.now() - (((_b2 = this.getStartTime()) == null ? void 0 : _b2.getTime()) || 0);
|
|
30930
|
+
this.options.onRealtimeAlertsCallback(response);
|
|
30931
|
+
}
|
|
30870
30932
|
},
|
|
30871
30933
|
this.paramsConfig
|
|
30872
30934
|
);
|
|
@@ -30874,35 +30936,38 @@ var CameraRecorder = class {
|
|
|
30874
30936
|
}
|
|
30875
30937
|
}
|
|
30876
30938
|
configImageCapture() {
|
|
30939
|
+
var _a2;
|
|
30877
30940
|
this.video = document.createElement("video");
|
|
30878
30941
|
this.canvas = document.createElement("canvas");
|
|
30879
30942
|
this.video.srcObject = this.cameraStream;
|
|
30880
30943
|
this.video.play();
|
|
30881
30944
|
this.video.muted = true;
|
|
30882
|
-
|
|
30883
|
-
|
|
30945
|
+
const isPortrait = (_a2 = screen.orientation) == null ? void 0 : _a2.type.includes("portrait");
|
|
30946
|
+
if (isPortrait && isMobileDevice()) {
|
|
30947
|
+
console.log("configurando canvas em portrait");
|
|
30948
|
+
this.canvas.width = this.videoOptions.height / 2;
|
|
30949
|
+
this.canvas.height = this.videoOptions.width / 2;
|
|
30950
|
+
} else {
|
|
30951
|
+
this.canvas.width = this.videoOptions.width / 2;
|
|
30952
|
+
this.canvas.height = this.videoOptions.height / 2;
|
|
30953
|
+
}
|
|
30884
30954
|
}
|
|
30885
30955
|
async bufferError(e3) {
|
|
30886
30956
|
var _a2, _b;
|
|
30887
|
-
console.log("buffer error Camera Recorder params "
|
|
30957
|
+
console.log("buffer error Camera Recorder params ");
|
|
30888
30958
|
const retryEnabled = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.retryEnabled) || false;
|
|
30889
30959
|
const maxRetries = ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.maxRetries) || 3;
|
|
30890
30960
|
if (retryEnabled && this.currentRetries < maxRetries) {
|
|
30891
30961
|
await this.recordingStop();
|
|
30892
|
-
await this.startRecording(
|
|
30893
|
-
retry: true
|
|
30894
|
-
});
|
|
30962
|
+
await this.startRecording();
|
|
30895
30963
|
this.currentRetries++;
|
|
30896
30964
|
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback(this.cameraStream);
|
|
30897
30965
|
} else {
|
|
30898
30966
|
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback();
|
|
30899
30967
|
}
|
|
30900
30968
|
}
|
|
30901
|
-
async
|
|
30902
|
-
var _a2
|
|
30903
|
-
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)) {
|
|
30904
|
-
await this.initializeDetectors();
|
|
30905
|
-
}
|
|
30969
|
+
async startStream() {
|
|
30970
|
+
var _a2;
|
|
30906
30971
|
const { cameraId, microphoneId, onBufferSizeErrorCallback } = this.options;
|
|
30907
30972
|
const constraints = {
|
|
30908
30973
|
audio: { deviceId: microphoneId },
|
|
@@ -30926,13 +30991,81 @@ var CameraRecorder = class {
|
|
|
30926
30991
|
const track = this.cameraStream.getVideoTracks()[0];
|
|
30927
30992
|
const settings = track.getSettings();
|
|
30928
30993
|
let { width = 0, height = 0 } = settings;
|
|
30994
|
+
const isPortrait = (_a2 = screen.orientation) == null ? void 0 : _a2.type.includes("portrait");
|
|
30995
|
+
if (isPortrait && isMobileDevice()) {
|
|
30996
|
+
if (this.videoOptions.width == height && this.videoOptions.height == width) {
|
|
30997
|
+
[width, height] = [height, width];
|
|
30998
|
+
}
|
|
30999
|
+
}
|
|
31000
|
+
if (this.videoOptions.minWidth > width || this.videoOptions.minHeight > height) {
|
|
31001
|
+
throw STREAM_UNDER_MINIMUM_PERMITTED;
|
|
31002
|
+
} else if (this.videoOptions.width !== width || this.videoOptions.height !== height) {
|
|
31003
|
+
trackers.registerAnotherStream(
|
|
31004
|
+
this.proctoringId,
|
|
31005
|
+
`Maybe have another stream active
|
|
31006
|
+
Video Options: ${JSON.stringify(
|
|
31007
|
+
this.videoOptions,
|
|
31008
|
+
null,
|
|
31009
|
+
2
|
|
31010
|
+
)}
|
|
31011
|
+
Setting: ${JSON.stringify(settings, null, 2)}`
|
|
31012
|
+
);
|
|
31013
|
+
throw ANOTHER_STREAM_ACTIVE;
|
|
31014
|
+
}
|
|
31015
|
+
}
|
|
31016
|
+
async stopStream() {
|
|
31017
|
+
if (this.cameraStream) {
|
|
31018
|
+
this.cameraStream.getTracks().forEach((track) => track.stop());
|
|
31019
|
+
}
|
|
31020
|
+
if (this.internalClonedStream) {
|
|
31021
|
+
this.internalClonedStream.getTracks().forEach((track) => track.stop());
|
|
31022
|
+
this.internalClonedStream = null;
|
|
31023
|
+
}
|
|
31024
|
+
if (this.hardwareStream) {
|
|
31025
|
+
this.hardwareStream.getTracks().forEach((track) => track.stop());
|
|
31026
|
+
this.hardwareStream = null;
|
|
31027
|
+
}
|
|
31028
|
+
}
|
|
31029
|
+
async waitForVideoFlow() {
|
|
31030
|
+
return new Promise((resolve) => {
|
|
31031
|
+
const check = () => {
|
|
31032
|
+
var _a2;
|
|
31033
|
+
if (this.videoElement && ((_a2 = this.videoElement) == null ? void 0 : _a2.readyState) >= 3) return resolve();
|
|
31034
|
+
else requestAnimationFrame(check);
|
|
31035
|
+
};
|
|
31036
|
+
check();
|
|
31037
|
+
});
|
|
31038
|
+
}
|
|
31039
|
+
async attachAndWarmup(stream4) {
|
|
31040
|
+
this.videoElement = document.createElement("video");
|
|
31041
|
+
this.videoElement.srcObject = stream4;
|
|
31042
|
+
this.videoElement.muted = true;
|
|
31043
|
+
await this.videoElement.play().catch((e3) => {
|
|
31044
|
+
});
|
|
31045
|
+
await new Promise((resolve) => {
|
|
31046
|
+
var _a2;
|
|
31047
|
+
if (this.videoElement && ((_a2 = this.videoElement) == null ? void 0 : _a2.readyState) >= 1) return resolve();
|
|
31048
|
+
if (this.videoElement)
|
|
31049
|
+
this.videoElement.onloadedmetadata = () => resolve();
|
|
31050
|
+
});
|
|
31051
|
+
console.log("CameraRecorder checking metadata ok");
|
|
31052
|
+
await this.waitForVideoFlow();
|
|
31053
|
+
console.log("CameraRecorder waiting for video flow ok");
|
|
31054
|
+
await new Promise((r3) => setTimeout(r3, 300));
|
|
31055
|
+
}
|
|
31056
|
+
async startRecording() {
|
|
31057
|
+
var _a2, _b, _c2, _d, _e3, _f, _g;
|
|
31058
|
+
console.log("CameraRecorder startRecording");
|
|
31059
|
+
await this.startStream();
|
|
31060
|
+
await this.attachAndWarmup(this.cameraStream);
|
|
30929
31061
|
const {
|
|
30930
31062
|
startRecording,
|
|
30931
31063
|
stopRecording,
|
|
30932
31064
|
pauseRecording,
|
|
30933
31065
|
resumeRecording,
|
|
30934
31066
|
recorderOptions,
|
|
30935
|
-
getBufferSize
|
|
31067
|
+
getBufferSize,
|
|
31068
|
+
getStartTime
|
|
30936
31069
|
} = recorder(
|
|
30937
31070
|
this.cameraStream,
|
|
30938
31071
|
// streamToRecord,
|
|
@@ -30947,42 +31080,41 @@ var CameraRecorder = class {
|
|
|
30947
31080
|
this.recordingResume = resumeRecording;
|
|
30948
31081
|
this.recorderOptions = recorderOptions;
|
|
30949
31082
|
this.getBufferSize = getBufferSize;
|
|
30950
|
-
this.
|
|
30951
|
-
|
|
30952
|
-
|
|
30953
|
-
|
|
30954
|
-
|
|
31083
|
+
this.getStartTime = getStartTime;
|
|
31084
|
+
try {
|
|
31085
|
+
await new Promise((r3) => setTimeout(r3, 500));
|
|
31086
|
+
await this.recordingStart();
|
|
31087
|
+
} catch (error) {
|
|
31088
|
+
console.log("Camera Recorder error", error);
|
|
31089
|
+
this.stopRecording();
|
|
31090
|
+
const maxRetries = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.maxRetries) || 3;
|
|
31091
|
+
if (this.currentRetries < maxRetries) {
|
|
31092
|
+
console.log("Camera Recorder retry", this.currentRetries);
|
|
31093
|
+
this.currentRetries++;
|
|
31094
|
+
await this.startRecording();
|
|
31095
|
+
} else {
|
|
31096
|
+
throw error;
|
|
30955
31097
|
}
|
|
30956
31098
|
}
|
|
30957
|
-
if (this.
|
|
30958
|
-
|
|
30959
|
-
} else if (this.videoOptions.width !== width || this.videoOptions.height !== height) {
|
|
30960
|
-
trackers.registerAnotherStream(
|
|
30961
|
-
this.proctoringId,
|
|
30962
|
-
`Maybe have another stream active
|
|
30963
|
-
Video Options: ${JSON.stringify(
|
|
30964
|
-
this.videoOptions,
|
|
30965
|
-
null,
|
|
30966
|
-
2
|
|
30967
|
-
)}
|
|
30968
|
-
Setting: ${JSON.stringify(settings, null, 2)}`
|
|
30969
|
-
);
|
|
30970
|
-
throw ANOTHER_STREAM_ACTIVE;
|
|
31099
|
+
if (((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectPerson) || ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectCellPhone) || ((_d = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _d.detectFace)) {
|
|
31100
|
+
await this.initializeDetectors();
|
|
30971
31101
|
}
|
|
30972
|
-
((_e3 = this.paramsConfig.
|
|
30973
|
-
if ((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectFace) {
|
|
31102
|
+
if ((_e3 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _e3.detectFace) {
|
|
30974
31103
|
await this.faceDetection.enableCam(this.cameraStream);
|
|
30975
31104
|
}
|
|
30976
|
-
if (((
|
|
31105
|
+
if (((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectPerson) || ((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectCellPhone)) {
|
|
30977
31106
|
await this.objectDetection.enableCam(this.cameraStream);
|
|
30978
31107
|
}
|
|
30979
31108
|
this.filesToUpload = [];
|
|
30980
31109
|
if (this.options.proctoringType == "REALTIME") {
|
|
30981
|
-
this.
|
|
31110
|
+
await this.startRealtimeCapture();
|
|
30982
31111
|
}
|
|
30983
31112
|
this.packageCount = 0;
|
|
31113
|
+
console.log("Camera Recorder started OK");
|
|
30984
31114
|
}
|
|
30985
31115
|
async stopRecording() {
|
|
31116
|
+
var _a2, _b, _c2;
|
|
31117
|
+
console.log("Camera Recorder stopRecording");
|
|
30986
31118
|
this.isCanvasLoopActive = false;
|
|
30987
31119
|
this.recordingStop && await this.recordingStop();
|
|
30988
31120
|
try {
|
|
@@ -31001,6 +31133,16 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31001
31133
|
this.hardwareStream.getTracks().forEach((track) => track.stop());
|
|
31002
31134
|
this.hardwareStream = null;
|
|
31003
31135
|
}
|
|
31136
|
+
if (this.videoElement) {
|
|
31137
|
+
(_a2 = this.videoElement) == null ? void 0 : _a2.remove();
|
|
31138
|
+
this.videoElement = null;
|
|
31139
|
+
}
|
|
31140
|
+
if (this.video) {
|
|
31141
|
+
(_b = this.video) == null ? void 0 : _b.remove();
|
|
31142
|
+
}
|
|
31143
|
+
if (this.canvas) {
|
|
31144
|
+
(_c2 = this.canvas) == null ? void 0 : _c2.remove();
|
|
31145
|
+
}
|
|
31004
31146
|
} catch {
|
|
31005
31147
|
console.error("Erro ao parar os streams de m\xEDdia.");
|
|
31006
31148
|
}
|
|
@@ -31021,35 +31163,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31021
31163
|
async resumeRecording() {
|
|
31022
31164
|
await this.recordingResume();
|
|
31023
31165
|
}
|
|
31024
|
-
photoShotsCycle() {
|
|
31025
|
-
let imageFile;
|
|
31026
|
-
this.configImageCapture();
|
|
31027
|
-
this.imageInterval = setInterval(async () => {
|
|
31028
|
-
this.canvas.getContext("2d").drawImage(
|
|
31029
|
-
this.video,
|
|
31030
|
-
0,
|
|
31031
|
-
0,
|
|
31032
|
-
this.videoOptions.width,
|
|
31033
|
-
this.videoOptions.height
|
|
31034
|
-
);
|
|
31035
|
-
const image_data_url = this.canvas.toDataURL("image/jpeg");
|
|
31036
|
-
imageFile = await this.getFile(
|
|
31037
|
-
image_data_url,
|
|
31038
|
-
`${this.proctoringId}_${this.imageCount + 1}.jpg`,
|
|
31039
|
-
"image/jpeg"
|
|
31040
|
-
);
|
|
31041
|
-
if (imageFile && this.upload && this.backendToken) {
|
|
31042
|
-
this.upload.upload(
|
|
31043
|
-
{
|
|
31044
|
-
file: imageFile
|
|
31045
|
-
},
|
|
31046
|
-
this.backendToken,
|
|
31047
|
-
true
|
|
31048
|
-
);
|
|
31049
|
-
this.imageCount++;
|
|
31050
|
-
}
|
|
31051
|
-
}, this.paramsConfig.imageBehaviourParameters.uploadInterval * 1e3);
|
|
31052
|
-
}
|
|
31053
31166
|
async getCurrentImageBase64() {
|
|
31054
31167
|
if (!this.video || !this.canvas) {
|
|
31055
31168
|
this.configImageCapture();
|
|
@@ -31080,37 +31193,35 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31080
31193
|
this.canvas.getContext("2d").drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
|
|
31081
31194
|
return this.canvas.toDataURL("image/jpeg");
|
|
31082
31195
|
}
|
|
31083
|
-
|
|
31084
|
-
|
|
31085
|
-
var _a2, _b;
|
|
31196
|
+
async captureFrame() {
|
|
31197
|
+
var _a2;
|
|
31086
31198
|
let imageFile;
|
|
31087
|
-
this.configImageCapture();
|
|
31088
|
-
let newCanvasWidth = this.videoOptions.width / 2;
|
|
31089
|
-
let newCanvasHeight = this.videoOptions.height / 2;
|
|
31090
|
-
if (newCanvasWidth < 320) newCanvasWidth = 320;
|
|
31091
|
-
if (newCanvasHeight < 180) newCanvasHeight = 180;
|
|
31092
|
-
this.canvas.width = newCanvasWidth;
|
|
31093
|
-
this.canvas.height = newCanvasHeight;
|
|
31094
31199
|
const packSize = (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimePackageSize;
|
|
31200
|
+
this.canvas.getContext("2d").drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
|
|
31201
|
+
const image_data_url = this.canvas.toDataURL("image/jpeg");
|
|
31202
|
+
if (this.proctoringId == void 0) return;
|
|
31203
|
+
if (packSize == this.imageCount) {
|
|
31204
|
+
this.imageCount = 0;
|
|
31205
|
+
const framesToSend = [...this.filesToUpload];
|
|
31206
|
+
this.sendPackage(framesToSend);
|
|
31207
|
+
await this.filesToUpload.splice(0, this.filesToUpload.length);
|
|
31208
|
+
}
|
|
31209
|
+
let imageName = `${this.proctoringId}_${this.imageCount + 1}.jpg`;
|
|
31210
|
+
imageFile = await this.getFile(image_data_url, imageName, "image/jpeg");
|
|
31211
|
+
if (imageFile && imageFile.size > 10 && packSize > 0) {
|
|
31212
|
+
this.filesToUpload.push(imageFile);
|
|
31213
|
+
this.imageCount++;
|
|
31214
|
+
}
|
|
31215
|
+
}
|
|
31216
|
+
// inicia a captura de um frame a cada intervalo de tempo definido no paramsConfig.videoBehaviourParameters?.realtimeCaptureInterval!
|
|
31217
|
+
async startRealtimeCapture() {
|
|
31218
|
+
var _a2;
|
|
31219
|
+
this.configImageCapture();
|
|
31095
31220
|
this.imageCount = 0;
|
|
31221
|
+
await this.captureFrame();
|
|
31096
31222
|
this.imageInterval = setInterval(async () => {
|
|
31097
|
-
|
|
31098
|
-
|
|
31099
|
-
const image_data_url = this.canvas.toDataURL("image/jpeg");
|
|
31100
|
-
if (this.proctoringId == void 0) return;
|
|
31101
|
-
if (packSize == this.imageCount) {
|
|
31102
|
-
this.imageCount = 0;
|
|
31103
|
-
const framesToSend = [...this.filesToUpload];
|
|
31104
|
-
this.sendPackage(framesToSend);
|
|
31105
|
-
await this.filesToUpload.splice(0, this.filesToUpload.length);
|
|
31106
|
-
}
|
|
31107
|
-
let imageName = `${this.proctoringId}_${this.imageCount + 1}.jpg`;
|
|
31108
|
-
imageFile = await this.getFile(image_data_url, imageName, "image/jpeg");
|
|
31109
|
-
if (imageFile && imageFile.size > 10 && packSize > 0) {
|
|
31110
|
-
this.filesToUpload.push(imageFile);
|
|
31111
|
-
this.imageCount++;
|
|
31112
|
-
}
|
|
31113
|
-
}, ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.realtimeCaptureInterval) * 1e3);
|
|
31223
|
+
await this.captureFrame();
|
|
31224
|
+
}, ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimeCaptureInterval) * 1e3);
|
|
31114
31225
|
}
|
|
31115
31226
|
// envia pacote de imagens
|
|
31116
31227
|
async sendPackage(framesToSend) {
|
|
@@ -31118,7 +31229,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31118
31229
|
let pending = false;
|
|
31119
31230
|
let undeliveredPackagesCount = 0;
|
|
31120
31231
|
const packSize = (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimePackageSize;
|
|
31121
|
-
const packCaptureInterval = (
|
|
31232
|
+
const packCaptureInterval = (_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.realtimeCaptureInterval;
|
|
31122
31233
|
if (this.upload && this.backendToken && !pending && this.filesToUpload.length > 0) {
|
|
31123
31234
|
undeliveredPackagesCount = 0;
|
|
31124
31235
|
pending = true;
|
|
@@ -31226,45 +31337,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31226
31337
|
}
|
|
31227
31338
|
this.noiseWait++;
|
|
31228
31339
|
}
|
|
31229
|
-
/**
|
|
31230
|
-
* Cria um stream processado onde os frames são rotacionados via Canvas.
|
|
31231
|
-
* Isso corrige o problema de gravação deitada em iOS/Mobile.
|
|
31232
|
-
*/
|
|
31233
|
-
createRotatedStream(originalStream) {
|
|
31234
|
-
this.internalClonedStream = originalStream.clone();
|
|
31235
|
-
const video = document.createElement("video");
|
|
31236
|
-
video.srcObject = this.internalClonedStream;
|
|
31237
|
-
video.muted = true;
|
|
31238
|
-
video.play();
|
|
31239
|
-
const canvas = document.createElement("canvas");
|
|
31240
|
-
const ctx = canvas.getContext("2d");
|
|
31241
|
-
const track = originalStream.getVideoTracks()[0];
|
|
31242
|
-
const settings = track.getSettings();
|
|
31243
|
-
const width = settings.width || 640;
|
|
31244
|
-
const height = settings.height || 480;
|
|
31245
|
-
canvas.width = height;
|
|
31246
|
-
canvas.height = width;
|
|
31247
|
-
const draw = () => {
|
|
31248
|
-
if (video.paused || video.ended) return;
|
|
31249
|
-
if (!this.isCanvasLoopActive) return;
|
|
31250
|
-
if (ctx) {
|
|
31251
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
31252
|
-
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
31253
|
-
}
|
|
31254
|
-
if (this.isCanvasLoopActive) {
|
|
31255
|
-
this.animationFrameId = requestAnimationFrame(draw);
|
|
31256
|
-
}
|
|
31257
|
-
};
|
|
31258
|
-
video.onplaying = () => {
|
|
31259
|
-
this.isCanvasLoopActive = true;
|
|
31260
|
-
draw();
|
|
31261
|
-
};
|
|
31262
|
-
const canvasStream = canvas.captureStream(30);
|
|
31263
|
-
originalStream.getAudioTracks().forEach((track2) => {
|
|
31264
|
-
canvasStream.addTrack(track2);
|
|
31265
|
-
});
|
|
31266
|
-
return canvasStream;
|
|
31267
|
-
}
|
|
31268
31340
|
};
|
|
31269
31341
|
|
|
31270
31342
|
// src/new-flow/checkers/DeviceCheckerUI.ts
|
|
@@ -32345,6 +32417,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
32345
32417
|
return this.deviceCheckResult;
|
|
32346
32418
|
}
|
|
32347
32419
|
async runCheckDevicesFlow(options, _videoOptions, onModalConfirm, onModalCancel, onUpdate) {
|
|
32420
|
+
var _a2;
|
|
32348
32421
|
if (_DeviceCheckerService.isModalOpen) {
|
|
32349
32422
|
return Promise.reject("Modal j\xE1 est\xE1 aberto");
|
|
32350
32423
|
}
|
|
@@ -32362,7 +32435,9 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
32362
32435
|
options,
|
|
32363
32436
|
_videoOptions
|
|
32364
32437
|
);
|
|
32365
|
-
this.
|
|
32438
|
+
if ((_a2 = this.options) == null ? void 0 : _a2.useSpyScan) {
|
|
32439
|
+
await this.checkSpyScan();
|
|
32440
|
+
}
|
|
32366
32441
|
const returnData = { cameraStream: this.cameraRecorder.cameraStream };
|
|
32367
32442
|
this.onUpdateCb = (e3) => onUpdate(e3);
|
|
32368
32443
|
const resultPromise = new Promise(
|
|
@@ -32417,6 +32492,10 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
32417
32492
|
if (_DeviceCheckerService.isModalOpen) {
|
|
32418
32493
|
return Promise.reject();
|
|
32419
32494
|
}
|
|
32495
|
+
this.allowedAmbient = false;
|
|
32496
|
+
this.allowedMicrophone = false;
|
|
32497
|
+
this.allowedAmbient = false;
|
|
32498
|
+
this.allowedPositionFace = false;
|
|
32420
32499
|
_DeviceCheckerService.isModalOpen = true;
|
|
32421
32500
|
this.DeviceCheckerUI = new DeviceCheckerUI(options, _videoOptions);
|
|
32422
32501
|
try {
|
|
@@ -32454,8 +32533,8 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
32454
32533
|
resolve(response);
|
|
32455
32534
|
});
|
|
32456
32535
|
} catch (error) {
|
|
32536
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.closeModal();
|
|
32457
32537
|
this.closeCheckDevices();
|
|
32458
|
-
this.DeviceCheckerUI.closeModal();
|
|
32459
32538
|
return Promise.reject(error);
|
|
32460
32539
|
}
|
|
32461
32540
|
}
|
|
@@ -32526,7 +32605,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
32526
32605
|
}
|
|
32527
32606
|
async changeSelectedDevice({ cameraId, microphoneId }) {
|
|
32528
32607
|
var _a2;
|
|
32529
|
-
this.cameraRecorder.
|
|
32608
|
+
this.cameraRecorder.stopStream && await this.cameraRecorder.stopStream();
|
|
32530
32609
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
32531
32610
|
this.faceDetection.stopDetection();
|
|
32532
32611
|
this.cameraRecorder = new CameraRecorder(
|
|
@@ -32542,7 +32621,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
32542
32621
|
height: this.videoOptions.height
|
|
32543
32622
|
}
|
|
32544
32623
|
);
|
|
32545
|
-
await this.cameraRecorder.
|
|
32624
|
+
await this.cameraRecorder.startStream();
|
|
32546
32625
|
this.videoDeviceInterface(this.cameraRecorder.cameraStream);
|
|
32547
32626
|
this.audioDeviceInterface(this.cameraRecorder.cameraStream);
|
|
32548
32627
|
return {
|
|
@@ -32550,6 +32629,10 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
32550
32629
|
};
|
|
32551
32630
|
}
|
|
32552
32631
|
async startCheckDevices(options = getDefaultProctoringOptions, _videoOptions) {
|
|
32632
|
+
this.allowedAmbient = false;
|
|
32633
|
+
this.allowedMicrophone = false;
|
|
32634
|
+
this.allowedAmbient = false;
|
|
32635
|
+
this.allowedPositionFace = false;
|
|
32553
32636
|
this.DeviceCheckerUI && this.DeviceCheckerUI.setSelectOption(
|
|
32554
32637
|
options,
|
|
32555
32638
|
(e3) => this.changeSelectedDevice(e3)
|
|
@@ -32569,7 +32652,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
32569
32652
|
height: this.videoOptions.height
|
|
32570
32653
|
}
|
|
32571
32654
|
);
|
|
32572
|
-
await this.cameraRecorder.
|
|
32655
|
+
await this.cameraRecorder.startStream();
|
|
32573
32656
|
this.videoDeviceInterface(this.cameraRecorder.cameraStream);
|
|
32574
32657
|
this.audioDeviceInterface(this.cameraRecorder.cameraStream);
|
|
32575
32658
|
if (this.DeviceCheckerUI) {
|
|
@@ -32586,7 +32669,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
32586
32669
|
this.faceDetection.stopDetection();
|
|
32587
32670
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
32588
32671
|
this.volumeMedia = Math.ceil(this.volumeSum / this.volumeCounter);
|
|
32589
|
-
this.cameraRecorder.
|
|
32672
|
+
this.cameraRecorder.stopStream && await this.cameraRecorder.stopStream();
|
|
32590
32673
|
this.DeviceCheckerUI = void 0;
|
|
32591
32674
|
this.onUpdateCb = void 0;
|
|
32592
32675
|
}
|
|
@@ -32659,7 +32742,7 @@ var CapturePhoto = class {
|
|
|
32659
32742
|
// height: 480,
|
|
32660
32743
|
// }
|
|
32661
32744
|
);
|
|
32662
|
-
await this.cameraRecorder.
|
|
32745
|
+
await this.cameraRecorder.startStream();
|
|
32663
32746
|
cameraContainer.srcObject = this.cameraRecorder.cameraStream;
|
|
32664
32747
|
cameraContainer.play();
|
|
32665
32748
|
}
|
|
@@ -32899,7 +32982,7 @@ var CapturePhoto = class {
|
|
|
32899
32982
|
});
|
|
32900
32983
|
}
|
|
32901
32984
|
async closeInterface() {
|
|
32902
|
-
await this.cameraRecorder.
|
|
32985
|
+
await this.cameraRecorder.stopStream();
|
|
32903
32986
|
const authPhoto = document.querySelector("#authPhoto");
|
|
32904
32987
|
authPhoto == null ? void 0 : authPhoto.remove();
|
|
32905
32988
|
}
|
|
@@ -33403,54 +33486,6 @@ var AlertRecorder = class {
|
|
|
33403
33486
|
}
|
|
33404
33487
|
};
|
|
33405
33488
|
|
|
33406
|
-
// src/new-flow/recorders/AudioRecorder.ts
|
|
33407
|
-
var AudioRecorder = class {
|
|
33408
|
-
constructor(options, audioParams) {
|
|
33409
|
-
this.blobs = [];
|
|
33410
|
-
this.options = {
|
|
33411
|
-
cameraId: void 0,
|
|
33412
|
-
microphoneId: void 0
|
|
33413
|
-
};
|
|
33414
|
-
this.audioParams = {
|
|
33415
|
-
recordingBitrate: 128
|
|
33416
|
-
};
|
|
33417
|
-
audioParams && (this.audioParams = audioParams);
|
|
33418
|
-
options && (this.options = options);
|
|
33419
|
-
}
|
|
33420
|
-
async startRecording() {
|
|
33421
|
-
const constraints = {
|
|
33422
|
-
audio: { deviceId: this.options.microphoneId || "default" }
|
|
33423
|
-
};
|
|
33424
|
-
this.audioStream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
33425
|
-
const { startRecording, stopRecording, pauseRecording, resumeRecording } = recorder(this.audioStream, this.blobs, void 0, void 0, true);
|
|
33426
|
-
this.recordingStart = startRecording;
|
|
33427
|
-
this.recordingStop = stopRecording;
|
|
33428
|
-
this.recordingPause = pauseRecording;
|
|
33429
|
-
this.recordingResume = resumeRecording;
|
|
33430
|
-
this.recordingStart();
|
|
33431
|
-
}
|
|
33432
|
-
async pauseRecording() {
|
|
33433
|
-
}
|
|
33434
|
-
async resumeRecording() {
|
|
33435
|
-
}
|
|
33436
|
-
async stopRecording() {
|
|
33437
|
-
this.recordingStop && await this.recordingStop();
|
|
33438
|
-
}
|
|
33439
|
-
async saveOnSession(session, start, end) {
|
|
33440
|
-
session.addRecording({
|
|
33441
|
-
device: "",
|
|
33442
|
-
file: new File(
|
|
33443
|
-
this.blobs,
|
|
33444
|
-
`EP_${session.id}_audio_${start && end && `${start}_${end}` || "0"}.webm`,
|
|
33445
|
-
{
|
|
33446
|
-
type: "audio/webm"
|
|
33447
|
-
}
|
|
33448
|
-
),
|
|
33449
|
-
origin: "Mic" /* Mic */
|
|
33450
|
-
});
|
|
33451
|
-
}
|
|
33452
|
-
};
|
|
33453
|
-
|
|
33454
33489
|
// node_modules/@mediapipe/tasks-audio/audio_bundle.mjs
|
|
33455
33490
|
var t2 = "undefined" != typeof self ? self : {};
|
|
33456
33491
|
function e2() {
|
|
@@ -35690,7 +35725,6 @@ var NoiseRecorder = class {
|
|
|
35690
35725
|
this.recordingInProgress = false;
|
|
35691
35726
|
this.recordIndex = 1;
|
|
35692
35727
|
this.countLoopTimes = 0;
|
|
35693
|
-
this.examStartTime = 0;
|
|
35694
35728
|
this.recordingStartTime = 0;
|
|
35695
35729
|
this.recordingEndTime = 0;
|
|
35696
35730
|
this.isSpeech = false;
|
|
@@ -35717,12 +35751,7 @@ var NoiseRecorder = class {
|
|
|
35717
35751
|
this.proctoringId && this.backend && (this.upload = new UploadService(this.proctoringId, this.backend));
|
|
35718
35752
|
}
|
|
35719
35753
|
async startRecording() {
|
|
35720
|
-
this.examStartTime = Date.now();
|
|
35721
35754
|
await this.createAudioClassifier();
|
|
35722
|
-
this.audioRecorder = new AudioRecorder(
|
|
35723
|
-
void 0,
|
|
35724
|
-
this.paramsConfig.audioBehaviourParameters
|
|
35725
|
-
);
|
|
35726
35755
|
this.intervalNoiseDetection = setInterval(
|
|
35727
35756
|
() => this.onNoiseDetectedRecord(),
|
|
35728
35757
|
200
|
|
@@ -35734,6 +35763,7 @@ var NoiseRecorder = class {
|
|
|
35734
35763
|
await this.stopSoundRecord();
|
|
35735
35764
|
await this.volumeMeter && this.volumeMeter.stop();
|
|
35736
35765
|
this.audioWorkletNode && this.audioWorkletNode.disconnect();
|
|
35766
|
+
this.context && this.context.close();
|
|
35737
35767
|
}
|
|
35738
35768
|
async pauseRecording() {
|
|
35739
35769
|
}
|
|
@@ -35742,7 +35772,7 @@ var NoiseRecorder = class {
|
|
|
35742
35772
|
async saveOnSession(session) {
|
|
35743
35773
|
}
|
|
35744
35774
|
async onNoiseDetectedRecord() {
|
|
35745
|
-
var _a2, _b, _c2, _d;
|
|
35775
|
+
var _a2, _b, _c2, _d, _e3, _f, _g, _h, _i3;
|
|
35746
35776
|
if (!this.volumeMeter && this.cameraRecorder.cameraStream) {
|
|
35747
35777
|
this.volumeMeter = new VolumeMeter(this.cameraRecorder.cameraStream);
|
|
35748
35778
|
this.volumeMeter.start().catch((e3) => {
|
|
@@ -35764,7 +35794,7 @@ var NoiseRecorder = class {
|
|
|
35764
35794
|
this.recordingChunks = [...this.preRollBuffer];
|
|
35765
35795
|
const totalSamplesInBuffer = this.preRollBuffer.reduce((acc, chunk) => acc + chunk.length, 0);
|
|
35766
35796
|
const bufferDurationMs = totalSamplesInBuffer / this.SAMPLE_RATE * 1e3;
|
|
35767
|
-
const triggerTime = Date.now() - this.
|
|
35797
|
+
const triggerTime = Date.now() - (((_c2 = this.cameraRecorder.getStartTime()) == null ? void 0 : _c2.getTime()) || 0);
|
|
35768
35798
|
this.recordingStartTime = triggerTime - bufferDurationMs;
|
|
35769
35799
|
if (this.recordingStartTime < 0) this.recordingStartTime = 0;
|
|
35770
35800
|
} else if (this.recordingInProgress) {
|
|
@@ -35772,15 +35802,19 @@ var NoiseRecorder = class {
|
|
|
35772
35802
|
const currentRecordDuration = Date.now() - this.recordingStartTime;
|
|
35773
35803
|
if (silenceDuration >= this.SILENCE_THRESHOLD && currentRecordDuration >= 3e3 && this.countLoopTimes > 4) {
|
|
35774
35804
|
await this.stopSoundRecord();
|
|
35775
|
-
if (((
|
|
35805
|
+
if (((_d = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _d.detectNoise) && !this.isSpeech) {
|
|
35776
35806
|
this.onRealtimeAlertsCallback({
|
|
35807
|
+
begin: Date.now() - (((_e3 = this.cameraRecorder.getStartTime()) == null ? void 0 : _e3.getTime()) || 0),
|
|
35808
|
+
end: Date.now() - (((_f = this.cameraRecorder.getStartTime()) == null ? void 0 : _f.getTime()) || 0),
|
|
35777
35809
|
status: "ALERT",
|
|
35778
35810
|
description: "Barulho detectado",
|
|
35779
35811
|
type: "audio_detection_on_stream"
|
|
35780
35812
|
});
|
|
35781
35813
|
}
|
|
35782
|
-
if (((
|
|
35814
|
+
if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectSpeech) && this.isSpeech) {
|
|
35783
35815
|
this.onRealtimeAlertsCallback({
|
|
35816
|
+
begin: Date.now() - (((_h = this.cameraRecorder.getStartTime()) == null ? void 0 : _h.getTime()) || 0),
|
|
35817
|
+
end: Date.now() - (((_i3 = this.cameraRecorder.getStartTime()) == null ? void 0 : _i3.getTime()) || 0),
|
|
35784
35818
|
status: "ALERT",
|
|
35785
35819
|
description: "Fala detectada",
|
|
35786
35820
|
type: "audio_detection_on_stream"
|
|
@@ -35795,8 +35829,9 @@ var NoiseRecorder = class {
|
|
|
35795
35829
|
}
|
|
35796
35830
|
}
|
|
35797
35831
|
async stopSoundRecord() {
|
|
35832
|
+
var _a2;
|
|
35798
35833
|
if (!this.recordingInProgress && this.recordingChunks.length === 0) return;
|
|
35799
|
-
this.recordingEndTime = Date.now() - this.
|
|
35834
|
+
this.recordingEndTime = Date.now() - (((_a2 = this.cameraRecorder.getStartTime()) == null ? void 0 : _a2.getTime()) || 0);
|
|
35800
35835
|
if (this.optionsProctoring.proctoringType !== "REALTIME") return;
|
|
35801
35836
|
const wavBlob = encodeToWav(this.recordingChunks, this.SAMPLE_RATE);
|
|
35802
35837
|
const file = new File(
|
|
@@ -36026,6 +36061,7 @@ var ScreenRecorder = class {
|
|
|
36026
36061
|
this.recordingStop && await this.recordingStop();
|
|
36027
36062
|
}
|
|
36028
36063
|
async saveOnSession(session) {
|
|
36064
|
+
if (isMobileDevice()) return;
|
|
36029
36065
|
session.addRecording({
|
|
36030
36066
|
device: "",
|
|
36031
36067
|
file: new File(this.blobs, `EP_${session.id}_screen_0.webm`, {
|
|
@@ -36235,7 +36271,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36235
36271
|
this.connection = null;
|
|
36236
36272
|
this.context = context;
|
|
36237
36273
|
this.onRealtimeAlertsCallback = onRealtimeAlertsCallback;
|
|
36238
|
-
console.log("context -> ", context);
|
|
36239
36274
|
this.backend = new BackendService({
|
|
36240
36275
|
type: (context == null ? void 0 : context.type) || "prod",
|
|
36241
36276
|
token: context.token
|
|
@@ -36249,7 +36284,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36249
36284
|
try {
|
|
36250
36285
|
this.transmissionOk = false;
|
|
36251
36286
|
const response = await this.backend.externalCameraCheckTransmission("" + this.externalSessionId);
|
|
36252
|
-
console.log(response);
|
|
36253
36287
|
let attempts = 0;
|
|
36254
36288
|
while (!this.transmissionOk && attempts <= 5) {
|
|
36255
36289
|
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
@@ -36266,16 +36300,13 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36266
36300
|
try {
|
|
36267
36301
|
this.proctoringId = proctoringId2;
|
|
36268
36302
|
const response = await this.backend.externalCameraStartTransmission("" + this.externalSessionId, proctoringId2);
|
|
36269
|
-
console.log(response);
|
|
36270
36303
|
} catch (error) {
|
|
36271
|
-
console.error("Erro ao iniciar transmiss\xE3o:", error);
|
|
36272
36304
|
throw new Error("N\xE3o foi poss\xEDvel iniciar a transmiss\xE3o.");
|
|
36273
36305
|
}
|
|
36274
36306
|
}
|
|
36275
36307
|
async goToPositionGuide() {
|
|
36276
36308
|
try {
|
|
36277
36309
|
const response = await this.backend.goToExternalCameraPositionStep("" + this.externalSessionId);
|
|
36278
|
-
console.log(response);
|
|
36279
36310
|
} catch (error) {
|
|
36280
36311
|
console.error("Erro ao enviar comando de Position:", error);
|
|
36281
36312
|
throw new Error("N\xE3o foi poss\xEDvel enviar comando de Position Guide.");
|
|
@@ -36285,7 +36316,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36285
36316
|
if (this.connection) {
|
|
36286
36317
|
const actionMessage = new ActionMessage();
|
|
36287
36318
|
actionMessage.command = "Reset";
|
|
36288
|
-
console.log("Enviando comando 'Reset' para o aplicativo...");
|
|
36289
36319
|
this.connection.invoke(
|
|
36290
36320
|
"SendAction",
|
|
36291
36321
|
this.externalSessionId,
|
|
@@ -36299,7 +36329,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36299
36329
|
this.onTakePictureCallback = onTakePictureCallback;
|
|
36300
36330
|
const actionMessage = new ActionMessage();
|
|
36301
36331
|
actionMessage.command = "Capture";
|
|
36302
|
-
console.log("Enviando comando 'Capture' para o aplicativo...");
|
|
36303
36332
|
this.connection.invoke(
|
|
36304
36333
|
"SendAction",
|
|
36305
36334
|
this.externalSessionId,
|
|
@@ -36318,7 +36347,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36318
36347
|
await this.reset();
|
|
36319
36348
|
const response = await this.backend.externalCameraStartSession();
|
|
36320
36349
|
this.externalSessionId = response.externalSessionId;
|
|
36321
|
-
console.log(this.externalSessionId);
|
|
36322
36350
|
this.currentStep = 0 /* STARTED */;
|
|
36323
36351
|
const pairingObject = {
|
|
36324
36352
|
externalSessionId: this.externalSessionId,
|
|
@@ -36327,7 +36355,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36327
36355
|
};
|
|
36328
36356
|
const pairingDataString = JSON.stringify(pairingObject);
|
|
36329
36357
|
this.qrCodeBase64Image = await import_qrcode.default.toDataURL(pairingDataString);
|
|
36330
|
-
console.log(this.qrCodeBase64Image);
|
|
36331
36358
|
return this.qrCodeBase64Image;
|
|
36332
36359
|
} catch (error) {
|
|
36333
36360
|
this.disconnectWebSocket();
|
|
@@ -36426,7 +36453,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36426
36453
|
var _a2;
|
|
36427
36454
|
const actionMessage = new ActionMessage();
|
|
36428
36455
|
actionMessage.command = "Cancel";
|
|
36429
|
-
console.log("Enviando comando 'Cancel' para o aplicativo...");
|
|
36430
36456
|
(_a2 = this.connection) == null ? void 0 : _a2.invoke(
|
|
36431
36457
|
"SendAction",
|
|
36432
36458
|
this.externalSessionId,
|
|
@@ -36766,8 +36792,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36766
36792
|
this.connection.on(
|
|
36767
36793
|
"ReceiveMessage",
|
|
36768
36794
|
(sessionId, messageStr) => {
|
|
36769
|
-
console.log("sessionId: ", sessionId);
|
|
36770
|
-
console.log("Message: ", messageStr);
|
|
36771
36795
|
if (sessionId !== this.externalSessionId) {
|
|
36772
36796
|
console.warn("Sess\xE3o diferente!");
|
|
36773
36797
|
return;
|
|
@@ -36775,7 +36799,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36775
36799
|
try {
|
|
36776
36800
|
const messageKey = messageStr;
|
|
36777
36801
|
const message = ExternalCameraStatusEnum[messageKey];
|
|
36778
|
-
console.log("Mensagem -> ", message);
|
|
36779
36802
|
this.handleWebSocketMessage(message);
|
|
36780
36803
|
} catch (e3) {
|
|
36781
36804
|
console.error("Erro ao processar mensagem do WebSocket:", e3);
|
|
@@ -36785,8 +36808,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36785
36808
|
this.connection.on(
|
|
36786
36809
|
"ReceiveAction",
|
|
36787
36810
|
(sessionId, actionMessage) => {
|
|
36788
|
-
console.log("sessionId: ", sessionId);
|
|
36789
|
-
console.log("Message: ", actionMessage);
|
|
36790
36811
|
if (sessionId !== this.externalSessionId) {
|
|
36791
36812
|
console.warn("Sess\xE3o diferente!");
|
|
36792
36813
|
return;
|
|
@@ -36800,7 +36821,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36800
36821
|
);
|
|
36801
36822
|
try {
|
|
36802
36823
|
await this.connection.start();
|
|
36803
|
-
console.log("Conectado ao Hub SignalR com sucesso!");
|
|
36804
36824
|
} catch (err) {
|
|
36805
36825
|
console.error("Falha ao conectar ou entrar no grupo do SignalR: ", err);
|
|
36806
36826
|
throw new Error("N\xE3o foi poss\xEDvel conectar ao servi\xE7o em tempo real.");
|
|
@@ -36927,7 +36947,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36927
36947
|
if (this.connection) {
|
|
36928
36948
|
try {
|
|
36929
36949
|
await this.connection.stop();
|
|
36930
|
-
console.log("Desconectado do SignalR.");
|
|
36931
36950
|
} catch (err) {
|
|
36932
36951
|
console.error("Erro ao desconectar do SignalR:", err);
|
|
36933
36952
|
} finally {
|
|
@@ -37128,7 +37147,6 @@ var Proctoring = class {
|
|
|
37128
37147
|
alertImageBase64: await this.allRecorders.cameraRecorder.getCurrentImageBase64(),
|
|
37129
37148
|
retry: verifyCount < verifyMaxRetries - 1 ? true : false
|
|
37130
37149
|
});
|
|
37131
|
-
console.log("response stopRealtimeAlert", response);
|
|
37132
37150
|
return response;
|
|
37133
37151
|
} catch (error) {
|
|
37134
37152
|
console.log("error stopRealtimeAlert", error);
|
|
@@ -37167,9 +37185,11 @@ var Proctoring = class {
|
|
|
37167
37185
|
setDeviceCheckData(data) {
|
|
37168
37186
|
this.deviceData = data;
|
|
37169
37187
|
}
|
|
37170
|
-
createRecorders(options = getDefaultProctoringOptions) {
|
|
37171
|
-
var _a2, _b;
|
|
37188
|
+
async createRecorders(options = getDefaultProctoringOptions) {
|
|
37189
|
+
var _a2, _b, _c2;
|
|
37172
37190
|
this.onChangeDevices();
|
|
37191
|
+
console.log("Creating recorders");
|
|
37192
|
+
await ((_a2 = this.recorder) == null ? void 0 : _a2.stopAll());
|
|
37173
37193
|
const cameraRecorder = new CameraRecorder(
|
|
37174
37194
|
{
|
|
37175
37195
|
cameraId: this.sessionOptions.cameraId,
|
|
@@ -37191,8 +37211,8 @@ var Proctoring = class {
|
|
|
37191
37211
|
this.context.token
|
|
37192
37212
|
);
|
|
37193
37213
|
const screenRecorder = this.sessionOptions.captureScreen ? new ScreenRecorder({
|
|
37194
|
-
allowOnlyFirstMonitor: (
|
|
37195
|
-
allowMultipleMonitors: (
|
|
37214
|
+
allowOnlyFirstMonitor: (_b = this.sessionOptions.allowOnlyFirstMonitor) != null ? _b : true,
|
|
37215
|
+
allowMultipleMonitors: (_c2 = this.sessionOptions.allowMultipleMonitors) != null ? _c2 : true,
|
|
37196
37216
|
screenRecorderOptions: this.sessionOptions.screenRecorderOptions,
|
|
37197
37217
|
onStopSharingScreenCallback: () => this.onStopSharingScreenCallback(),
|
|
37198
37218
|
onBufferSizeError: this.sessionOptions.onBufferSizeError,
|
|
@@ -37217,10 +37237,12 @@ var Proctoring = class {
|
|
|
37217
37237
|
);
|
|
37218
37238
|
const recorders = [
|
|
37219
37239
|
cameraRecorder,
|
|
37220
|
-
|
|
37240
|
+
noiseRecorder,
|
|
37221
37241
|
alertRecorder
|
|
37222
37242
|
].filter(Boolean);
|
|
37223
|
-
|
|
37243
|
+
if (this.sessionOptions.proctoringType != "REALTIME" && screenRecorder) {
|
|
37244
|
+
recorders.push(screenRecorder);
|
|
37245
|
+
}
|
|
37224
37246
|
this.recorder = new ProctoringRecorder(this.proctoringSession, recorders);
|
|
37225
37247
|
return { cameraRecorder, screenRecorder, alertRecorder, noiseRecorder };
|
|
37226
37248
|
}
|
|
@@ -37260,7 +37282,7 @@ var Proctoring = class {
|
|
|
37260
37282
|
await this.repository.clear();
|
|
37261
37283
|
}
|
|
37262
37284
|
this.proctoringSession = new ProctoringSession();
|
|
37263
|
-
this.allRecorders = this.createRecorders(this.sessionOptions);
|
|
37285
|
+
this.allRecorders = await this.createRecorders(this.sessionOptions);
|
|
37264
37286
|
const startResponse = await this.backend.confirmStart(
|
|
37265
37287
|
{
|
|
37266
37288
|
clientId: this.context.clientId,
|
|
@@ -37287,7 +37309,13 @@ var Proctoring = class {
|
|
|
37287
37309
|
this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
|
|
37288
37310
|
this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
|
|
37289
37311
|
this.proctoringSession.setProctoringId(this.proctoringId);
|
|
37290
|
-
|
|
37312
|
+
try {
|
|
37313
|
+
console.log("Starting recorders");
|
|
37314
|
+
await this.recorder.startAll();
|
|
37315
|
+
} catch (error) {
|
|
37316
|
+
console.log("Starting recorders error:", error);
|
|
37317
|
+
throw error;
|
|
37318
|
+
}
|
|
37291
37319
|
if (options == null ? void 0 : options.useSpyScan) {
|
|
37292
37320
|
this.spyCam.setProctoringId(this.proctoringId);
|
|
37293
37321
|
this.spyCam.startCheckSpyCam((_a2 = this.paramsConfig.spyScanInterval) != null ? _a2 : 5, {
|
|
@@ -37448,7 +37476,6 @@ Upload Services: ${uploaderServices}`,
|
|
|
37448
37476
|
await this.backend.finishAndSendUrls(this.context).then((finishResponse) => {
|
|
37449
37477
|
var _a2, _b, _c2, _d;
|
|
37450
37478
|
trackers.registerFinish(this.proctoringSession.id, true, "");
|
|
37451
|
-
console.log("finishResponse: ", finishResponse);
|
|
37452
37479
|
options.onResultAvailable && options.onResultAvailable((_a2 = finishResponse == null ? void 0 : finishResponse.score) != null ? _a2 : 100, (_b = finishResponse == null ? void 0 : finishResponse.scoreThreshold) != null ? _b : 70, (_c2 = finishResponse == null ? void 0 : finishResponse.approved) != null ? _c2 : true, (_d = finishResponse == null ? void 0 : finishResponse.justification) != null ? _d : "");
|
|
37453
37480
|
}).catch((error) => {
|
|
37454
37481
|
trackers.registerFinish(
|
|
@@ -37577,7 +37604,6 @@ Error: ` + error
|
|
|
37577
37604
|
return {
|
|
37578
37605
|
cameraStream: this.allRecorders.cameraRecorder.cameraStream,
|
|
37579
37606
|
// recorder (pause & resume)
|
|
37580
|
-
// audioStream: this.allRecorders.audioRecorder.audioStream,
|
|
37581
37607
|
_screenStream: (_a2 = this.allRecorders.screenRecorder) == null ? void 0 : _a2.screenStream
|
|
37582
37608
|
};
|
|
37583
37609
|
}
|