easyproctor-hml 2.5.30 → 2.5.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.js +100 -250
- package/index.js +100 -250
- package/new-flow/recorders/CameraRecorder.d.ts +1 -6
- package/package.json +1 -1
- package/plugins/recorder.d.ts +0 -1
- package/unpkg/easyproctor.min.js +40 -42
package/index.js
CHANGED
|
@@ -30309,46 +30309,6 @@ function isMobileDevice() {
|
|
|
30309
30309
|
return /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
|
|
30310
30310
|
}
|
|
30311
30311
|
|
|
30312
|
-
// src/plugins/insights.ts
|
|
30313
|
-
var backendService;
|
|
30314
|
-
var init = (backend) => {
|
|
30315
|
-
backendService = backend;
|
|
30316
|
-
return backendService;
|
|
30317
|
-
};
|
|
30318
|
-
var eventNames = {
|
|
30319
|
-
DEVICES_CHECKED: "devices_checked",
|
|
30320
|
-
START: "start",
|
|
30321
|
-
FINISH: "finish",
|
|
30322
|
-
ERROR: "error",
|
|
30323
|
-
UPLOAD: "upload",
|
|
30324
|
-
UPLOAD_FILE: "upload_file",
|
|
30325
|
-
DOWNLOAD_VIDEO: "download_video",
|
|
30326
|
-
BUFFER_SIZE: "buffer_size",
|
|
30327
|
-
ANOTHER_STREAM: "another_stream",
|
|
30328
|
-
CHANGE_DEVICE: "change_device",
|
|
30329
|
-
STOP_SHARING_SCREEN: "stop_sharing_screen",
|
|
30330
|
-
ERROR_RECORDER_RTC: "error_recorder_rtc",
|
|
30331
|
-
BROWSER_NOT_SUPPORTED: "browser_not_supported",
|
|
30332
|
-
SAVE_ON_SESSION: "save_on_session"
|
|
30333
|
-
};
|
|
30334
|
-
var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
|
|
30335
|
-
var trackers = {
|
|
30336
|
-
registerDevicesChecked: (proctoringId2, success, description) => log(eventNames.DEVICES_CHECKED, { proctoringId: proctoringId2, success, description }),
|
|
30337
|
-
registerStart: (proctoringId2, success, description) => log(eventNames.START, { proctoringId: proctoringId2, success, description }),
|
|
30338
|
-
registerFinish: (proctoringId2, success, description) => log(eventNames.FINISH, { proctoringId: proctoringId2, success, description }),
|
|
30339
|
-
registerError: (proctoringId2, description) => log(eventNames.ERROR, { proctoringId: proctoringId2, description }),
|
|
30340
|
-
registerBrowserNotSupported: (proctoringId2, description) => log(eventNames.BROWSER_NOT_SUPPORTED, { proctoringId: proctoringId2, description }),
|
|
30341
|
-
registerUpload: (proctoringId2, success, description, serviceType, uploadTime) => log(eventNames.UPLOAD, { proctoringId: proctoringId2, success, description, serviceType, uploadTime }),
|
|
30342
|
-
registerUploadFile: (proctoringId2, description, fileType) => log(eventNames.UPLOAD_FILE, { proctoringId: proctoringId2, description, fileType }),
|
|
30343
|
-
registerChangeDevice: (proctoringId2, inOrOut, description) => log(eventNames.CHANGE_DEVICE, { proctoringId: proctoringId2, inOrOut, description }),
|
|
30344
|
-
registerStopSharingScreen: (proctoringId2, description) => log(eventNames.STOP_SHARING_SCREEN, { proctoringId: proctoringId2, description }),
|
|
30345
|
-
registerErrorRecorderRTC: (proctoringId2, description) => log(eventNames.ERROR_RECORDER_RTC, { proctoringId: proctoringId2, description }),
|
|
30346
|
-
registerDownloadFile: (proctoringId2, description) => log(eventNames.DOWNLOAD_VIDEO, { proctoringId: proctoringId2, description }),
|
|
30347
|
-
registerOnBufferSizeError: (proctoringId2, description) => log(eventNames.BUFFER_SIZE, { proctoringId: proctoringId2, description }),
|
|
30348
|
-
registerAnotherStream: (proctoringId2, description) => log(eventNames.ANOTHER_STREAM, { proctoringId: proctoringId2, description }),
|
|
30349
|
-
registerSaveOnSession: (proctoringId2, description) => log(eventNames.SAVE_ON_SESSION, { proctoringId: proctoringId2, description })
|
|
30350
|
-
};
|
|
30351
|
-
|
|
30352
30312
|
// src/plugins/recorder.ts
|
|
30353
30313
|
var proctoringId;
|
|
30354
30314
|
function setRecorderProctoringId(id) {
|
|
@@ -30410,21 +30370,7 @@ function recorder(stream4, buffer, videoOptions, onBufferSizeError = false, onBu
|
|
|
30410
30370
|
if (e2.data.size > 0) {
|
|
30411
30371
|
buffer.push(e2.data);
|
|
30412
30372
|
}
|
|
30413
|
-
if (
|
|
30414
|
-
if (lastEvent && e2.data.size === lastEvent.data.size || e2.data.size === 0) {
|
|
30415
|
-
proctoringId && lastEvent && e2.data.size === lastEvent.data.size && trackers.registerOnBufferSizeError(
|
|
30416
|
-
proctoringId,
|
|
30417
|
-
`onBufferSizeError: Recorder size freezed: ${e2.data.size} Mb`
|
|
30418
|
-
);
|
|
30419
|
-
proctoringId && e2.data.size === 0 && trackers.registerOnBufferSizeError(
|
|
30420
|
-
proctoringId,
|
|
30421
|
-
`onBufferSizeError: Recorder size equal 0 Mb`
|
|
30422
|
-
);
|
|
30423
|
-
console.log("onbuffer size error" + e2.data.size);
|
|
30424
|
-
onBufferSizeErrorCallback && onBufferSizeErrorCallback();
|
|
30425
|
-
}
|
|
30426
|
-
lastEvent = e2;
|
|
30427
|
-
} else {
|
|
30373
|
+
if (stopped) {
|
|
30428
30374
|
resolvePromise && resolvePromise();
|
|
30429
30375
|
}
|
|
30430
30376
|
};
|
|
@@ -30433,92 +30379,76 @@ function recorder(stream4, buffer, videoOptions, onBufferSizeError = false, onBu
|
|
|
30433
30379
|
let mediaRecorder = buildMediaRecorder(stream4, recorderOptions);
|
|
30434
30380
|
async function startRecorder(recorder2) {
|
|
30435
30381
|
return new Promise((resolve, reject) => {
|
|
30382
|
+
var _a2, _b;
|
|
30436
30383
|
let started = false;
|
|
30437
30384
|
recorder2.onstart = () => {
|
|
30438
30385
|
started = true;
|
|
30386
|
+
console.log("recorder onstart");
|
|
30439
30387
|
resolve();
|
|
30440
30388
|
};
|
|
30441
|
-
recorder2.onerror = (
|
|
30442
|
-
|
|
30389
|
+
recorder2.onerror = (ev) => {
|
|
30390
|
+
console.error("Recorder error event:", ev);
|
|
30391
|
+
stream4.getTracks().forEach((t2) => console.log(t2.readyState));
|
|
30392
|
+
if ("error" in ev) {
|
|
30393
|
+
const err = ev.error;
|
|
30394
|
+
console.error("Error name:", err == null ? void 0 : err.name);
|
|
30395
|
+
console.error("Error message:", err == null ? void 0 : err.message);
|
|
30396
|
+
reject(err || ev);
|
|
30397
|
+
} else {
|
|
30398
|
+
console.warn("Evento sem propriedade error");
|
|
30399
|
+
reject(ev);
|
|
30400
|
+
}
|
|
30443
30401
|
};
|
|
30444
30402
|
try {
|
|
30403
|
+
console.log("State antes do start:", recorder2.state);
|
|
30404
|
+
console.log("MimeType:", recorder2.mimeType);
|
|
30445
30405
|
recorder2.start(1e4);
|
|
30446
30406
|
} catch (e2) {
|
|
30407
|
+
console.error("Recorder erro ao chamar start event:", e2);
|
|
30408
|
+
console.error("Erro real:", e2, e2 == null ? void 0 : e2.error, (_a2 = e2 == null ? void 0 : e2.error) == null ? void 0 : _a2.name, (_b = e2 == null ? void 0 : e2.error) == null ? void 0 : _b.message);
|
|
30409
|
+
console.error("Erro real 2:", e2, e2 == null ? void 0 : e2.message, e2 == null ? void 0 : e2.name);
|
|
30410
|
+
stream4.getTracks().forEach((t2) => console.log(t2.readyState));
|
|
30447
30411
|
return reject(e2);
|
|
30448
30412
|
}
|
|
30449
30413
|
setTimeout(() => {
|
|
30450
30414
|
if (!started) {
|
|
30415
|
+
console.error("Timeout ao iniciar o recorder");
|
|
30451
30416
|
reject(new Error("Timeout ao iniciar o recorder"));
|
|
30452
30417
|
}
|
|
30453
|
-
},
|
|
30418
|
+
}, 2e3);
|
|
30454
30419
|
});
|
|
30455
30420
|
}
|
|
30456
|
-
async function
|
|
30457
|
-
|
|
30458
|
-
|
|
30459
|
-
|
|
30460
|
-
|
|
30461
|
-
|
|
30462
|
-
|
|
30463
|
-
|
|
30464
|
-
|
|
30465
|
-
}
|
|
30466
|
-
} catch (e2) {
|
|
30467
|
-
console.error("Erro ao iniciar o recorder:", e2);
|
|
30421
|
+
async function startRecording() {
|
|
30422
|
+
try {
|
|
30423
|
+
await startRecorder(mediaRecorder);
|
|
30424
|
+
if (mediaRecorder.state === "recording") {
|
|
30425
|
+
bufferSize = 0;
|
|
30426
|
+
stopped = false;
|
|
30427
|
+
return;
|
|
30428
|
+
} else {
|
|
30429
|
+
console.log("Recorder n\xE3o est\xE1 em estado recording ap\xF3s start");
|
|
30468
30430
|
}
|
|
30431
|
+
} catch (e2) {
|
|
30432
|
+
console.error("Erro ao iniciar o recorder:", e2);
|
|
30469
30433
|
await new Promise((r2) => setTimeout(r2, 300));
|
|
30470
|
-
|
|
30434
|
+
throw e2;
|
|
30471
30435
|
}
|
|
30472
|
-
throw new Error("Falha ao iniciar o recorder");
|
|
30473
|
-
}
|
|
30474
|
-
async function startRecording() {
|
|
30475
|
-
await startWithRetry(mediaRecorder);
|
|
30476
30436
|
return;
|
|
30477
|
-
return new Promise((resolve, reject) => {
|
|
30478
|
-
var timeSlice = 1e4;
|
|
30479
|
-
if ((videoOptions == null ? void 0 : videoOptions.timeSlice) != void 0) {
|
|
30480
|
-
timeSlice = videoOptions == null ? void 0 : videoOptions.timeSlice;
|
|
30481
|
-
}
|
|
30482
|
-
console.log("startRecording", timeSlice);
|
|
30483
|
-
try {
|
|
30484
|
-
mediaRecorder.onstart = () => {
|
|
30485
|
-
console.log("Grava\xE7\xE3o iniciada com sucesso!");
|
|
30486
|
-
resolve();
|
|
30487
|
-
};
|
|
30488
|
-
mediaRecorder.onerror = (e2) => {
|
|
30489
|
-
console.error("Erro no MediaRecorder:", e2);
|
|
30490
|
-
reject(e2);
|
|
30491
|
-
};
|
|
30492
|
-
console.log("mediaRecorder.state", mediaRecorder.state);
|
|
30493
|
-
console.log(stream4.active);
|
|
30494
|
-
console.log(stream4.getTracks().map((t2) => t2.readyState));
|
|
30495
|
-
mediaRecorder.start(timeSlice);
|
|
30496
|
-
} catch (e2) {
|
|
30497
|
-
console.error("Falha ao iniciar:", e2);
|
|
30498
|
-
reject(e2);
|
|
30499
|
-
}
|
|
30500
|
-
bufferSize = 0;
|
|
30501
|
-
stopped = false;
|
|
30502
|
-
setTimeout(async () => {
|
|
30503
|
-
if (mediaRecorder.state == "recording") return;
|
|
30504
|
-
+console.log("onstart Timeout");
|
|
30505
|
-
reject(new Error("onstart Timeout"));
|
|
30506
|
-
}, 2e3);
|
|
30507
|
-
});
|
|
30508
30437
|
}
|
|
30509
30438
|
function stopRecording() {
|
|
30510
30439
|
return new Promise((resolve) => {
|
|
30511
30440
|
if (mediaRecorder.state == "recording") {
|
|
30441
|
+
console.log("stopRecording Recorder est\xE1 em estado recording, iniciando stop");
|
|
30512
30442
|
resolvePromise = resolve;
|
|
30513
|
-
mediaRecorder.requestData();
|
|
30514
|
-
mediaRecorder.stop();
|
|
30515
30443
|
stopped = true;
|
|
30516
|
-
|
|
30517
|
-
el.stop();
|
|
30518
|
-
});
|
|
30444
|
+
mediaRecorder.stop();
|
|
30519
30445
|
} else {
|
|
30446
|
+
console.log("stopRecording Recorder n\xE3o est\xE1 em estado recording");
|
|
30520
30447
|
resolve();
|
|
30521
30448
|
}
|
|
30449
|
+
stream4.getTracks().forEach((el) => {
|
|
30450
|
+
el.stop();
|
|
30451
|
+
});
|
|
30522
30452
|
});
|
|
30523
30453
|
}
|
|
30524
30454
|
function pauseRecording() {
|
|
@@ -30546,7 +30476,6 @@ function recorder(stream4, buffer, videoOptions, onBufferSizeError = false, onBu
|
|
|
30546
30476
|
}
|
|
30547
30477
|
return {
|
|
30548
30478
|
startRecording,
|
|
30549
|
-
startWithRetry,
|
|
30550
30479
|
stopRecording,
|
|
30551
30480
|
pauseRecording,
|
|
30552
30481
|
resumeRecording,
|
|
@@ -30555,6 +30484,46 @@ function recorder(stream4, buffer, videoOptions, onBufferSizeError = false, onBu
|
|
|
30555
30484
|
};
|
|
30556
30485
|
}
|
|
30557
30486
|
|
|
30487
|
+
// src/plugins/insights.ts
|
|
30488
|
+
var backendService;
|
|
30489
|
+
var init = (backend) => {
|
|
30490
|
+
backendService = backend;
|
|
30491
|
+
return backendService;
|
|
30492
|
+
};
|
|
30493
|
+
var eventNames = {
|
|
30494
|
+
DEVICES_CHECKED: "devices_checked",
|
|
30495
|
+
START: "start",
|
|
30496
|
+
FINISH: "finish",
|
|
30497
|
+
ERROR: "error",
|
|
30498
|
+
UPLOAD: "upload",
|
|
30499
|
+
UPLOAD_FILE: "upload_file",
|
|
30500
|
+
DOWNLOAD_VIDEO: "download_video",
|
|
30501
|
+
BUFFER_SIZE: "buffer_size",
|
|
30502
|
+
ANOTHER_STREAM: "another_stream",
|
|
30503
|
+
CHANGE_DEVICE: "change_device",
|
|
30504
|
+
STOP_SHARING_SCREEN: "stop_sharing_screen",
|
|
30505
|
+
ERROR_RECORDER_RTC: "error_recorder_rtc",
|
|
30506
|
+
BROWSER_NOT_SUPPORTED: "browser_not_supported",
|
|
30507
|
+
SAVE_ON_SESSION: "save_on_session"
|
|
30508
|
+
};
|
|
30509
|
+
var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
|
|
30510
|
+
var trackers = {
|
|
30511
|
+
registerDevicesChecked: (proctoringId2, success, description) => log(eventNames.DEVICES_CHECKED, { proctoringId: proctoringId2, success, description }),
|
|
30512
|
+
registerStart: (proctoringId2, success, description) => log(eventNames.START, { proctoringId: proctoringId2, success, description }),
|
|
30513
|
+
registerFinish: (proctoringId2, success, description) => log(eventNames.FINISH, { proctoringId: proctoringId2, success, description }),
|
|
30514
|
+
registerError: (proctoringId2, description) => log(eventNames.ERROR, { proctoringId: proctoringId2, description }),
|
|
30515
|
+
registerBrowserNotSupported: (proctoringId2, description) => log(eventNames.BROWSER_NOT_SUPPORTED, { proctoringId: proctoringId2, description }),
|
|
30516
|
+
registerUpload: (proctoringId2, success, description, serviceType, uploadTime) => log(eventNames.UPLOAD, { proctoringId: proctoringId2, success, description, serviceType, uploadTime }),
|
|
30517
|
+
registerUploadFile: (proctoringId2, description, fileType) => log(eventNames.UPLOAD_FILE, { proctoringId: proctoringId2, description, fileType }),
|
|
30518
|
+
registerChangeDevice: (proctoringId2, inOrOut, description) => log(eventNames.CHANGE_DEVICE, { proctoringId: proctoringId2, inOrOut, description }),
|
|
30519
|
+
registerStopSharingScreen: (proctoringId2, description) => log(eventNames.STOP_SHARING_SCREEN, { proctoringId: proctoringId2, description }),
|
|
30520
|
+
registerErrorRecorderRTC: (proctoringId2, description) => log(eventNames.ERROR_RECORDER_RTC, { proctoringId: proctoringId2, description }),
|
|
30521
|
+
registerDownloadFile: (proctoringId2, description) => log(eventNames.DOWNLOAD_VIDEO, { proctoringId: proctoringId2, description }),
|
|
30522
|
+
registerOnBufferSizeError: (proctoringId2, description) => log(eventNames.BUFFER_SIZE, { proctoringId: proctoringId2, description }),
|
|
30523
|
+
registerAnotherStream: (proctoringId2, description) => log(eventNames.ANOTHER_STREAM, { proctoringId: proctoringId2, description }),
|
|
30524
|
+
registerSaveOnSession: (proctoringId2, description) => log(eventNames.SAVE_ON_SESSION, { proctoringId: proctoringId2, description })
|
|
30525
|
+
};
|
|
30526
|
+
|
|
30558
30527
|
// src/new-flow/upload/UploadService.ts
|
|
30559
30528
|
var UploadService = class {
|
|
30560
30529
|
constructor(proctoringId2, backend) {
|
|
@@ -30967,15 +30936,13 @@ var CameraRecorder = class {
|
|
|
30967
30936
|
}
|
|
30968
30937
|
async bufferError(e2) {
|
|
30969
30938
|
var _a2, _b;
|
|
30970
|
-
console.log("buffer error Camera Recorder
|
|
30939
|
+
console.log("buffer error Camera Recorder error", e2);
|
|
30971
30940
|
const retryEnabled = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.retryEnabled) || false;
|
|
30972
30941
|
const maxRetries = ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.maxRetries) || 3;
|
|
30973
30942
|
if (retryEnabled && this.currentRetries < maxRetries) {
|
|
30974
30943
|
console.log("buffer error Camera Recorder retry");
|
|
30975
30944
|
await this.recordingStop();
|
|
30976
|
-
await this.startRecording(
|
|
30977
|
-
retry: true
|
|
30978
|
-
});
|
|
30945
|
+
await this.startRecording();
|
|
30979
30946
|
this.currentRetries++;
|
|
30980
30947
|
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback(this.cameraStream);
|
|
30981
30948
|
} else {
|
|
@@ -31070,34 +31037,10 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31070
31037
|
console.log("waitForVideoFlow ok");
|
|
31071
31038
|
await new Promise((r2) => setTimeout(r2, 300));
|
|
31072
31039
|
}
|
|
31073
|
-
async startRecording(
|
|
31074
|
-
var _a2, _b, _c2, _d, _e2, _f, _g;
|
|
31040
|
+
async startRecording() {
|
|
31041
|
+
var _a2, _b, _c2, _d, _e2, _f, _g, _h;
|
|
31075
31042
|
console.log("startRecording Camera Recorder");
|
|
31076
|
-
|
|
31077
|
-
console.log("startRecording Camera Recorder initializeDetectors");
|
|
31078
|
-
await this.initializeDetectors();
|
|
31079
|
-
}
|
|
31080
|
-
const { cameraId, microphoneId } = this.options;
|
|
31081
|
-
const constraints = {
|
|
31082
|
-
audio: { deviceId: microphoneId },
|
|
31083
|
-
video: {
|
|
31084
|
-
deviceId: cameraId,
|
|
31085
|
-
width: this.videoOptions.width,
|
|
31086
|
-
height: this.videoOptions.height,
|
|
31087
|
-
frameRate: 15
|
|
31088
|
-
}
|
|
31089
|
-
};
|
|
31090
|
-
try {
|
|
31091
|
-
this.hardwareStream = await navigator.mediaDevices.getUserMedia(
|
|
31092
|
-
constraints
|
|
31093
|
-
);
|
|
31094
|
-
this.cameraStream = this.hardwareStream;
|
|
31095
|
-
} catch (error) {
|
|
31096
|
-
console.log("startRecording Camera Recorder error", error);
|
|
31097
|
-
if (error.toString() == "NotReadableError: Could not start video source")
|
|
31098
|
-
throw "N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa";
|
|
31099
|
-
throw error;
|
|
31100
|
-
}
|
|
31043
|
+
await this.startStream();
|
|
31101
31044
|
await this.attachAndWarmup(this.cameraStream);
|
|
31102
31045
|
const {
|
|
31103
31046
|
startRecording,
|
|
@@ -31126,118 +31069,24 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31126
31069
|
await this.recordingStart();
|
|
31127
31070
|
} catch (error) {
|
|
31128
31071
|
console.log("startRecording Camera Recorder error", error);
|
|
31129
|
-
|
|
31130
|
-
|
|
31131
|
-
|
|
31132
|
-
|
|
31133
|
-
|
|
31134
|
-
|
|
31135
|
-
|
|
31136
|
-
|
|
31137
|
-
[width, height] = [height, width];
|
|
31072
|
+
this.stopRecording();
|
|
31073
|
+
const maxRetries = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.maxRetries) || 3;
|
|
31074
|
+
if (this.currentRetries < maxRetries) {
|
|
31075
|
+
console.log("buffer error Camera Recorder retry", this.currentRetries);
|
|
31076
|
+
this.currentRetries++;
|
|
31077
|
+
await this.startRecording();
|
|
31078
|
+
} else {
|
|
31079
|
+
throw error;
|
|
31138
31080
|
}
|
|
31139
31081
|
}
|
|
31140
|
-
if (this.
|
|
31141
|
-
throw STREAM_UNDER_MINIMUM_PERMITTED;
|
|
31142
|
-
} else if (this.videoOptions.width !== width || this.videoOptions.height !== height) {
|
|
31143
|
-
trackers.registerAnotherStream(
|
|
31144
|
-
this.proctoringId,
|
|
31145
|
-
`Maybe have another stream active
|
|
31146
|
-
Video Options: ${JSON.stringify(
|
|
31147
|
-
this.videoOptions,
|
|
31148
|
-
null,
|
|
31149
|
-
2
|
|
31150
|
-
)}
|
|
31151
|
-
Setting: ${JSON.stringify(settings, null, 2)}`
|
|
31152
|
-
);
|
|
31153
|
-
throw ANOTHER_STREAM_ACTIVE;
|
|
31154
|
-
}
|
|
31155
|
-
if ((_e2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _e2.detectFace) {
|
|
31156
|
-
await this.faceDetection.enableCam(this.cameraStream);
|
|
31157
|
-
}
|
|
31158
|
-
if (((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectPerson) || ((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectCellPhone)) {
|
|
31159
|
-
await this.objectDetection.enableCam(this.cameraStream);
|
|
31160
|
-
}
|
|
31161
|
-
this.filesToUpload = [];
|
|
31162
|
-
if (this.options.proctoringType == "REALTIME") {
|
|
31163
|
-
this.captureFrame();
|
|
31164
|
-
}
|
|
31165
|
-
this.packageCount = 0;
|
|
31166
|
-
console.log("startRecording Camera Recorder OK");
|
|
31167
|
-
}
|
|
31168
|
-
async startRecordingOld(options) {
|
|
31169
|
-
var _a2, _b, _c2, _d, _e2, _f, _g;
|
|
31170
|
-
console.log("startRecording Camera Recorder");
|
|
31171
|
-
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)) {
|
|
31082
|
+
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)) {
|
|
31172
31083
|
console.log("startRecording Camera Recorder initializeDetectors");
|
|
31173
31084
|
await this.initializeDetectors();
|
|
31174
31085
|
}
|
|
31175
|
-
const { cameraId, microphoneId, onBufferSizeErrorCallback } = this.options;
|
|
31176
|
-
const constraints = {
|
|
31177
|
-
audio: { deviceId: microphoneId },
|
|
31178
|
-
video: {
|
|
31179
|
-
deviceId: cameraId,
|
|
31180
|
-
width: this.videoOptions.width,
|
|
31181
|
-
height: this.videoOptions.height,
|
|
31182
|
-
frameRate: 15
|
|
31183
|
-
}
|
|
31184
|
-
};
|
|
31185
|
-
try {
|
|
31186
|
-
this.hardwareStream = await navigator.mediaDevices.getUserMedia(
|
|
31187
|
-
constraints
|
|
31188
|
-
);
|
|
31189
|
-
} catch (error) {
|
|
31190
|
-
console.log("startRecording Camera Recorder error", error);
|
|
31191
|
-
if (error.toString() == "NotReadableError: Could not start video source")
|
|
31192
|
-
throw "N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa";
|
|
31193
|
-
throw error;
|
|
31194
|
-
}
|
|
31195
|
-
this.cameraStream = this.hardwareStream;
|
|
31196
31086
|
const track = this.cameraStream.getVideoTracks()[0];
|
|
31197
31087
|
const settings = track.getSettings();
|
|
31198
31088
|
let { width = 0, height = 0 } = settings;
|
|
31199
|
-
|
|
31200
|
-
await new Promise((resolve) => {
|
|
31201
|
-
const interval = setInterval(() => {
|
|
31202
|
-
console.log("cameraStream.getVideoTracks()[0].readyState", this.cameraStream.getVideoTracks()[0].readyState);
|
|
31203
|
-
if (this.cameraStream.getVideoTracks()[0].readyState == "live") {
|
|
31204
|
-
clearInterval(interval);
|
|
31205
|
-
resolve();
|
|
31206
|
-
}
|
|
31207
|
-
}, 100);
|
|
31208
|
-
});
|
|
31209
|
-
await new Promise((r2) => setTimeout(r2, 300));
|
|
31210
|
-
const {
|
|
31211
|
-
startRecording,
|
|
31212
|
-
stopRecording,
|
|
31213
|
-
pauseRecording,
|
|
31214
|
-
resumeRecording,
|
|
31215
|
-
recorderOptions,
|
|
31216
|
-
getBufferSize
|
|
31217
|
-
} = recorder(
|
|
31218
|
-
this.cameraStream,
|
|
31219
|
-
// streamToRecord,
|
|
31220
|
-
this.blobs,
|
|
31221
|
-
this.videoOptions,
|
|
31222
|
-
this.options.onBufferSizeError,
|
|
31223
|
-
(e2) => this.bufferError(e2),
|
|
31224
|
-
false
|
|
31225
|
-
);
|
|
31226
|
-
this.recordingStart = startRecording;
|
|
31227
|
-
this.recordingStop = stopRecording;
|
|
31228
|
-
this.recordingPause = pauseRecording;
|
|
31229
|
-
this.recordingResume = resumeRecording;
|
|
31230
|
-
this.recorderOptions = recorderOptions;
|
|
31231
|
-
this.getBufferSize = getBufferSize;
|
|
31232
|
-
console.log("startRecording Camera Recorder recordingStart");
|
|
31233
|
-
try {
|
|
31234
|
-
await new Promise((r2) => setTimeout(r2, 500));
|
|
31235
|
-
await this.recordingStart();
|
|
31236
|
-
} catch (error) {
|
|
31237
|
-
console.log("startRecording Camera Recorder error", error);
|
|
31238
|
-
throw error;
|
|
31239
|
-
}
|
|
31240
|
-
const isPortrait = (_d = screen.orientation) == null ? void 0 : _d.type.includes("portrait");
|
|
31089
|
+
const isPortrait = (_e2 = screen.orientation) == null ? void 0 : _e2.type.includes("portrait");
|
|
31241
31090
|
if (isPortrait && isMobileDevice()) {
|
|
31242
31091
|
if (this.videoOptions.width == height && this.videoOptions.height == width) {
|
|
31243
31092
|
[width, height] = [height, width];
|
|
@@ -31258,10 +31107,10 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31258
31107
|
);
|
|
31259
31108
|
throw ANOTHER_STREAM_ACTIVE;
|
|
31260
31109
|
}
|
|
31261
|
-
if ((
|
|
31110
|
+
if ((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectFace) {
|
|
31262
31111
|
await this.faceDetection.enableCam(this.cameraStream);
|
|
31263
31112
|
}
|
|
31264
|
-
if (((
|
|
31113
|
+
if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectPerson) || ((_h = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _h.detectCellPhone)) {
|
|
31265
31114
|
await this.objectDetection.enableCam(this.cameraStream);
|
|
31266
31115
|
}
|
|
31267
31116
|
this.filesToUpload = [];
|
|
@@ -31269,7 +31118,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31269
31118
|
this.captureFrame();
|
|
31270
31119
|
}
|
|
31271
31120
|
this.packageCount = 0;
|
|
31272
|
-
console.log("startRecording Camera Recorder
|
|
31121
|
+
console.log("startRecording Camera Recorder OK");
|
|
31273
31122
|
}
|
|
31274
31123
|
async stopRecording() {
|
|
31275
31124
|
var _a2, _b, _c2;
|
|
@@ -33818,6 +33667,7 @@ var ScreenRecorder = class {
|
|
|
33818
33667
|
this.recordingStop && await this.recordingStop();
|
|
33819
33668
|
}
|
|
33820
33669
|
async saveOnSession(session) {
|
|
33670
|
+
if (isMobileDevice()) return;
|
|
33821
33671
|
session.addRecording({
|
|
33822
33672
|
device: "",
|
|
33823
33673
|
file: new File(this.blobs, `EP_${session.id}_screen_0.webm`, {
|
|
@@ -63,12 +63,7 @@ export declare class CameraRecorder implements IRecorder {
|
|
|
63
63
|
stopStream(): Promise<void>;
|
|
64
64
|
waitForVideoFlow(): Promise<void>;
|
|
65
65
|
attachAndWarmup(stream: MediaStream): Promise<void>;
|
|
66
|
-
startRecording(
|
|
67
|
-
retry?: boolean;
|
|
68
|
-
}): Promise<void>;
|
|
69
|
-
startRecordingOld(options?: {
|
|
70
|
-
retry?: boolean;
|
|
71
|
-
}): Promise<void>;
|
|
66
|
+
startRecording(): Promise<void>;
|
|
72
67
|
stopRecording(): Promise<void>;
|
|
73
68
|
pauseRecording(): Promise<void>;
|
|
74
69
|
resumeRecording(): Promise<void>;
|
package/package.json
CHANGED
package/plugins/recorder.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { ProctoringVideoOptions } from "../proctoring/options/ProctoringVideoOpt
|
|
|
2
2
|
export declare function setRecorderProctoringId(id: string): void;
|
|
3
3
|
export default function recorder(stream: MediaStream, buffer: Blob[], videoOptions: ProctoringVideoOptions | null, onBufferSizeError?: boolean, onBufferSizeErrorCallback?: (e?: any) => void, audio?: boolean): {
|
|
4
4
|
startRecording: () => Promise<void>;
|
|
5
|
-
startWithRetry: (recorder: MediaRecorder) => Promise<void>;
|
|
6
5
|
stopRecording: () => Promise<void>;
|
|
7
6
|
pauseRecording: () => Promise<void>;
|
|
8
7
|
resumeRecording: () => Promise<void>;
|