easyproctor-hml 2.5.31 → 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 +76 -259
- package/index.js +76 -259
- 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/unpkg/easyproctor.min.js.map +0 -7
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
|
};
|
|
@@ -30437,6 +30383,7 @@ function recorder(stream4, buffer, videoOptions, onBufferSizeError = false, onBu
|
|
|
30437
30383
|
let started = false;
|
|
30438
30384
|
recorder2.onstart = () => {
|
|
30439
30385
|
started = true;
|
|
30386
|
+
console.log("recorder onstart");
|
|
30440
30387
|
resolve();
|
|
30441
30388
|
};
|
|
30442
30389
|
recorder2.onerror = (ev) => {
|
|
@@ -30471,86 +30418,37 @@ function recorder(stream4, buffer, videoOptions, onBufferSizeError = false, onBu
|
|
|
30471
30418
|
}, 2e3);
|
|
30472
30419
|
});
|
|
30473
30420
|
}
|
|
30474
|
-
async function startWithRetry(recorder2) {
|
|
30475
|
-
for (let i2 = 0; i2 < 3; i2++) {
|
|
30476
|
-
try {
|
|
30477
|
-
console.log("startWithRetry try", i2);
|
|
30478
|
-
await startRecorder(recorder2);
|
|
30479
|
-
if (recorder2.state === "recording") {
|
|
30480
|
-
bufferSize = 0;
|
|
30481
|
-
stopped = false;
|
|
30482
|
-
return;
|
|
30483
|
-
}
|
|
30484
|
-
} catch (e2) {
|
|
30485
|
-
console.error("Erro ao iniciar o recorder:", e2);
|
|
30486
|
-
}
|
|
30487
|
-
await new Promise((r2) => setTimeout(r2, 300));
|
|
30488
|
-
if (recorder2) {
|
|
30489
|
-
try {
|
|
30490
|
-
if (recorder2.state !== "inactive") {
|
|
30491
|
-
recorder2.stop();
|
|
30492
|
-
console.log("Recorder antigo parado");
|
|
30493
|
-
}
|
|
30494
|
-
} catch (e2) {
|
|
30495
|
-
console.warn("Erro ao parar recorder antigo:", e2);
|
|
30496
|
-
}
|
|
30497
|
-
}
|
|
30498
|
-
recorder2 = buildMediaRecorder(stream4, recorderOptions);
|
|
30499
|
-
}
|
|
30500
|
-
throw new Error("Falha ao iniciar o recorder");
|
|
30501
|
-
}
|
|
30502
30421
|
async function startRecording() {
|
|
30503
30422
|
try {
|
|
30504
|
-
await
|
|
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");
|
|
30430
|
+
}
|
|
30505
30431
|
} catch (e2) {
|
|
30432
|
+
console.error("Erro ao iniciar o recorder:", e2);
|
|
30433
|
+
await new Promise((r2) => setTimeout(r2, 300));
|
|
30506
30434
|
throw e2;
|
|
30507
30435
|
}
|
|
30508
30436
|
return;
|
|
30509
|
-
return new Promise((resolve, reject) => {
|
|
30510
|
-
var timeSlice = 1e4;
|
|
30511
|
-
if ((videoOptions == null ? void 0 : videoOptions.timeSlice) != void 0) {
|
|
30512
|
-
timeSlice = videoOptions == null ? void 0 : videoOptions.timeSlice;
|
|
30513
|
-
}
|
|
30514
|
-
console.log("startRecording", timeSlice);
|
|
30515
|
-
try {
|
|
30516
|
-
mediaRecorder.onstart = () => {
|
|
30517
|
-
console.log("Grava\xE7\xE3o iniciada com sucesso!");
|
|
30518
|
-
resolve();
|
|
30519
|
-
};
|
|
30520
|
-
mediaRecorder.onerror = (e2) => {
|
|
30521
|
-
console.error("Erro no MediaRecorder:", e2);
|
|
30522
|
-
reject(e2);
|
|
30523
|
-
};
|
|
30524
|
-
console.log("mediaRecorder.state", mediaRecorder.state);
|
|
30525
|
-
console.log(stream4.active);
|
|
30526
|
-
console.log(stream4.getTracks().map((t2) => t2.readyState));
|
|
30527
|
-
mediaRecorder.start(timeSlice);
|
|
30528
|
-
} catch (e2) {
|
|
30529
|
-
console.error("Falha ao iniciar:", e2);
|
|
30530
|
-
reject(e2);
|
|
30531
|
-
}
|
|
30532
|
-
bufferSize = 0;
|
|
30533
|
-
stopped = false;
|
|
30534
|
-
setTimeout(async () => {
|
|
30535
|
-
if (mediaRecorder.state == "recording") return;
|
|
30536
|
-
+console.log("onstart Timeout");
|
|
30537
|
-
reject(new Error("onstart Timeout"));
|
|
30538
|
-
}, 2e3);
|
|
30539
|
-
});
|
|
30540
30437
|
}
|
|
30541
30438
|
function stopRecording() {
|
|
30542
30439
|
return new Promise((resolve) => {
|
|
30543
30440
|
if (mediaRecorder.state == "recording") {
|
|
30441
|
+
console.log("stopRecording Recorder est\xE1 em estado recording, iniciando stop");
|
|
30544
30442
|
resolvePromise = resolve;
|
|
30545
|
-
mediaRecorder.requestData();
|
|
30546
|
-
mediaRecorder.stop();
|
|
30547
30443
|
stopped = true;
|
|
30548
|
-
|
|
30549
|
-
el.stop();
|
|
30550
|
-
});
|
|
30444
|
+
mediaRecorder.stop();
|
|
30551
30445
|
} else {
|
|
30446
|
+
console.log("stopRecording Recorder n\xE3o est\xE1 em estado recording");
|
|
30552
30447
|
resolve();
|
|
30553
30448
|
}
|
|
30449
|
+
stream4.getTracks().forEach((el) => {
|
|
30450
|
+
el.stop();
|
|
30451
|
+
});
|
|
30554
30452
|
});
|
|
30555
30453
|
}
|
|
30556
30454
|
function pauseRecording() {
|
|
@@ -30578,7 +30476,6 @@ function recorder(stream4, buffer, videoOptions, onBufferSizeError = false, onBu
|
|
|
30578
30476
|
}
|
|
30579
30477
|
return {
|
|
30580
30478
|
startRecording,
|
|
30581
|
-
startWithRetry,
|
|
30582
30479
|
stopRecording,
|
|
30583
30480
|
pauseRecording,
|
|
30584
30481
|
resumeRecording,
|
|
@@ -30587,6 +30484,46 @@ function recorder(stream4, buffer, videoOptions, onBufferSizeError = false, onBu
|
|
|
30587
30484
|
};
|
|
30588
30485
|
}
|
|
30589
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
|
+
|
|
30590
30527
|
// src/new-flow/upload/UploadService.ts
|
|
30591
30528
|
var UploadService = class {
|
|
30592
30529
|
constructor(proctoringId2, backend) {
|
|
@@ -30999,15 +30936,13 @@ var CameraRecorder = class {
|
|
|
30999
30936
|
}
|
|
31000
30937
|
async bufferError(e2) {
|
|
31001
30938
|
var _a2, _b;
|
|
31002
|
-
console.log("buffer error Camera Recorder
|
|
30939
|
+
console.log("buffer error Camera Recorder error", e2);
|
|
31003
30940
|
const retryEnabled = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.retryEnabled) || false;
|
|
31004
30941
|
const maxRetries = ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.maxRetries) || 3;
|
|
31005
30942
|
if (retryEnabled && this.currentRetries < maxRetries) {
|
|
31006
30943
|
console.log("buffer error Camera Recorder retry");
|
|
31007
30944
|
await this.recordingStop();
|
|
31008
|
-
await this.startRecording(
|
|
31009
|
-
retry: true
|
|
31010
|
-
});
|
|
30945
|
+
await this.startRecording();
|
|
31011
30946
|
this.currentRetries++;
|
|
31012
30947
|
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback(this.cameraStream);
|
|
31013
30948
|
} else {
|
|
@@ -31102,34 +31037,10 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31102
31037
|
console.log("waitForVideoFlow ok");
|
|
31103
31038
|
await new Promise((r2) => setTimeout(r2, 300));
|
|
31104
31039
|
}
|
|
31105
|
-
async startRecording(
|
|
31106
|
-
var _a2, _b, _c2, _d, _e2, _f, _g;
|
|
31040
|
+
async startRecording() {
|
|
31041
|
+
var _a2, _b, _c2, _d, _e2, _f, _g, _h;
|
|
31107
31042
|
console.log("startRecording Camera Recorder");
|
|
31108
|
-
|
|
31109
|
-
console.log("startRecording Camera Recorder initializeDetectors");
|
|
31110
|
-
await this.initializeDetectors();
|
|
31111
|
-
}
|
|
31112
|
-
const { cameraId, microphoneId } = this.options;
|
|
31113
|
-
const constraints = {
|
|
31114
|
-
audio: { deviceId: microphoneId },
|
|
31115
|
-
video: {
|
|
31116
|
-
deviceId: cameraId,
|
|
31117
|
-
width: this.videoOptions.width,
|
|
31118
|
-
height: this.videoOptions.height,
|
|
31119
|
-
frameRate: 15
|
|
31120
|
-
}
|
|
31121
|
-
};
|
|
31122
|
-
try {
|
|
31123
|
-
this.hardwareStream = await navigator.mediaDevices.getUserMedia(
|
|
31124
|
-
constraints
|
|
31125
|
-
);
|
|
31126
|
-
this.cameraStream = this.hardwareStream;
|
|
31127
|
-
} catch (error) {
|
|
31128
|
-
console.log("startRecording Camera Recorder error", error);
|
|
31129
|
-
if (error.toString() == "NotReadableError: Could not start video source")
|
|
31130
|
-
throw "N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa";
|
|
31131
|
-
throw error;
|
|
31132
|
-
}
|
|
31043
|
+
await this.startStream();
|
|
31133
31044
|
await this.attachAndWarmup(this.cameraStream);
|
|
31134
31045
|
const {
|
|
31135
31046
|
startRecording,
|
|
@@ -31158,118 +31069,24 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31158
31069
|
await this.recordingStart();
|
|
31159
31070
|
} catch (error) {
|
|
31160
31071
|
console.log("startRecording Camera Recorder error", error);
|
|
31161
|
-
|
|
31162
|
-
|
|
31163
|
-
|
|
31164
|
-
|
|
31165
|
-
|
|
31166
|
-
|
|
31167
|
-
|
|
31168
|
-
|
|
31169
|
-
[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;
|
|
31170
31080
|
}
|
|
31171
31081
|
}
|
|
31172
|
-
if (this.
|
|
31173
|
-
throw STREAM_UNDER_MINIMUM_PERMITTED;
|
|
31174
|
-
} else if (this.videoOptions.width !== width || this.videoOptions.height !== height) {
|
|
31175
|
-
trackers.registerAnotherStream(
|
|
31176
|
-
this.proctoringId,
|
|
31177
|
-
`Maybe have another stream active
|
|
31178
|
-
Video Options: ${JSON.stringify(
|
|
31179
|
-
this.videoOptions,
|
|
31180
|
-
null,
|
|
31181
|
-
2
|
|
31182
|
-
)}
|
|
31183
|
-
Setting: ${JSON.stringify(settings, null, 2)}`
|
|
31184
|
-
);
|
|
31185
|
-
throw ANOTHER_STREAM_ACTIVE;
|
|
31186
|
-
}
|
|
31187
|
-
if ((_e2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _e2.detectFace) {
|
|
31188
|
-
await this.faceDetection.enableCam(this.cameraStream);
|
|
31189
|
-
}
|
|
31190
|
-
if (((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectPerson) || ((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectCellPhone)) {
|
|
31191
|
-
await this.objectDetection.enableCam(this.cameraStream);
|
|
31192
|
-
}
|
|
31193
|
-
this.filesToUpload = [];
|
|
31194
|
-
if (this.options.proctoringType == "REALTIME") {
|
|
31195
|
-
this.captureFrame();
|
|
31196
|
-
}
|
|
31197
|
-
this.packageCount = 0;
|
|
31198
|
-
console.log("startRecording Camera Recorder OK");
|
|
31199
|
-
}
|
|
31200
|
-
async startRecordingOld(options) {
|
|
31201
|
-
var _a2, _b, _c2, _d, _e2, _f, _g;
|
|
31202
|
-
console.log("startRecording Camera Recorder");
|
|
31203
|
-
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)) {
|
|
31204
31083
|
console.log("startRecording Camera Recorder initializeDetectors");
|
|
31205
31084
|
await this.initializeDetectors();
|
|
31206
31085
|
}
|
|
31207
|
-
const { cameraId, microphoneId, onBufferSizeErrorCallback } = this.options;
|
|
31208
|
-
const constraints = {
|
|
31209
|
-
audio: { deviceId: microphoneId },
|
|
31210
|
-
video: {
|
|
31211
|
-
deviceId: cameraId,
|
|
31212
|
-
width: this.videoOptions.width,
|
|
31213
|
-
height: this.videoOptions.height,
|
|
31214
|
-
frameRate: 15
|
|
31215
|
-
}
|
|
31216
|
-
};
|
|
31217
|
-
try {
|
|
31218
|
-
this.hardwareStream = await navigator.mediaDevices.getUserMedia(
|
|
31219
|
-
constraints
|
|
31220
|
-
);
|
|
31221
|
-
} catch (error) {
|
|
31222
|
-
console.log("startRecording Camera Recorder error", error);
|
|
31223
|
-
if (error.toString() == "NotReadableError: Could not start video source")
|
|
31224
|
-
throw "N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa";
|
|
31225
|
-
throw error;
|
|
31226
|
-
}
|
|
31227
|
-
this.cameraStream = this.hardwareStream;
|
|
31228
31086
|
const track = this.cameraStream.getVideoTracks()[0];
|
|
31229
31087
|
const settings = track.getSettings();
|
|
31230
31088
|
let { width = 0, height = 0 } = settings;
|
|
31231
|
-
|
|
31232
|
-
await new Promise((resolve) => {
|
|
31233
|
-
const interval = setInterval(() => {
|
|
31234
|
-
console.log("cameraStream.getVideoTracks()[0].readyState", this.cameraStream.getVideoTracks()[0].readyState);
|
|
31235
|
-
if (this.cameraStream.getVideoTracks()[0].readyState == "live") {
|
|
31236
|
-
clearInterval(interval);
|
|
31237
|
-
resolve();
|
|
31238
|
-
}
|
|
31239
|
-
}, 100);
|
|
31240
|
-
});
|
|
31241
|
-
await new Promise((r2) => setTimeout(r2, 300));
|
|
31242
|
-
const {
|
|
31243
|
-
startRecording,
|
|
31244
|
-
stopRecording,
|
|
31245
|
-
pauseRecording,
|
|
31246
|
-
resumeRecording,
|
|
31247
|
-
recorderOptions,
|
|
31248
|
-
getBufferSize
|
|
31249
|
-
} = recorder(
|
|
31250
|
-
this.cameraStream,
|
|
31251
|
-
// streamToRecord,
|
|
31252
|
-
this.blobs,
|
|
31253
|
-
this.videoOptions,
|
|
31254
|
-
this.options.onBufferSizeError,
|
|
31255
|
-
(e2) => this.bufferError(e2),
|
|
31256
|
-
false
|
|
31257
|
-
);
|
|
31258
|
-
this.recordingStart = startRecording;
|
|
31259
|
-
this.recordingStop = stopRecording;
|
|
31260
|
-
this.recordingPause = pauseRecording;
|
|
31261
|
-
this.recordingResume = resumeRecording;
|
|
31262
|
-
this.recorderOptions = recorderOptions;
|
|
31263
|
-
this.getBufferSize = getBufferSize;
|
|
31264
|
-
console.log("startRecording Camera Recorder recordingStart");
|
|
31265
|
-
try {
|
|
31266
|
-
await new Promise((r2) => setTimeout(r2, 500));
|
|
31267
|
-
await this.recordingStart();
|
|
31268
|
-
} catch (error) {
|
|
31269
|
-
console.log("startRecording Camera Recorder error", error);
|
|
31270
|
-
throw error;
|
|
31271
|
-
}
|
|
31272
|
-
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");
|
|
31273
31090
|
if (isPortrait && isMobileDevice()) {
|
|
31274
31091
|
if (this.videoOptions.width == height && this.videoOptions.height == width) {
|
|
31275
31092
|
[width, height] = [height, width];
|
|
@@ -31290,10 +31107,10 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31290
31107
|
);
|
|
31291
31108
|
throw ANOTHER_STREAM_ACTIVE;
|
|
31292
31109
|
}
|
|
31293
|
-
if ((
|
|
31110
|
+
if ((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectFace) {
|
|
31294
31111
|
await this.faceDetection.enableCam(this.cameraStream);
|
|
31295
31112
|
}
|
|
31296
|
-
if (((
|
|
31113
|
+
if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectPerson) || ((_h = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _h.detectCellPhone)) {
|
|
31297
31114
|
await this.objectDetection.enableCam(this.cameraStream);
|
|
31298
31115
|
}
|
|
31299
31116
|
this.filesToUpload = [];
|
|
@@ -31301,7 +31118,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31301
31118
|
this.captureFrame();
|
|
31302
31119
|
}
|
|
31303
31120
|
this.packageCount = 0;
|
|
31304
|
-
console.log("startRecording Camera Recorder
|
|
31121
|
+
console.log("startRecording Camera Recorder OK");
|
|
31305
31122
|
}
|
|
31306
31123
|
async stopRecording() {
|
|
31307
31124
|
var _a2, _b, _c2;
|
|
@@ -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>;
|