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/esm/index.js
CHANGED
|
@@ -8693,7 +8693,6 @@ var BaseDetection = class {
|
|
|
8693
8693
|
}
|
|
8694
8694
|
cameraStream && !this.video.srcObject && (this.video.srcObject = cameraStream);
|
|
8695
8695
|
this.video.play();
|
|
8696
|
-
this.startTime = new Date(Date.now());
|
|
8697
8696
|
const that = this;
|
|
8698
8697
|
(_a2 = this.video) == null ? void 0 : _a2.addEventListener("loadeddata", () => that.predictWebcam());
|
|
8699
8698
|
const style = document.createElement("style");
|
|
@@ -8736,8 +8735,8 @@ var BaseDetection = class {
|
|
|
8736
8735
|
description: this.alertTranslate(description),
|
|
8737
8736
|
type,
|
|
8738
8737
|
category: description,
|
|
8739
|
-
begin:
|
|
8740
|
-
end:
|
|
8738
|
+
begin: 0,
|
|
8739
|
+
end: 0
|
|
8741
8740
|
});
|
|
8742
8741
|
if (this.options.onRealtimeAlertsCallback == null)
|
|
8743
8742
|
this.error && (this.error.innerText = description);
|
|
@@ -8748,8 +8747,8 @@ var BaseDetection = class {
|
|
|
8748
8747
|
description: this.alertTranslate(description),
|
|
8749
8748
|
type,
|
|
8750
8749
|
category: description,
|
|
8751
|
-
begin:
|
|
8752
|
-
end:
|
|
8750
|
+
begin: 0,
|
|
8751
|
+
end: 0
|
|
8753
8752
|
});
|
|
8754
8753
|
this.error && (this.error.innerText = "");
|
|
8755
8754
|
}
|
|
@@ -12209,46 +12208,6 @@ function isMobileDevice() {
|
|
|
12209
12208
|
return /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
|
|
12210
12209
|
}
|
|
12211
12210
|
|
|
12212
|
-
// src/plugins/insights.ts
|
|
12213
|
-
var backendService;
|
|
12214
|
-
var init = (backend) => {
|
|
12215
|
-
backendService = backend;
|
|
12216
|
-
return backendService;
|
|
12217
|
-
};
|
|
12218
|
-
var eventNames = {
|
|
12219
|
-
DEVICES_CHECKED: "devices_checked",
|
|
12220
|
-
START: "start",
|
|
12221
|
-
FINISH: "finish",
|
|
12222
|
-
ERROR: "error",
|
|
12223
|
-
UPLOAD: "upload",
|
|
12224
|
-
UPLOAD_FILE: "upload_file",
|
|
12225
|
-
DOWNLOAD_VIDEO: "download_video",
|
|
12226
|
-
BUFFER_SIZE: "buffer_size",
|
|
12227
|
-
ANOTHER_STREAM: "another_stream",
|
|
12228
|
-
CHANGE_DEVICE: "change_device",
|
|
12229
|
-
STOP_SHARING_SCREEN: "stop_sharing_screen",
|
|
12230
|
-
ERROR_RECORDER_RTC: "error_recorder_rtc",
|
|
12231
|
-
BROWSER_NOT_SUPPORTED: "browser_not_supported",
|
|
12232
|
-
SAVE_ON_SESSION: "save_on_session"
|
|
12233
|
-
};
|
|
12234
|
-
var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
|
|
12235
|
-
var trackers = {
|
|
12236
|
-
registerDevicesChecked: (proctoringId2, success, description) => log(eventNames.DEVICES_CHECKED, { proctoringId: proctoringId2, success, description }),
|
|
12237
|
-
registerStart: (proctoringId2, success, description) => log(eventNames.START, { proctoringId: proctoringId2, success, description }),
|
|
12238
|
-
registerFinish: (proctoringId2, success, description) => log(eventNames.FINISH, { proctoringId: proctoringId2, success, description }),
|
|
12239
|
-
registerError: (proctoringId2, description) => log(eventNames.ERROR, { proctoringId: proctoringId2, description }),
|
|
12240
|
-
registerBrowserNotSupported: (proctoringId2, description) => log(eventNames.BROWSER_NOT_SUPPORTED, { proctoringId: proctoringId2, description }),
|
|
12241
|
-
registerUpload: (proctoringId2, success, description, serviceType, uploadTime) => log(eventNames.UPLOAD, { proctoringId: proctoringId2, success, description, serviceType, uploadTime }),
|
|
12242
|
-
registerUploadFile: (proctoringId2, description, fileType) => log(eventNames.UPLOAD_FILE, { proctoringId: proctoringId2, description, fileType }),
|
|
12243
|
-
registerChangeDevice: (proctoringId2, inOrOut, description) => log(eventNames.CHANGE_DEVICE, { proctoringId: proctoringId2, inOrOut, description }),
|
|
12244
|
-
registerStopSharingScreen: (proctoringId2, description) => log(eventNames.STOP_SHARING_SCREEN, { proctoringId: proctoringId2, description }),
|
|
12245
|
-
registerErrorRecorderRTC: (proctoringId2, description) => log(eventNames.ERROR_RECORDER_RTC, { proctoringId: proctoringId2, description }),
|
|
12246
|
-
registerDownloadFile: (proctoringId2, description) => log(eventNames.DOWNLOAD_VIDEO, { proctoringId: proctoringId2, description }),
|
|
12247
|
-
registerOnBufferSizeError: (proctoringId2, description) => log(eventNames.BUFFER_SIZE, { proctoringId: proctoringId2, description }),
|
|
12248
|
-
registerAnotherStream: (proctoringId2, description) => log(eventNames.ANOTHER_STREAM, { proctoringId: proctoringId2, description }),
|
|
12249
|
-
registerSaveOnSession: (proctoringId2, description) => log(eventNames.SAVE_ON_SESSION, { proctoringId: proctoringId2, description })
|
|
12250
|
-
};
|
|
12251
|
-
|
|
12252
12211
|
// src/plugins/recorder.ts
|
|
12253
12212
|
var proctoringId;
|
|
12254
12213
|
function setRecorderProctoringId(id) {
|
|
@@ -12261,6 +12220,7 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
|
|
|
12261
12220
|
let lastEvent;
|
|
12262
12221
|
let bufferSize;
|
|
12263
12222
|
bufferSize = 0;
|
|
12223
|
+
let startTime;
|
|
12264
12224
|
let recorderOptions = {
|
|
12265
12225
|
// eslint-disable-next-line no-useless-escape
|
|
12266
12226
|
mimeType: "video/webm",
|
|
@@ -12280,59 +12240,102 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
|
|
|
12280
12240
|
audioBitsPerSecond: 64 * 1e3
|
|
12281
12241
|
};
|
|
12282
12242
|
}
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
|
|
12289
|
-
if (
|
|
12290
|
-
|
|
12291
|
-
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
);
|
|
12299
|
-
onBufferSizeErrorCallback && onBufferSizeErrorCallback();
|
|
12243
|
+
function buildMediaRecorder(stream2, recorderOptions2) {
|
|
12244
|
+
const tracks = stream2.getTracks();
|
|
12245
|
+
if (tracks.length == 0) {
|
|
12246
|
+
throw new Error("No tracks found");
|
|
12247
|
+
}
|
|
12248
|
+
const invalidTracks = tracks.find((t3) => t3.readyState != "live");
|
|
12249
|
+
if (invalidTracks) {
|
|
12250
|
+
throw new Error("Track not live: " + invalidTracks.label);
|
|
12251
|
+
}
|
|
12252
|
+
console.log("buildMediaRecorder tracks OK");
|
|
12253
|
+
let mediaRecorder2 = new MediaRecorder(stream2, recorderOptions2);
|
|
12254
|
+
console.log("buildMediaRecorder mediaRecorder OK");
|
|
12255
|
+
mediaRecorder2.ondataavailable = (e3) => {
|
|
12256
|
+
bufferSize = bufferSize + e3.data.size;
|
|
12257
|
+
if (e3.data.size > 0) {
|
|
12258
|
+
buffer.push(e3.data);
|
|
12300
12259
|
}
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
if (audio && mediaRecorder.state == "inactive") {
|
|
12304
|
-
const blob = new Blob(buffer, { type: "audio/webm" });
|
|
12305
|
-
buffer = [blob];
|
|
12260
|
+
if (stopped) {
|
|
12261
|
+
resolvePromise && resolvePromise();
|
|
12306
12262
|
}
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
}
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12263
|
+
};
|
|
12264
|
+
return mediaRecorder2;
|
|
12265
|
+
}
|
|
12266
|
+
let mediaRecorder = buildMediaRecorder(stream, recorderOptions);
|
|
12267
|
+
async function startRecorder(recorder2) {
|
|
12268
|
+
return new Promise((resolve, reject) => {
|
|
12269
|
+
var _a2, _b;
|
|
12270
|
+
let started = false;
|
|
12271
|
+
recorder2.onstart = () => {
|
|
12272
|
+
started = true;
|
|
12273
|
+
console.log("recorder onstart");
|
|
12274
|
+
resolve();
|
|
12275
|
+
};
|
|
12276
|
+
recorder2.onerror = (ev) => {
|
|
12277
|
+
console.error("Recorder error event:", ev);
|
|
12278
|
+
stream.getTracks().forEach((t3) => console.log(t3.readyState));
|
|
12279
|
+
if ("error" in ev) {
|
|
12280
|
+
const err = ev.error;
|
|
12281
|
+
console.error("Error name:", err == null ? void 0 : err.name);
|
|
12282
|
+
console.error("Error message:", err == null ? void 0 : err.message);
|
|
12283
|
+
reject(err || ev);
|
|
12284
|
+
} else {
|
|
12285
|
+
console.warn("Evento sem propriedade error");
|
|
12286
|
+
reject(ev);
|
|
12287
|
+
}
|
|
12288
|
+
};
|
|
12289
|
+
try {
|
|
12290
|
+
console.log("State antes do start:", recorder2.state);
|
|
12291
|
+
recorder2.start(1e4);
|
|
12292
|
+
startTime = new Date(Date.now());
|
|
12293
|
+
} catch (e3) {
|
|
12294
|
+
console.error("Recorder erro ao chamar start event:", e3);
|
|
12295
|
+
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);
|
|
12296
|
+
console.error("Erro real 2:", e3, e3 == null ? void 0 : e3.message, e3 == null ? void 0 : e3.name);
|
|
12297
|
+
stream.getTracks().forEach((t3) => console.log(t3.readyState));
|
|
12298
|
+
return reject(e3);
|
|
12320
12299
|
}
|
|
12300
|
+
setTimeout(() => {
|
|
12301
|
+
if (!started) {
|
|
12302
|
+
console.error("Timeout ao iniciar o recorder");
|
|
12303
|
+
reject(new Error("Timeout ao iniciar o recorder"));
|
|
12304
|
+
}
|
|
12305
|
+
}, 2e3);
|
|
12321
12306
|
});
|
|
12322
12307
|
}
|
|
12308
|
+
async function startRecording() {
|
|
12309
|
+
try {
|
|
12310
|
+
await startRecorder(mediaRecorder);
|
|
12311
|
+
if (mediaRecorder.state === "recording") {
|
|
12312
|
+
bufferSize = 0;
|
|
12313
|
+
stopped = false;
|
|
12314
|
+
return;
|
|
12315
|
+
} else {
|
|
12316
|
+
console.log("Recorder n\xE3o est\xE1 em estado recording ap\xF3s start");
|
|
12317
|
+
}
|
|
12318
|
+
} catch (e3) {
|
|
12319
|
+
console.error("Erro ao iniciar o recorder:", e3);
|
|
12320
|
+
await new Promise((r3) => setTimeout(r3, 300));
|
|
12321
|
+
throw e3;
|
|
12322
|
+
}
|
|
12323
|
+
return;
|
|
12324
|
+
}
|
|
12323
12325
|
function stopRecording() {
|
|
12324
12326
|
return new Promise((resolve) => {
|
|
12325
12327
|
if (mediaRecorder.state == "recording") {
|
|
12328
|
+
console.log("stopRecording Recorder est\xE1 em estado recording, iniciando stop");
|
|
12326
12329
|
resolvePromise = resolve;
|
|
12327
|
-
mediaRecorder.stop();
|
|
12328
12330
|
stopped = true;
|
|
12329
|
-
|
|
12330
|
-
stream.getTracks().forEach((el) => {
|
|
12331
|
-
el.stop();
|
|
12332
|
-
});
|
|
12331
|
+
mediaRecorder.stop();
|
|
12333
12332
|
} else {
|
|
12333
|
+
console.log("stopRecording Recorder n\xE3o est\xE1 em estado recording");
|
|
12334
12334
|
resolve();
|
|
12335
12335
|
}
|
|
12336
|
+
stream.getTracks().forEach((el) => {
|
|
12337
|
+
el.stop();
|
|
12338
|
+
});
|
|
12336
12339
|
});
|
|
12337
12340
|
}
|
|
12338
12341
|
function pauseRecording() {
|
|
@@ -12358,16 +12361,60 @@ function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCa
|
|
|
12358
12361
|
function getBufferSize() {
|
|
12359
12362
|
return bufferSize;
|
|
12360
12363
|
}
|
|
12364
|
+
function getStartTime() {
|
|
12365
|
+
return startTime;
|
|
12366
|
+
}
|
|
12361
12367
|
return {
|
|
12362
12368
|
startRecording,
|
|
12363
12369
|
stopRecording,
|
|
12364
12370
|
pauseRecording,
|
|
12365
12371
|
resumeRecording,
|
|
12366
12372
|
recorderOptions,
|
|
12367
|
-
getBufferSize
|
|
12373
|
+
getBufferSize,
|
|
12374
|
+
getStartTime
|
|
12368
12375
|
};
|
|
12369
12376
|
}
|
|
12370
12377
|
|
|
12378
|
+
// src/plugins/insights.ts
|
|
12379
|
+
var backendService;
|
|
12380
|
+
var init = (backend) => {
|
|
12381
|
+
backendService = backend;
|
|
12382
|
+
return backendService;
|
|
12383
|
+
};
|
|
12384
|
+
var eventNames = {
|
|
12385
|
+
DEVICES_CHECKED: "devices_checked",
|
|
12386
|
+
START: "start",
|
|
12387
|
+
FINISH: "finish",
|
|
12388
|
+
ERROR: "error",
|
|
12389
|
+
UPLOAD: "upload",
|
|
12390
|
+
UPLOAD_FILE: "upload_file",
|
|
12391
|
+
DOWNLOAD_VIDEO: "download_video",
|
|
12392
|
+
BUFFER_SIZE: "buffer_size",
|
|
12393
|
+
ANOTHER_STREAM: "another_stream",
|
|
12394
|
+
CHANGE_DEVICE: "change_device",
|
|
12395
|
+
STOP_SHARING_SCREEN: "stop_sharing_screen",
|
|
12396
|
+
ERROR_RECORDER_RTC: "error_recorder_rtc",
|
|
12397
|
+
BROWSER_NOT_SUPPORTED: "browser_not_supported",
|
|
12398
|
+
SAVE_ON_SESSION: "save_on_session"
|
|
12399
|
+
};
|
|
12400
|
+
var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
|
|
12401
|
+
var trackers = {
|
|
12402
|
+
registerDevicesChecked: (proctoringId2, success, description) => log(eventNames.DEVICES_CHECKED, { proctoringId: proctoringId2, success, description }),
|
|
12403
|
+
registerStart: (proctoringId2, success, description) => log(eventNames.START, { proctoringId: proctoringId2, success, description }),
|
|
12404
|
+
registerFinish: (proctoringId2, success, description) => log(eventNames.FINISH, { proctoringId: proctoringId2, success, description }),
|
|
12405
|
+
registerError: (proctoringId2, description) => log(eventNames.ERROR, { proctoringId: proctoringId2, description }),
|
|
12406
|
+
registerBrowserNotSupported: (proctoringId2, description) => log(eventNames.BROWSER_NOT_SUPPORTED, { proctoringId: proctoringId2, description }),
|
|
12407
|
+
registerUpload: (proctoringId2, success, description, serviceType, uploadTime) => log(eventNames.UPLOAD, { proctoringId: proctoringId2, success, description, serviceType, uploadTime }),
|
|
12408
|
+
registerUploadFile: (proctoringId2, description, fileType) => log(eventNames.UPLOAD_FILE, { proctoringId: proctoringId2, description, fileType }),
|
|
12409
|
+
registerChangeDevice: (proctoringId2, inOrOut, description) => log(eventNames.CHANGE_DEVICE, { proctoringId: proctoringId2, inOrOut, description }),
|
|
12410
|
+
registerStopSharingScreen: (proctoringId2, description) => log(eventNames.STOP_SHARING_SCREEN, { proctoringId: proctoringId2, description }),
|
|
12411
|
+
registerErrorRecorderRTC: (proctoringId2, description) => log(eventNames.ERROR_RECORDER_RTC, { proctoringId: proctoringId2, description }),
|
|
12412
|
+
registerDownloadFile: (proctoringId2, description) => log(eventNames.DOWNLOAD_VIDEO, { proctoringId: proctoringId2, description }),
|
|
12413
|
+
registerOnBufferSizeError: (proctoringId2, description) => log(eventNames.BUFFER_SIZE, { proctoringId: proctoringId2, description }),
|
|
12414
|
+
registerAnotherStream: (proctoringId2, description) => log(eventNames.ANOTHER_STREAM, { proctoringId: proctoringId2, description }),
|
|
12415
|
+
registerSaveOnSession: (proctoringId2, description) => log(eventNames.SAVE_ON_SESSION, { proctoringId: proctoringId2, description })
|
|
12416
|
+
};
|
|
12417
|
+
|
|
12371
12418
|
// src/new-flow/upload/UploadService.ts
|
|
12372
12419
|
var UploadService = class {
|
|
12373
12420
|
constructor(proctoringId2, backend) {
|
|
@@ -12653,12 +12700,12 @@ var VolumeMeter = class {
|
|
|
12653
12700
|
async start(options = {}) {
|
|
12654
12701
|
return new Promise((resolve, reject) => {
|
|
12655
12702
|
try {
|
|
12656
|
-
|
|
12657
|
-
this.analyser = audioContext.createAnalyser();
|
|
12658
|
-
|
|
12703
|
+
this.audioContext = new AudioContext();
|
|
12704
|
+
this.analyser = this.audioContext.createAnalyser();
|
|
12705
|
+
this.microphone = this.audioContext.createMediaStreamSource(this.stream);
|
|
12659
12706
|
this.analyser.smoothingTimeConstant = 0.8;
|
|
12660
12707
|
this.analyser.fftSize = 1024;
|
|
12661
|
-
microphone.connect(this.analyser);
|
|
12708
|
+
this.microphone.connect(this.analyser);
|
|
12662
12709
|
const processAudio = () => {
|
|
12663
12710
|
const array = new Uint8Array(this.analyser.frequencyBinCount);
|
|
12664
12711
|
this.analyser.getByteFrequencyData(array);
|
|
@@ -12677,9 +12724,13 @@ var VolumeMeter = class {
|
|
|
12677
12724
|
});
|
|
12678
12725
|
}
|
|
12679
12726
|
stop() {
|
|
12727
|
+
var _a2, _b, _c2;
|
|
12680
12728
|
if (this.animationFrameId !== null) {
|
|
12681
12729
|
cancelAnimationFrame(this.animationFrameId);
|
|
12682
12730
|
}
|
|
12731
|
+
(_a2 = this.audioContext) == null ? void 0 : _a2.close();
|
|
12732
|
+
(_b = this.microphone) == null ? void 0 : _b.disconnect();
|
|
12733
|
+
(_c2 = this.analyser) == null ? void 0 : _c2.disconnect();
|
|
12683
12734
|
}
|
|
12684
12735
|
getVolume() {
|
|
12685
12736
|
return this.volume;
|
|
@@ -12740,6 +12791,7 @@ var CameraRecorder = class {
|
|
|
12740
12791
|
this.isCanvasLoopActive = false;
|
|
12741
12792
|
this.hardwareStream = null;
|
|
12742
12793
|
this.internalClonedStream = null;
|
|
12794
|
+
this.videoElement = null;
|
|
12743
12795
|
this.currentRetries = 0;
|
|
12744
12796
|
this.packageCount = 0;
|
|
12745
12797
|
this.noiseWait = 20;
|
|
@@ -12760,7 +12812,12 @@ var CameraRecorder = class {
|
|
|
12760
12812
|
if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone)) {
|
|
12761
12813
|
this.objectDetection = new ObjectDetection(
|
|
12762
12814
|
{
|
|
12763
|
-
onRealtimeAlertsCallback: (response) =>
|
|
12815
|
+
onRealtimeAlertsCallback: (response) => {
|
|
12816
|
+
var _a3, _b2;
|
|
12817
|
+
response.begin = Date.now() - (((_a3 = this.getStartTime()) == null ? void 0 : _a3.getTime()) || 0);
|
|
12818
|
+
response.end = Date.now() - (((_b2 = this.getStartTime()) == null ? void 0 : _b2.getTime()) || 0);
|
|
12819
|
+
this.options.onRealtimeAlertsCallback(response);
|
|
12820
|
+
}
|
|
12764
12821
|
},
|
|
12765
12822
|
this.paramsConfig
|
|
12766
12823
|
);
|
|
@@ -12769,7 +12826,12 @@ var CameraRecorder = class {
|
|
|
12769
12826
|
if ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace) {
|
|
12770
12827
|
this.faceDetection = new FaceDetection(
|
|
12771
12828
|
{
|
|
12772
|
-
onRealtimeAlertsCallback: (response) =>
|
|
12829
|
+
onRealtimeAlertsCallback: (response) => {
|
|
12830
|
+
var _a3, _b2;
|
|
12831
|
+
response.begin = Date.now() - (((_a3 = this.getStartTime()) == null ? void 0 : _a3.getTime()) || 0);
|
|
12832
|
+
response.end = Date.now() - (((_b2 = this.getStartTime()) == null ? void 0 : _b2.getTime()) || 0);
|
|
12833
|
+
this.options.onRealtimeAlertsCallback(response);
|
|
12834
|
+
}
|
|
12773
12835
|
},
|
|
12774
12836
|
this.paramsConfig
|
|
12775
12837
|
);
|
|
@@ -12777,35 +12839,38 @@ var CameraRecorder = class {
|
|
|
12777
12839
|
}
|
|
12778
12840
|
}
|
|
12779
12841
|
configImageCapture() {
|
|
12842
|
+
var _a2;
|
|
12780
12843
|
this.video = document.createElement("video");
|
|
12781
12844
|
this.canvas = document.createElement("canvas");
|
|
12782
12845
|
this.video.srcObject = this.cameraStream;
|
|
12783
12846
|
this.video.play();
|
|
12784
12847
|
this.video.muted = true;
|
|
12785
|
-
|
|
12786
|
-
|
|
12848
|
+
const isPortrait = (_a2 = screen.orientation) == null ? void 0 : _a2.type.includes("portrait");
|
|
12849
|
+
if (isPortrait && isMobileDevice()) {
|
|
12850
|
+
console.log("configurando canvas em portrait");
|
|
12851
|
+
this.canvas.width = this.videoOptions.height / 2;
|
|
12852
|
+
this.canvas.height = this.videoOptions.width / 2;
|
|
12853
|
+
} else {
|
|
12854
|
+
this.canvas.width = this.videoOptions.width / 2;
|
|
12855
|
+
this.canvas.height = this.videoOptions.height / 2;
|
|
12856
|
+
}
|
|
12787
12857
|
}
|
|
12788
12858
|
async bufferError(e3) {
|
|
12789
12859
|
var _a2, _b;
|
|
12790
|
-
console.log("buffer error Camera Recorder params "
|
|
12860
|
+
console.log("buffer error Camera Recorder params ");
|
|
12791
12861
|
const retryEnabled = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.retryEnabled) || false;
|
|
12792
12862
|
const maxRetries = ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.maxRetries) || 3;
|
|
12793
12863
|
if (retryEnabled && this.currentRetries < maxRetries) {
|
|
12794
12864
|
await this.recordingStop();
|
|
12795
|
-
await this.startRecording(
|
|
12796
|
-
retry: true
|
|
12797
|
-
});
|
|
12865
|
+
await this.startRecording();
|
|
12798
12866
|
this.currentRetries++;
|
|
12799
12867
|
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback(this.cameraStream);
|
|
12800
12868
|
} else {
|
|
12801
12869
|
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback();
|
|
12802
12870
|
}
|
|
12803
12871
|
}
|
|
12804
|
-
async
|
|
12805
|
-
var _a2
|
|
12806
|
-
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)) {
|
|
12807
|
-
await this.initializeDetectors();
|
|
12808
|
-
}
|
|
12872
|
+
async startStream() {
|
|
12873
|
+
var _a2;
|
|
12809
12874
|
const { cameraId, microphoneId, onBufferSizeErrorCallback } = this.options;
|
|
12810
12875
|
const constraints = {
|
|
12811
12876
|
audio: { deviceId: microphoneId },
|
|
@@ -12829,13 +12894,81 @@ var CameraRecorder = class {
|
|
|
12829
12894
|
const track = this.cameraStream.getVideoTracks()[0];
|
|
12830
12895
|
const settings = track.getSettings();
|
|
12831
12896
|
let { width = 0, height = 0 } = settings;
|
|
12897
|
+
const isPortrait = (_a2 = screen.orientation) == null ? void 0 : _a2.type.includes("portrait");
|
|
12898
|
+
if (isPortrait && isMobileDevice()) {
|
|
12899
|
+
if (this.videoOptions.width == height && this.videoOptions.height == width) {
|
|
12900
|
+
[width, height] = [height, width];
|
|
12901
|
+
}
|
|
12902
|
+
}
|
|
12903
|
+
if (this.videoOptions.minWidth > width || this.videoOptions.minHeight > height) {
|
|
12904
|
+
throw STREAM_UNDER_MINIMUM_PERMITTED;
|
|
12905
|
+
} else if (this.videoOptions.width !== width || this.videoOptions.height !== height) {
|
|
12906
|
+
trackers.registerAnotherStream(
|
|
12907
|
+
this.proctoringId,
|
|
12908
|
+
`Maybe have another stream active
|
|
12909
|
+
Video Options: ${JSON.stringify(
|
|
12910
|
+
this.videoOptions,
|
|
12911
|
+
null,
|
|
12912
|
+
2
|
|
12913
|
+
)}
|
|
12914
|
+
Setting: ${JSON.stringify(settings, null, 2)}`
|
|
12915
|
+
);
|
|
12916
|
+
throw ANOTHER_STREAM_ACTIVE;
|
|
12917
|
+
}
|
|
12918
|
+
}
|
|
12919
|
+
async stopStream() {
|
|
12920
|
+
if (this.cameraStream) {
|
|
12921
|
+
this.cameraStream.getTracks().forEach((track) => track.stop());
|
|
12922
|
+
}
|
|
12923
|
+
if (this.internalClonedStream) {
|
|
12924
|
+
this.internalClonedStream.getTracks().forEach((track) => track.stop());
|
|
12925
|
+
this.internalClonedStream = null;
|
|
12926
|
+
}
|
|
12927
|
+
if (this.hardwareStream) {
|
|
12928
|
+
this.hardwareStream.getTracks().forEach((track) => track.stop());
|
|
12929
|
+
this.hardwareStream = null;
|
|
12930
|
+
}
|
|
12931
|
+
}
|
|
12932
|
+
async waitForVideoFlow() {
|
|
12933
|
+
return new Promise((resolve) => {
|
|
12934
|
+
const check = () => {
|
|
12935
|
+
var _a2;
|
|
12936
|
+
if (this.videoElement && ((_a2 = this.videoElement) == null ? void 0 : _a2.readyState) >= 3) return resolve();
|
|
12937
|
+
else requestAnimationFrame(check);
|
|
12938
|
+
};
|
|
12939
|
+
check();
|
|
12940
|
+
});
|
|
12941
|
+
}
|
|
12942
|
+
async attachAndWarmup(stream) {
|
|
12943
|
+
this.videoElement = document.createElement("video");
|
|
12944
|
+
this.videoElement.srcObject = stream;
|
|
12945
|
+
this.videoElement.muted = true;
|
|
12946
|
+
await this.videoElement.play().catch((e3) => {
|
|
12947
|
+
});
|
|
12948
|
+
await new Promise((resolve) => {
|
|
12949
|
+
var _a2;
|
|
12950
|
+
if (this.videoElement && ((_a2 = this.videoElement) == null ? void 0 : _a2.readyState) >= 1) return resolve();
|
|
12951
|
+
if (this.videoElement)
|
|
12952
|
+
this.videoElement.onloadedmetadata = () => resolve();
|
|
12953
|
+
});
|
|
12954
|
+
console.log("CameraRecorder checking metadata ok");
|
|
12955
|
+
await this.waitForVideoFlow();
|
|
12956
|
+
console.log("CameraRecorder waiting for video flow ok");
|
|
12957
|
+
await new Promise((r3) => setTimeout(r3, 300));
|
|
12958
|
+
}
|
|
12959
|
+
async startRecording() {
|
|
12960
|
+
var _a2, _b, _c2, _d, _e3, _f, _g;
|
|
12961
|
+
console.log("CameraRecorder startRecording");
|
|
12962
|
+
await this.startStream();
|
|
12963
|
+
await this.attachAndWarmup(this.cameraStream);
|
|
12832
12964
|
const {
|
|
12833
12965
|
startRecording,
|
|
12834
12966
|
stopRecording,
|
|
12835
12967
|
pauseRecording,
|
|
12836
12968
|
resumeRecording,
|
|
12837
12969
|
recorderOptions,
|
|
12838
|
-
getBufferSize
|
|
12970
|
+
getBufferSize,
|
|
12971
|
+
getStartTime
|
|
12839
12972
|
} = recorder(
|
|
12840
12973
|
this.cameraStream,
|
|
12841
12974
|
// streamToRecord,
|
|
@@ -12850,42 +12983,41 @@ var CameraRecorder = class {
|
|
|
12850
12983
|
this.recordingResume = resumeRecording;
|
|
12851
12984
|
this.recorderOptions = recorderOptions;
|
|
12852
12985
|
this.getBufferSize = getBufferSize;
|
|
12853
|
-
this.
|
|
12854
|
-
|
|
12855
|
-
|
|
12856
|
-
|
|
12857
|
-
|
|
12986
|
+
this.getStartTime = getStartTime;
|
|
12987
|
+
try {
|
|
12988
|
+
await new Promise((r3) => setTimeout(r3, 500));
|
|
12989
|
+
await this.recordingStart();
|
|
12990
|
+
} catch (error) {
|
|
12991
|
+
console.log("Camera Recorder error", error);
|
|
12992
|
+
this.stopRecording();
|
|
12993
|
+
const maxRetries = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.maxRetries) || 3;
|
|
12994
|
+
if (this.currentRetries < maxRetries) {
|
|
12995
|
+
console.log("Camera Recorder retry", this.currentRetries);
|
|
12996
|
+
this.currentRetries++;
|
|
12997
|
+
await this.startRecording();
|
|
12998
|
+
} else {
|
|
12999
|
+
throw error;
|
|
12858
13000
|
}
|
|
12859
13001
|
}
|
|
12860
|
-
if (this.
|
|
12861
|
-
|
|
12862
|
-
} else if (this.videoOptions.width !== width || this.videoOptions.height !== height) {
|
|
12863
|
-
trackers.registerAnotherStream(
|
|
12864
|
-
this.proctoringId,
|
|
12865
|
-
`Maybe have another stream active
|
|
12866
|
-
Video Options: ${JSON.stringify(
|
|
12867
|
-
this.videoOptions,
|
|
12868
|
-
null,
|
|
12869
|
-
2
|
|
12870
|
-
)}
|
|
12871
|
-
Setting: ${JSON.stringify(settings, null, 2)}`
|
|
12872
|
-
);
|
|
12873
|
-
throw ANOTHER_STREAM_ACTIVE;
|
|
13002
|
+
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)) {
|
|
13003
|
+
await this.initializeDetectors();
|
|
12874
13004
|
}
|
|
12875
|
-
((_e3 = this.paramsConfig.
|
|
12876
|
-
if ((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectFace) {
|
|
13005
|
+
if ((_e3 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _e3.detectFace) {
|
|
12877
13006
|
await this.faceDetection.enableCam(this.cameraStream);
|
|
12878
13007
|
}
|
|
12879
|
-
if (((
|
|
13008
|
+
if (((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectPerson) || ((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectCellPhone)) {
|
|
12880
13009
|
await this.objectDetection.enableCam(this.cameraStream);
|
|
12881
13010
|
}
|
|
12882
13011
|
this.filesToUpload = [];
|
|
12883
13012
|
if (this.options.proctoringType == "REALTIME") {
|
|
12884
|
-
this.
|
|
13013
|
+
await this.startRealtimeCapture();
|
|
12885
13014
|
}
|
|
12886
13015
|
this.packageCount = 0;
|
|
13016
|
+
console.log("Camera Recorder started OK");
|
|
12887
13017
|
}
|
|
12888
13018
|
async stopRecording() {
|
|
13019
|
+
var _a2, _b, _c2;
|
|
13020
|
+
console.log("Camera Recorder stopRecording");
|
|
12889
13021
|
this.isCanvasLoopActive = false;
|
|
12890
13022
|
this.recordingStop && await this.recordingStop();
|
|
12891
13023
|
try {
|
|
@@ -12904,6 +13036,16 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
12904
13036
|
this.hardwareStream.getTracks().forEach((track) => track.stop());
|
|
12905
13037
|
this.hardwareStream = null;
|
|
12906
13038
|
}
|
|
13039
|
+
if (this.videoElement) {
|
|
13040
|
+
(_a2 = this.videoElement) == null ? void 0 : _a2.remove();
|
|
13041
|
+
this.videoElement = null;
|
|
13042
|
+
}
|
|
13043
|
+
if (this.video) {
|
|
13044
|
+
(_b = this.video) == null ? void 0 : _b.remove();
|
|
13045
|
+
}
|
|
13046
|
+
if (this.canvas) {
|
|
13047
|
+
(_c2 = this.canvas) == null ? void 0 : _c2.remove();
|
|
13048
|
+
}
|
|
12907
13049
|
} catch (e3) {
|
|
12908
13050
|
console.error("Erro ao parar os streams de m\xEDdia.");
|
|
12909
13051
|
}
|
|
@@ -12924,35 +13066,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
12924
13066
|
async resumeRecording() {
|
|
12925
13067
|
await this.recordingResume();
|
|
12926
13068
|
}
|
|
12927
|
-
photoShotsCycle() {
|
|
12928
|
-
let imageFile;
|
|
12929
|
-
this.configImageCapture();
|
|
12930
|
-
this.imageInterval = setInterval(async () => {
|
|
12931
|
-
this.canvas.getContext("2d").drawImage(
|
|
12932
|
-
this.video,
|
|
12933
|
-
0,
|
|
12934
|
-
0,
|
|
12935
|
-
this.videoOptions.width,
|
|
12936
|
-
this.videoOptions.height
|
|
12937
|
-
);
|
|
12938
|
-
const image_data_url = this.canvas.toDataURL("image/jpeg");
|
|
12939
|
-
imageFile = await this.getFile(
|
|
12940
|
-
image_data_url,
|
|
12941
|
-
`${this.proctoringId}_${this.imageCount + 1}.jpg`,
|
|
12942
|
-
"image/jpeg"
|
|
12943
|
-
);
|
|
12944
|
-
if (imageFile && this.upload && this.backendToken) {
|
|
12945
|
-
this.upload.upload(
|
|
12946
|
-
{
|
|
12947
|
-
file: imageFile
|
|
12948
|
-
},
|
|
12949
|
-
this.backendToken,
|
|
12950
|
-
true
|
|
12951
|
-
);
|
|
12952
|
-
this.imageCount++;
|
|
12953
|
-
}
|
|
12954
|
-
}, this.paramsConfig.imageBehaviourParameters.uploadInterval * 1e3);
|
|
12955
|
-
}
|
|
12956
13069
|
async getCurrentImageBase64() {
|
|
12957
13070
|
if (!this.video || !this.canvas) {
|
|
12958
13071
|
this.configImageCapture();
|
|
@@ -12983,37 +13096,35 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
12983
13096
|
this.canvas.getContext("2d").drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
|
|
12984
13097
|
return this.canvas.toDataURL("image/jpeg");
|
|
12985
13098
|
}
|
|
12986
|
-
|
|
12987
|
-
|
|
12988
|
-
var _a2, _b;
|
|
13099
|
+
async captureFrame() {
|
|
13100
|
+
var _a2;
|
|
12989
13101
|
let imageFile;
|
|
12990
|
-
this.configImageCapture();
|
|
12991
|
-
let newCanvasWidth = this.videoOptions.width / 2;
|
|
12992
|
-
let newCanvasHeight = this.videoOptions.height / 2;
|
|
12993
|
-
if (newCanvasWidth < 320) newCanvasWidth = 320;
|
|
12994
|
-
if (newCanvasHeight < 180) newCanvasHeight = 180;
|
|
12995
|
-
this.canvas.width = newCanvasWidth;
|
|
12996
|
-
this.canvas.height = newCanvasHeight;
|
|
12997
13102
|
const packSize = (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimePackageSize;
|
|
13103
|
+
this.canvas.getContext("2d").drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
|
|
13104
|
+
const image_data_url = this.canvas.toDataURL("image/jpeg");
|
|
13105
|
+
if (this.proctoringId == void 0) return;
|
|
13106
|
+
if (packSize == this.imageCount) {
|
|
13107
|
+
this.imageCount = 0;
|
|
13108
|
+
const framesToSend = [...this.filesToUpload];
|
|
13109
|
+
this.sendPackage(framesToSend);
|
|
13110
|
+
await this.filesToUpload.splice(0, this.filesToUpload.length);
|
|
13111
|
+
}
|
|
13112
|
+
let imageName = `${this.proctoringId}_${this.imageCount + 1}.jpg`;
|
|
13113
|
+
imageFile = await this.getFile(image_data_url, imageName, "image/jpeg");
|
|
13114
|
+
if (imageFile && imageFile.size > 10 && packSize > 0) {
|
|
13115
|
+
this.filesToUpload.push(imageFile);
|
|
13116
|
+
this.imageCount++;
|
|
13117
|
+
}
|
|
13118
|
+
}
|
|
13119
|
+
// inicia a captura de um frame a cada intervalo de tempo definido no paramsConfig.videoBehaviourParameters?.realtimeCaptureInterval!
|
|
13120
|
+
async startRealtimeCapture() {
|
|
13121
|
+
var _a2;
|
|
13122
|
+
this.configImageCapture();
|
|
12998
13123
|
this.imageCount = 0;
|
|
13124
|
+
await this.captureFrame();
|
|
12999
13125
|
this.imageInterval = setInterval(async () => {
|
|
13000
|
-
|
|
13001
|
-
|
|
13002
|
-
const image_data_url = this.canvas.toDataURL("image/jpeg");
|
|
13003
|
-
if (this.proctoringId == void 0) return;
|
|
13004
|
-
if (packSize == this.imageCount) {
|
|
13005
|
-
this.imageCount = 0;
|
|
13006
|
-
const framesToSend = [...this.filesToUpload];
|
|
13007
|
-
this.sendPackage(framesToSend);
|
|
13008
|
-
await this.filesToUpload.splice(0, this.filesToUpload.length);
|
|
13009
|
-
}
|
|
13010
|
-
let imageName = `${this.proctoringId}_${this.imageCount + 1}.jpg`;
|
|
13011
|
-
imageFile = await this.getFile(image_data_url, imageName, "image/jpeg");
|
|
13012
|
-
if (imageFile && imageFile.size > 10 && packSize > 0) {
|
|
13013
|
-
this.filesToUpload.push(imageFile);
|
|
13014
|
-
this.imageCount++;
|
|
13015
|
-
}
|
|
13016
|
-
}, ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.realtimeCaptureInterval) * 1e3);
|
|
13126
|
+
await this.captureFrame();
|
|
13127
|
+
}, ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimeCaptureInterval) * 1e3);
|
|
13017
13128
|
}
|
|
13018
13129
|
// envia pacote de imagens
|
|
13019
13130
|
async sendPackage(framesToSend) {
|
|
@@ -13021,7 +13132,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13021
13132
|
let pending = false;
|
|
13022
13133
|
let undeliveredPackagesCount = 0;
|
|
13023
13134
|
const packSize = (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimePackageSize;
|
|
13024
|
-
const packCaptureInterval = (
|
|
13135
|
+
const packCaptureInterval = (_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.realtimeCaptureInterval;
|
|
13025
13136
|
if (this.upload && this.backendToken && !pending && this.filesToUpload.length > 0) {
|
|
13026
13137
|
undeliveredPackagesCount = 0;
|
|
13027
13138
|
pending = true;
|
|
@@ -13129,45 +13240,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13129
13240
|
}
|
|
13130
13241
|
this.noiseWait++;
|
|
13131
13242
|
}
|
|
13132
|
-
/**
|
|
13133
|
-
* Cria um stream processado onde os frames são rotacionados via Canvas.
|
|
13134
|
-
* Isso corrige o problema de gravação deitada em iOS/Mobile.
|
|
13135
|
-
*/
|
|
13136
|
-
createRotatedStream(originalStream) {
|
|
13137
|
-
this.internalClonedStream = originalStream.clone();
|
|
13138
|
-
const video = document.createElement("video");
|
|
13139
|
-
video.srcObject = this.internalClonedStream;
|
|
13140
|
-
video.muted = true;
|
|
13141
|
-
video.play();
|
|
13142
|
-
const canvas = document.createElement("canvas");
|
|
13143
|
-
const ctx = canvas.getContext("2d");
|
|
13144
|
-
const track = originalStream.getVideoTracks()[0];
|
|
13145
|
-
const settings = track.getSettings();
|
|
13146
|
-
const width = settings.width || 640;
|
|
13147
|
-
const height = settings.height || 480;
|
|
13148
|
-
canvas.width = height;
|
|
13149
|
-
canvas.height = width;
|
|
13150
|
-
const draw = () => {
|
|
13151
|
-
if (video.paused || video.ended) return;
|
|
13152
|
-
if (!this.isCanvasLoopActive) return;
|
|
13153
|
-
if (ctx) {
|
|
13154
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
13155
|
-
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
13156
|
-
}
|
|
13157
|
-
if (this.isCanvasLoopActive) {
|
|
13158
|
-
this.animationFrameId = requestAnimationFrame(draw);
|
|
13159
|
-
}
|
|
13160
|
-
};
|
|
13161
|
-
video.onplaying = () => {
|
|
13162
|
-
this.isCanvasLoopActive = true;
|
|
13163
|
-
draw();
|
|
13164
|
-
};
|
|
13165
|
-
const canvasStream = canvas.captureStream(30);
|
|
13166
|
-
originalStream.getAudioTracks().forEach((track2) => {
|
|
13167
|
-
canvasStream.addTrack(track2);
|
|
13168
|
-
});
|
|
13169
|
-
return canvasStream;
|
|
13170
|
-
}
|
|
13171
13243
|
};
|
|
13172
13244
|
|
|
13173
13245
|
// src/new-flow/checkers/DeviceCheckerUI.ts
|
|
@@ -14248,6 +14320,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
14248
14320
|
return this.deviceCheckResult;
|
|
14249
14321
|
}
|
|
14250
14322
|
async runCheckDevicesFlow(options, _videoOptions, onModalConfirm, onModalCancel, onUpdate) {
|
|
14323
|
+
var _a2;
|
|
14251
14324
|
if (_DeviceCheckerService.isModalOpen) {
|
|
14252
14325
|
return Promise.reject("Modal j\xE1 est\xE1 aberto");
|
|
14253
14326
|
}
|
|
@@ -14265,7 +14338,9 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
14265
14338
|
options,
|
|
14266
14339
|
_videoOptions
|
|
14267
14340
|
);
|
|
14268
|
-
this.
|
|
14341
|
+
if ((_a2 = this.options) == null ? void 0 : _a2.useSpyScan) {
|
|
14342
|
+
await this.checkSpyScan();
|
|
14343
|
+
}
|
|
14269
14344
|
const returnData = { cameraStream: this.cameraRecorder.cameraStream };
|
|
14270
14345
|
this.onUpdateCb = (e3) => onUpdate(e3);
|
|
14271
14346
|
const resultPromise = new Promise(
|
|
@@ -14320,6 +14395,10 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
14320
14395
|
if (_DeviceCheckerService.isModalOpen) {
|
|
14321
14396
|
return Promise.reject();
|
|
14322
14397
|
}
|
|
14398
|
+
this.allowedAmbient = false;
|
|
14399
|
+
this.allowedMicrophone = false;
|
|
14400
|
+
this.allowedAmbient = false;
|
|
14401
|
+
this.allowedPositionFace = false;
|
|
14323
14402
|
_DeviceCheckerService.isModalOpen = true;
|
|
14324
14403
|
this.DeviceCheckerUI = new DeviceCheckerUI(options, _videoOptions);
|
|
14325
14404
|
try {
|
|
@@ -14357,8 +14436,8 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
14357
14436
|
resolve(response);
|
|
14358
14437
|
});
|
|
14359
14438
|
} catch (error) {
|
|
14439
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.closeModal();
|
|
14360
14440
|
this.closeCheckDevices();
|
|
14361
|
-
this.DeviceCheckerUI.closeModal();
|
|
14362
14441
|
return Promise.reject(error);
|
|
14363
14442
|
}
|
|
14364
14443
|
}
|
|
@@ -14429,7 +14508,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
14429
14508
|
}
|
|
14430
14509
|
async changeSelectedDevice({ cameraId, microphoneId }) {
|
|
14431
14510
|
var _a2;
|
|
14432
|
-
this.cameraRecorder.
|
|
14511
|
+
this.cameraRecorder.stopStream && await this.cameraRecorder.stopStream();
|
|
14433
14512
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
14434
14513
|
this.faceDetection.stopDetection();
|
|
14435
14514
|
this.cameraRecorder = new CameraRecorder(
|
|
@@ -14445,7 +14524,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
14445
14524
|
height: this.videoOptions.height
|
|
14446
14525
|
}
|
|
14447
14526
|
);
|
|
14448
|
-
await this.cameraRecorder.
|
|
14527
|
+
await this.cameraRecorder.startStream();
|
|
14449
14528
|
this.videoDeviceInterface(this.cameraRecorder.cameraStream);
|
|
14450
14529
|
this.audioDeviceInterface(this.cameraRecorder.cameraStream);
|
|
14451
14530
|
return {
|
|
@@ -14453,6 +14532,10 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
14453
14532
|
};
|
|
14454
14533
|
}
|
|
14455
14534
|
async startCheckDevices(options = getDefaultProctoringOptions, _videoOptions) {
|
|
14535
|
+
this.allowedAmbient = false;
|
|
14536
|
+
this.allowedMicrophone = false;
|
|
14537
|
+
this.allowedAmbient = false;
|
|
14538
|
+
this.allowedPositionFace = false;
|
|
14456
14539
|
this.DeviceCheckerUI && this.DeviceCheckerUI.setSelectOption(
|
|
14457
14540
|
options,
|
|
14458
14541
|
(e3) => this.changeSelectedDevice(e3)
|
|
@@ -14472,7 +14555,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
14472
14555
|
height: this.videoOptions.height
|
|
14473
14556
|
}
|
|
14474
14557
|
);
|
|
14475
|
-
await this.cameraRecorder.
|
|
14558
|
+
await this.cameraRecorder.startStream();
|
|
14476
14559
|
this.videoDeviceInterface(this.cameraRecorder.cameraStream);
|
|
14477
14560
|
this.audioDeviceInterface(this.cameraRecorder.cameraStream);
|
|
14478
14561
|
if (this.DeviceCheckerUI) {
|
|
@@ -14489,7 +14572,7 @@ var _DeviceCheckerService = class _DeviceCheckerService {
|
|
|
14489
14572
|
this.faceDetection.stopDetection();
|
|
14490
14573
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
14491
14574
|
this.volumeMedia = Math.ceil(this.volumeSum / this.volumeCounter);
|
|
14492
|
-
this.cameraRecorder.
|
|
14575
|
+
this.cameraRecorder.stopStream && await this.cameraRecorder.stopStream();
|
|
14493
14576
|
this.DeviceCheckerUI = void 0;
|
|
14494
14577
|
this.onUpdateCb = void 0;
|
|
14495
14578
|
}
|
|
@@ -14562,7 +14645,7 @@ var CapturePhoto = class {
|
|
|
14562
14645
|
// height: 480,
|
|
14563
14646
|
// }
|
|
14564
14647
|
);
|
|
14565
|
-
await this.cameraRecorder.
|
|
14648
|
+
await this.cameraRecorder.startStream();
|
|
14566
14649
|
cameraContainer.srcObject = this.cameraRecorder.cameraStream;
|
|
14567
14650
|
cameraContainer.play();
|
|
14568
14651
|
}
|
|
@@ -14802,7 +14885,7 @@ var CapturePhoto = class {
|
|
|
14802
14885
|
});
|
|
14803
14886
|
}
|
|
14804
14887
|
async closeInterface() {
|
|
14805
|
-
await this.cameraRecorder.
|
|
14888
|
+
await this.cameraRecorder.stopStream();
|
|
14806
14889
|
const authPhoto = document.querySelector("#authPhoto");
|
|
14807
14890
|
authPhoto == null ? void 0 : authPhoto.remove();
|
|
14808
14891
|
}
|
|
@@ -15306,54 +15389,6 @@ var AlertRecorder = class {
|
|
|
15306
15389
|
}
|
|
15307
15390
|
};
|
|
15308
15391
|
|
|
15309
|
-
// src/new-flow/recorders/AudioRecorder.ts
|
|
15310
|
-
var AudioRecorder = class {
|
|
15311
|
-
constructor(options, audioParams) {
|
|
15312
|
-
this.blobs = [];
|
|
15313
|
-
this.options = {
|
|
15314
|
-
cameraId: void 0,
|
|
15315
|
-
microphoneId: void 0
|
|
15316
|
-
};
|
|
15317
|
-
this.audioParams = {
|
|
15318
|
-
recordingBitrate: 128
|
|
15319
|
-
};
|
|
15320
|
-
audioParams && (this.audioParams = audioParams);
|
|
15321
|
-
options && (this.options = options);
|
|
15322
|
-
}
|
|
15323
|
-
async startRecording() {
|
|
15324
|
-
const constraints = {
|
|
15325
|
-
audio: { deviceId: this.options.microphoneId || "default" }
|
|
15326
|
-
};
|
|
15327
|
-
this.audioStream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
15328
|
-
const { startRecording, stopRecording, pauseRecording, resumeRecording } = recorder(this.audioStream, this.blobs, void 0, void 0, true);
|
|
15329
|
-
this.recordingStart = startRecording;
|
|
15330
|
-
this.recordingStop = stopRecording;
|
|
15331
|
-
this.recordingPause = pauseRecording;
|
|
15332
|
-
this.recordingResume = resumeRecording;
|
|
15333
|
-
this.recordingStart();
|
|
15334
|
-
}
|
|
15335
|
-
async pauseRecording() {
|
|
15336
|
-
}
|
|
15337
|
-
async resumeRecording() {
|
|
15338
|
-
}
|
|
15339
|
-
async stopRecording() {
|
|
15340
|
-
this.recordingStop && await this.recordingStop();
|
|
15341
|
-
}
|
|
15342
|
-
async saveOnSession(session, start, end) {
|
|
15343
|
-
session.addRecording({
|
|
15344
|
-
device: "",
|
|
15345
|
-
file: new File(
|
|
15346
|
-
this.blobs,
|
|
15347
|
-
`EP_${session.id}_audio_${start && end && `${start}_${end}` || "0"}.webm`,
|
|
15348
|
-
{
|
|
15349
|
-
type: "audio/webm"
|
|
15350
|
-
}
|
|
15351
|
-
),
|
|
15352
|
-
origin: "Mic" /* Mic */
|
|
15353
|
-
});
|
|
15354
|
-
}
|
|
15355
|
-
};
|
|
15356
|
-
|
|
15357
15392
|
// node_modules/@mediapipe/tasks-audio/audio_bundle.mjs
|
|
15358
15393
|
var t2 = "undefined" != typeof self ? self : {};
|
|
15359
15394
|
function e2() {
|
|
@@ -17593,7 +17628,6 @@ var NoiseRecorder = class {
|
|
|
17593
17628
|
this.recordingInProgress = false;
|
|
17594
17629
|
this.recordIndex = 1;
|
|
17595
17630
|
this.countLoopTimes = 0;
|
|
17596
|
-
this.examStartTime = 0;
|
|
17597
17631
|
this.recordingStartTime = 0;
|
|
17598
17632
|
this.recordingEndTime = 0;
|
|
17599
17633
|
this.isSpeech = false;
|
|
@@ -17620,12 +17654,7 @@ var NoiseRecorder = class {
|
|
|
17620
17654
|
this.proctoringId && this.backend && (this.upload = new UploadService(this.proctoringId, this.backend));
|
|
17621
17655
|
}
|
|
17622
17656
|
async startRecording() {
|
|
17623
|
-
this.examStartTime = Date.now();
|
|
17624
17657
|
await this.createAudioClassifier();
|
|
17625
|
-
this.audioRecorder = new AudioRecorder(
|
|
17626
|
-
void 0,
|
|
17627
|
-
this.paramsConfig.audioBehaviourParameters
|
|
17628
|
-
);
|
|
17629
17658
|
this.intervalNoiseDetection = setInterval(
|
|
17630
17659
|
() => this.onNoiseDetectedRecord(),
|
|
17631
17660
|
200
|
|
@@ -17637,6 +17666,7 @@ var NoiseRecorder = class {
|
|
|
17637
17666
|
await this.stopSoundRecord();
|
|
17638
17667
|
await this.volumeMeter && this.volumeMeter.stop();
|
|
17639
17668
|
this.audioWorkletNode && this.audioWorkletNode.disconnect();
|
|
17669
|
+
this.context && this.context.close();
|
|
17640
17670
|
}
|
|
17641
17671
|
async pauseRecording() {
|
|
17642
17672
|
}
|
|
@@ -17645,7 +17675,7 @@ var NoiseRecorder = class {
|
|
|
17645
17675
|
async saveOnSession(session) {
|
|
17646
17676
|
}
|
|
17647
17677
|
async onNoiseDetectedRecord() {
|
|
17648
|
-
var _a2, _b, _c2, _d;
|
|
17678
|
+
var _a2, _b, _c2, _d, _e3, _f, _g, _h, _i3;
|
|
17649
17679
|
if (!this.volumeMeter && this.cameraRecorder.cameraStream) {
|
|
17650
17680
|
this.volumeMeter = new VolumeMeter(this.cameraRecorder.cameraStream);
|
|
17651
17681
|
this.volumeMeter.start().catch((e3) => {
|
|
@@ -17667,7 +17697,7 @@ var NoiseRecorder = class {
|
|
|
17667
17697
|
this.recordingChunks = [...this.preRollBuffer];
|
|
17668
17698
|
const totalSamplesInBuffer = this.preRollBuffer.reduce((acc, chunk) => acc + chunk.length, 0);
|
|
17669
17699
|
const bufferDurationMs = totalSamplesInBuffer / this.SAMPLE_RATE * 1e3;
|
|
17670
|
-
const triggerTime = Date.now() - this.
|
|
17700
|
+
const triggerTime = Date.now() - (((_c2 = this.cameraRecorder.getStartTime()) == null ? void 0 : _c2.getTime()) || 0);
|
|
17671
17701
|
this.recordingStartTime = triggerTime - bufferDurationMs;
|
|
17672
17702
|
if (this.recordingStartTime < 0) this.recordingStartTime = 0;
|
|
17673
17703
|
} else if (this.recordingInProgress) {
|
|
@@ -17675,15 +17705,19 @@ var NoiseRecorder = class {
|
|
|
17675
17705
|
const currentRecordDuration = Date.now() - this.recordingStartTime;
|
|
17676
17706
|
if (silenceDuration >= this.SILENCE_THRESHOLD && currentRecordDuration >= 3e3 && this.countLoopTimes > 4) {
|
|
17677
17707
|
await this.stopSoundRecord();
|
|
17678
|
-
if (((
|
|
17708
|
+
if (((_d = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _d.detectNoise) && !this.isSpeech) {
|
|
17679
17709
|
this.onRealtimeAlertsCallback({
|
|
17710
|
+
begin: Date.now() - (((_e3 = this.cameraRecorder.getStartTime()) == null ? void 0 : _e3.getTime()) || 0),
|
|
17711
|
+
end: Date.now() - (((_f = this.cameraRecorder.getStartTime()) == null ? void 0 : _f.getTime()) || 0),
|
|
17680
17712
|
status: "ALERT",
|
|
17681
17713
|
description: "Barulho detectado",
|
|
17682
17714
|
type: "audio_detection_on_stream"
|
|
17683
17715
|
});
|
|
17684
17716
|
}
|
|
17685
|
-
if (((
|
|
17717
|
+
if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectSpeech) && this.isSpeech) {
|
|
17686
17718
|
this.onRealtimeAlertsCallback({
|
|
17719
|
+
begin: Date.now() - (((_h = this.cameraRecorder.getStartTime()) == null ? void 0 : _h.getTime()) || 0),
|
|
17720
|
+
end: Date.now() - (((_i3 = this.cameraRecorder.getStartTime()) == null ? void 0 : _i3.getTime()) || 0),
|
|
17687
17721
|
status: "ALERT",
|
|
17688
17722
|
description: "Fala detectada",
|
|
17689
17723
|
type: "audio_detection_on_stream"
|
|
@@ -17698,8 +17732,9 @@ var NoiseRecorder = class {
|
|
|
17698
17732
|
}
|
|
17699
17733
|
}
|
|
17700
17734
|
async stopSoundRecord() {
|
|
17735
|
+
var _a2;
|
|
17701
17736
|
if (!this.recordingInProgress && this.recordingChunks.length === 0) return;
|
|
17702
|
-
this.recordingEndTime = Date.now() - this.
|
|
17737
|
+
this.recordingEndTime = Date.now() - (((_a2 = this.cameraRecorder.getStartTime()) == null ? void 0 : _a2.getTime()) || 0);
|
|
17703
17738
|
if (this.optionsProctoring.proctoringType !== "REALTIME") return;
|
|
17704
17739
|
const wavBlob = encodeToWav(this.recordingChunks, this.SAMPLE_RATE);
|
|
17705
17740
|
const file = new File(
|
|
@@ -17929,6 +17964,7 @@ var ScreenRecorder = class {
|
|
|
17929
17964
|
this.recordingStop && await this.recordingStop();
|
|
17930
17965
|
}
|
|
17931
17966
|
async saveOnSession(session) {
|
|
17967
|
+
if (isMobileDevice()) return;
|
|
17932
17968
|
session.addRecording({
|
|
17933
17969
|
device: "",
|
|
17934
17970
|
file: new File(this.blobs, `EP_${session.id}_screen_0.webm`, {
|
|
@@ -20986,7 +21022,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
20986
21022
|
this.connection = null;
|
|
20987
21023
|
this.context = context;
|
|
20988
21024
|
this.onRealtimeAlertsCallback = onRealtimeAlertsCallback;
|
|
20989
|
-
console.log("context -> ", context);
|
|
20990
21025
|
this.backend = new BackendService({
|
|
20991
21026
|
type: (context == null ? void 0 : context.type) || "prod",
|
|
20992
21027
|
token: context.token
|
|
@@ -21000,7 +21035,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
21000
21035
|
try {
|
|
21001
21036
|
this.transmissionOk = false;
|
|
21002
21037
|
const response = await this.backend.externalCameraCheckTransmission("" + this.externalSessionId);
|
|
21003
|
-
console.log(response);
|
|
21004
21038
|
let attempts = 0;
|
|
21005
21039
|
while (!this.transmissionOk && attempts <= 5) {
|
|
21006
21040
|
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
@@ -21017,16 +21051,13 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
21017
21051
|
try {
|
|
21018
21052
|
this.proctoringId = proctoringId2;
|
|
21019
21053
|
const response = await this.backend.externalCameraStartTransmission("" + this.externalSessionId, proctoringId2);
|
|
21020
|
-
console.log(response);
|
|
21021
21054
|
} catch (error) {
|
|
21022
|
-
console.error("Erro ao iniciar transmiss\xE3o:", error);
|
|
21023
21055
|
throw new Error("N\xE3o foi poss\xEDvel iniciar a transmiss\xE3o.");
|
|
21024
21056
|
}
|
|
21025
21057
|
}
|
|
21026
21058
|
async goToPositionGuide() {
|
|
21027
21059
|
try {
|
|
21028
21060
|
const response = await this.backend.goToExternalCameraPositionStep("" + this.externalSessionId);
|
|
21029
|
-
console.log(response);
|
|
21030
21061
|
} catch (error) {
|
|
21031
21062
|
console.error("Erro ao enviar comando de Position:", error);
|
|
21032
21063
|
throw new Error("N\xE3o foi poss\xEDvel enviar comando de Position Guide.");
|
|
@@ -21036,7 +21067,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
21036
21067
|
if (this.connection) {
|
|
21037
21068
|
const actionMessage = new ActionMessage();
|
|
21038
21069
|
actionMessage.command = "Reset";
|
|
21039
|
-
console.log("Enviando comando 'Reset' para o aplicativo...");
|
|
21040
21070
|
this.connection.invoke(
|
|
21041
21071
|
"SendAction",
|
|
21042
21072
|
this.externalSessionId,
|
|
@@ -21050,7 +21080,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
21050
21080
|
this.onTakePictureCallback = onTakePictureCallback;
|
|
21051
21081
|
const actionMessage = new ActionMessage();
|
|
21052
21082
|
actionMessage.command = "Capture";
|
|
21053
|
-
console.log("Enviando comando 'Capture' para o aplicativo...");
|
|
21054
21083
|
this.connection.invoke(
|
|
21055
21084
|
"SendAction",
|
|
21056
21085
|
this.externalSessionId,
|
|
@@ -21069,7 +21098,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
21069
21098
|
await this.reset();
|
|
21070
21099
|
const response = await this.backend.externalCameraStartSession();
|
|
21071
21100
|
this.externalSessionId = response.externalSessionId;
|
|
21072
|
-
console.log(this.externalSessionId);
|
|
21073
21101
|
this.currentStep = 0 /* STARTED */;
|
|
21074
21102
|
const pairingObject = {
|
|
21075
21103
|
externalSessionId: this.externalSessionId,
|
|
@@ -21078,7 +21106,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
21078
21106
|
};
|
|
21079
21107
|
const pairingDataString = JSON.stringify(pairingObject);
|
|
21080
21108
|
this.qrCodeBase64Image = await import_qrcode.default.toDataURL(pairingDataString);
|
|
21081
|
-
console.log(this.qrCodeBase64Image);
|
|
21082
21109
|
return this.qrCodeBase64Image;
|
|
21083
21110
|
} catch (error) {
|
|
21084
21111
|
this.disconnectWebSocket();
|
|
@@ -21177,7 +21204,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
21177
21204
|
var _a2;
|
|
21178
21205
|
const actionMessage = new ActionMessage();
|
|
21179
21206
|
actionMessage.command = "Cancel";
|
|
21180
|
-
console.log("Enviando comando 'Cancel' para o aplicativo...");
|
|
21181
21207
|
(_a2 = this.connection) == null ? void 0 : _a2.invoke(
|
|
21182
21208
|
"SendAction",
|
|
21183
21209
|
this.externalSessionId,
|
|
@@ -21517,8 +21543,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
21517
21543
|
this.connection.on(
|
|
21518
21544
|
"ReceiveMessage",
|
|
21519
21545
|
(sessionId, messageStr) => {
|
|
21520
|
-
console.log("sessionId: ", sessionId);
|
|
21521
|
-
console.log("Message: ", messageStr);
|
|
21522
21546
|
if (sessionId !== this.externalSessionId) {
|
|
21523
21547
|
console.warn("Sess\xE3o diferente!");
|
|
21524
21548
|
return;
|
|
@@ -21526,7 +21550,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
21526
21550
|
try {
|
|
21527
21551
|
const messageKey = messageStr;
|
|
21528
21552
|
const message = ExternalCameraStatusEnum[messageKey];
|
|
21529
|
-
console.log("Mensagem -> ", message);
|
|
21530
21553
|
this.handleWebSocketMessage(message);
|
|
21531
21554
|
} catch (e3) {
|
|
21532
21555
|
console.error("Erro ao processar mensagem do WebSocket:", e3);
|
|
@@ -21536,8 +21559,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
21536
21559
|
this.connection.on(
|
|
21537
21560
|
"ReceiveAction",
|
|
21538
21561
|
(sessionId, actionMessage) => {
|
|
21539
|
-
console.log("sessionId: ", sessionId);
|
|
21540
|
-
console.log("Message: ", actionMessage);
|
|
21541
21562
|
if (sessionId !== this.externalSessionId) {
|
|
21542
21563
|
console.warn("Sess\xE3o diferente!");
|
|
21543
21564
|
return;
|
|
@@ -21551,7 +21572,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
21551
21572
|
);
|
|
21552
21573
|
try {
|
|
21553
21574
|
await this.connection.start();
|
|
21554
|
-
console.log("Conectado ao Hub SignalR com sucesso!");
|
|
21555
21575
|
} catch (err) {
|
|
21556
21576
|
console.error("Falha ao conectar ou entrar no grupo do SignalR: ", err);
|
|
21557
21577
|
throw new Error("N\xE3o foi poss\xEDvel conectar ao servi\xE7o em tempo real.");
|
|
@@ -21678,7 +21698,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
21678
21698
|
if (this.connection) {
|
|
21679
21699
|
try {
|
|
21680
21700
|
await this.connection.stop();
|
|
21681
|
-
console.log("Desconectado do SignalR.");
|
|
21682
21701
|
} catch (err) {
|
|
21683
21702
|
console.error("Erro ao desconectar do SignalR:", err);
|
|
21684
21703
|
} finally {
|
|
@@ -21879,7 +21898,6 @@ var Proctoring = class {
|
|
|
21879
21898
|
alertImageBase64: await this.allRecorders.cameraRecorder.getCurrentImageBase64(),
|
|
21880
21899
|
retry: verifyCount < verifyMaxRetries - 1 ? true : false
|
|
21881
21900
|
});
|
|
21882
|
-
console.log("response stopRealtimeAlert", response);
|
|
21883
21901
|
return response;
|
|
21884
21902
|
} catch (error) {
|
|
21885
21903
|
console.log("error stopRealtimeAlert", error);
|
|
@@ -21918,9 +21936,11 @@ var Proctoring = class {
|
|
|
21918
21936
|
setDeviceCheckData(data) {
|
|
21919
21937
|
this.deviceData = data;
|
|
21920
21938
|
}
|
|
21921
|
-
createRecorders(options = getDefaultProctoringOptions) {
|
|
21922
|
-
var _a2, _b;
|
|
21939
|
+
async createRecorders(options = getDefaultProctoringOptions) {
|
|
21940
|
+
var _a2, _b, _c2;
|
|
21923
21941
|
this.onChangeDevices();
|
|
21942
|
+
console.log("Creating recorders");
|
|
21943
|
+
await ((_a2 = this.recorder) == null ? void 0 : _a2.stopAll());
|
|
21924
21944
|
const cameraRecorder = new CameraRecorder(
|
|
21925
21945
|
{
|
|
21926
21946
|
cameraId: this.sessionOptions.cameraId,
|
|
@@ -21942,8 +21962,8 @@ var Proctoring = class {
|
|
|
21942
21962
|
this.context.token
|
|
21943
21963
|
);
|
|
21944
21964
|
const screenRecorder = this.sessionOptions.captureScreen ? new ScreenRecorder({
|
|
21945
|
-
allowOnlyFirstMonitor: (
|
|
21946
|
-
allowMultipleMonitors: (
|
|
21965
|
+
allowOnlyFirstMonitor: (_b = this.sessionOptions.allowOnlyFirstMonitor) != null ? _b : true,
|
|
21966
|
+
allowMultipleMonitors: (_c2 = this.sessionOptions.allowMultipleMonitors) != null ? _c2 : true,
|
|
21947
21967
|
screenRecorderOptions: this.sessionOptions.screenRecorderOptions,
|
|
21948
21968
|
onStopSharingScreenCallback: () => this.onStopSharingScreenCallback(),
|
|
21949
21969
|
onBufferSizeError: this.sessionOptions.onBufferSizeError,
|
|
@@ -21968,10 +21988,12 @@ var Proctoring = class {
|
|
|
21968
21988
|
);
|
|
21969
21989
|
const recorders = [
|
|
21970
21990
|
cameraRecorder,
|
|
21971
|
-
|
|
21991
|
+
noiseRecorder,
|
|
21972
21992
|
alertRecorder
|
|
21973
21993
|
].filter(Boolean);
|
|
21974
|
-
|
|
21994
|
+
if (this.sessionOptions.proctoringType != "REALTIME" && screenRecorder) {
|
|
21995
|
+
recorders.push(screenRecorder);
|
|
21996
|
+
}
|
|
21975
21997
|
this.recorder = new ProctoringRecorder(this.proctoringSession, recorders);
|
|
21976
21998
|
return { cameraRecorder, screenRecorder, alertRecorder, noiseRecorder };
|
|
21977
21999
|
}
|
|
@@ -22011,7 +22033,7 @@ var Proctoring = class {
|
|
|
22011
22033
|
await this.repository.clear();
|
|
22012
22034
|
}
|
|
22013
22035
|
this.proctoringSession = new ProctoringSession();
|
|
22014
|
-
this.allRecorders = this.createRecorders(this.sessionOptions);
|
|
22036
|
+
this.allRecorders = await this.createRecorders(this.sessionOptions);
|
|
22015
22037
|
const startResponse = await this.backend.confirmStart(
|
|
22016
22038
|
{
|
|
22017
22039
|
clientId: this.context.clientId,
|
|
@@ -22038,7 +22060,13 @@ var Proctoring = class {
|
|
|
22038
22060
|
this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
|
|
22039
22061
|
this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
|
|
22040
22062
|
this.proctoringSession.setProctoringId(this.proctoringId);
|
|
22041
|
-
|
|
22063
|
+
try {
|
|
22064
|
+
console.log("Starting recorders");
|
|
22065
|
+
await this.recorder.startAll();
|
|
22066
|
+
} catch (error) {
|
|
22067
|
+
console.log("Starting recorders error:", error);
|
|
22068
|
+
throw error;
|
|
22069
|
+
}
|
|
22042
22070
|
if (options == null ? void 0 : options.useSpyScan) {
|
|
22043
22071
|
this.spyCam.setProctoringId(this.proctoringId);
|
|
22044
22072
|
this.spyCam.startCheckSpyCam((_a2 = this.paramsConfig.spyScanInterval) != null ? _a2 : 5, {
|
|
@@ -22199,7 +22227,6 @@ Upload Services: ${uploaderServices}`,
|
|
|
22199
22227
|
await this.backend.finishAndSendUrls(this.context).then((finishResponse) => {
|
|
22200
22228
|
var _a2, _b, _c2, _d;
|
|
22201
22229
|
trackers.registerFinish(this.proctoringSession.id, true, "");
|
|
22202
|
-
console.log("finishResponse: ", finishResponse);
|
|
22203
22230
|
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 : "");
|
|
22204
22231
|
}).catch((error) => {
|
|
22205
22232
|
trackers.registerFinish(
|
|
@@ -22328,7 +22355,6 @@ Error: ` + error
|
|
|
22328
22355
|
return {
|
|
22329
22356
|
cameraStream: this.allRecorders.cameraRecorder.cameraStream,
|
|
22330
22357
|
// recorder (pause & resume)
|
|
22331
|
-
// audioStream: this.allRecorders.audioRecorder.audioStream,
|
|
22332
22358
|
_screenStream: (_a2 = this.allRecorders.screenRecorder) == null ? void 0 : _a2.screenStream
|
|
22333
22359
|
};
|
|
22334
22360
|
}
|