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/esm/index.js
CHANGED
|
@@ -12212,46 +12212,6 @@ function isMobileDevice() {
|
|
|
12212
12212
|
return /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
|
|
12213
12213
|
}
|
|
12214
12214
|
|
|
12215
|
-
// src/plugins/insights.ts
|
|
12216
|
-
var backendService;
|
|
12217
|
-
var init = (backend) => {
|
|
12218
|
-
backendService = backend;
|
|
12219
|
-
return backendService;
|
|
12220
|
-
};
|
|
12221
|
-
var eventNames = {
|
|
12222
|
-
DEVICES_CHECKED: "devices_checked",
|
|
12223
|
-
START: "start",
|
|
12224
|
-
FINISH: "finish",
|
|
12225
|
-
ERROR: "error",
|
|
12226
|
-
UPLOAD: "upload",
|
|
12227
|
-
UPLOAD_FILE: "upload_file",
|
|
12228
|
-
DOWNLOAD_VIDEO: "download_video",
|
|
12229
|
-
BUFFER_SIZE: "buffer_size",
|
|
12230
|
-
ANOTHER_STREAM: "another_stream",
|
|
12231
|
-
CHANGE_DEVICE: "change_device",
|
|
12232
|
-
STOP_SHARING_SCREEN: "stop_sharing_screen",
|
|
12233
|
-
ERROR_RECORDER_RTC: "error_recorder_rtc",
|
|
12234
|
-
BROWSER_NOT_SUPPORTED: "browser_not_supported",
|
|
12235
|
-
SAVE_ON_SESSION: "save_on_session"
|
|
12236
|
-
};
|
|
12237
|
-
var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
|
|
12238
|
-
var trackers = {
|
|
12239
|
-
registerDevicesChecked: (proctoringId2, success, description) => log(eventNames.DEVICES_CHECKED, { proctoringId: proctoringId2, success, description }),
|
|
12240
|
-
registerStart: (proctoringId2, success, description) => log(eventNames.START, { proctoringId: proctoringId2, success, description }),
|
|
12241
|
-
registerFinish: (proctoringId2, success, description) => log(eventNames.FINISH, { proctoringId: proctoringId2, success, description }),
|
|
12242
|
-
registerError: (proctoringId2, description) => log(eventNames.ERROR, { proctoringId: proctoringId2, description }),
|
|
12243
|
-
registerBrowserNotSupported: (proctoringId2, description) => log(eventNames.BROWSER_NOT_SUPPORTED, { proctoringId: proctoringId2, description }),
|
|
12244
|
-
registerUpload: (proctoringId2, success, description, serviceType, uploadTime) => log(eventNames.UPLOAD, { proctoringId: proctoringId2, success, description, serviceType, uploadTime }),
|
|
12245
|
-
registerUploadFile: (proctoringId2, description, fileType) => log(eventNames.UPLOAD_FILE, { proctoringId: proctoringId2, description, fileType }),
|
|
12246
|
-
registerChangeDevice: (proctoringId2, inOrOut, description) => log(eventNames.CHANGE_DEVICE, { proctoringId: proctoringId2, inOrOut, description }),
|
|
12247
|
-
registerStopSharingScreen: (proctoringId2, description) => log(eventNames.STOP_SHARING_SCREEN, { proctoringId: proctoringId2, description }),
|
|
12248
|
-
registerErrorRecorderRTC: (proctoringId2, description) => log(eventNames.ERROR_RECORDER_RTC, { proctoringId: proctoringId2, description }),
|
|
12249
|
-
registerDownloadFile: (proctoringId2, description) => log(eventNames.DOWNLOAD_VIDEO, { proctoringId: proctoringId2, description }),
|
|
12250
|
-
registerOnBufferSizeError: (proctoringId2, description) => log(eventNames.BUFFER_SIZE, { proctoringId: proctoringId2, description }),
|
|
12251
|
-
registerAnotherStream: (proctoringId2, description) => log(eventNames.ANOTHER_STREAM, { proctoringId: proctoringId2, description }),
|
|
12252
|
-
registerSaveOnSession: (proctoringId2, description) => log(eventNames.SAVE_ON_SESSION, { proctoringId: proctoringId2, description })
|
|
12253
|
-
};
|
|
12254
|
-
|
|
12255
12215
|
// src/plugins/recorder.ts
|
|
12256
12216
|
var proctoringId;
|
|
12257
12217
|
function setRecorderProctoringId(id) {
|
|
@@ -12313,21 +12273,7 @@ function recorder(stream, buffer, videoOptions, onBufferSizeError = false, onBuf
|
|
|
12313
12273
|
if (e2.data.size > 0) {
|
|
12314
12274
|
buffer.push(e2.data);
|
|
12315
12275
|
}
|
|
12316
|
-
if (
|
|
12317
|
-
if (lastEvent && e2.data.size === lastEvent.data.size || e2.data.size === 0) {
|
|
12318
|
-
proctoringId && lastEvent && e2.data.size === lastEvent.data.size && trackers.registerOnBufferSizeError(
|
|
12319
|
-
proctoringId,
|
|
12320
|
-
`onBufferSizeError: Recorder size freezed: ${e2.data.size} Mb`
|
|
12321
|
-
);
|
|
12322
|
-
proctoringId && e2.data.size === 0 && trackers.registerOnBufferSizeError(
|
|
12323
|
-
proctoringId,
|
|
12324
|
-
`onBufferSizeError: Recorder size equal 0 Mb`
|
|
12325
|
-
);
|
|
12326
|
-
console.log("onbuffer size error" + e2.data.size);
|
|
12327
|
-
onBufferSizeErrorCallback && onBufferSizeErrorCallback();
|
|
12328
|
-
}
|
|
12329
|
-
lastEvent = e2;
|
|
12330
|
-
} else {
|
|
12276
|
+
if (stopped) {
|
|
12331
12277
|
resolvePromise && resolvePromise();
|
|
12332
12278
|
}
|
|
12333
12279
|
};
|
|
@@ -12336,92 +12282,76 @@ function recorder(stream, buffer, videoOptions, onBufferSizeError = false, onBuf
|
|
|
12336
12282
|
let mediaRecorder = buildMediaRecorder(stream, recorderOptions);
|
|
12337
12283
|
async function startRecorder(recorder2) {
|
|
12338
12284
|
return new Promise((resolve, reject) => {
|
|
12285
|
+
var _a2, _b;
|
|
12339
12286
|
let started = false;
|
|
12340
12287
|
recorder2.onstart = () => {
|
|
12341
12288
|
started = true;
|
|
12289
|
+
console.log("recorder onstart");
|
|
12342
12290
|
resolve();
|
|
12343
12291
|
};
|
|
12344
|
-
recorder2.onerror = (
|
|
12345
|
-
|
|
12292
|
+
recorder2.onerror = (ev) => {
|
|
12293
|
+
console.error("Recorder error event:", ev);
|
|
12294
|
+
stream.getTracks().forEach((t2) => console.log(t2.readyState));
|
|
12295
|
+
if ("error" in ev) {
|
|
12296
|
+
const err = ev.error;
|
|
12297
|
+
console.error("Error name:", err == null ? void 0 : err.name);
|
|
12298
|
+
console.error("Error message:", err == null ? void 0 : err.message);
|
|
12299
|
+
reject(err || ev);
|
|
12300
|
+
} else {
|
|
12301
|
+
console.warn("Evento sem propriedade error");
|
|
12302
|
+
reject(ev);
|
|
12303
|
+
}
|
|
12346
12304
|
};
|
|
12347
12305
|
try {
|
|
12306
|
+
console.log("State antes do start:", recorder2.state);
|
|
12307
|
+
console.log("MimeType:", recorder2.mimeType);
|
|
12348
12308
|
recorder2.start(1e4);
|
|
12349
12309
|
} catch (e2) {
|
|
12310
|
+
console.error("Recorder erro ao chamar start event:", e2);
|
|
12311
|
+
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);
|
|
12312
|
+
console.error("Erro real 2:", e2, e2 == null ? void 0 : e2.message, e2 == null ? void 0 : e2.name);
|
|
12313
|
+
stream.getTracks().forEach((t2) => console.log(t2.readyState));
|
|
12350
12314
|
return reject(e2);
|
|
12351
12315
|
}
|
|
12352
12316
|
setTimeout(() => {
|
|
12353
12317
|
if (!started) {
|
|
12318
|
+
console.error("Timeout ao iniciar o recorder");
|
|
12354
12319
|
reject(new Error("Timeout ao iniciar o recorder"));
|
|
12355
12320
|
}
|
|
12356
|
-
},
|
|
12321
|
+
}, 2e3);
|
|
12357
12322
|
});
|
|
12358
12323
|
}
|
|
12359
|
-
async function
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12367
|
-
|
|
12368
|
-
}
|
|
12369
|
-
} catch (e2) {
|
|
12370
|
-
console.error("Erro ao iniciar o recorder:", e2);
|
|
12324
|
+
async function startRecording() {
|
|
12325
|
+
try {
|
|
12326
|
+
await startRecorder(mediaRecorder);
|
|
12327
|
+
if (mediaRecorder.state === "recording") {
|
|
12328
|
+
bufferSize = 0;
|
|
12329
|
+
stopped = false;
|
|
12330
|
+
return;
|
|
12331
|
+
} else {
|
|
12332
|
+
console.log("Recorder n\xE3o est\xE1 em estado recording ap\xF3s start");
|
|
12371
12333
|
}
|
|
12334
|
+
} catch (e2) {
|
|
12335
|
+
console.error("Erro ao iniciar o recorder:", e2);
|
|
12372
12336
|
await new Promise((r2) => setTimeout(r2, 300));
|
|
12373
|
-
|
|
12337
|
+
throw e2;
|
|
12374
12338
|
}
|
|
12375
|
-
throw new Error("Falha ao iniciar o recorder");
|
|
12376
|
-
}
|
|
12377
|
-
async function startRecording() {
|
|
12378
|
-
await startWithRetry(mediaRecorder);
|
|
12379
12339
|
return;
|
|
12380
|
-
return new Promise((resolve, reject) => {
|
|
12381
|
-
var timeSlice = 1e4;
|
|
12382
|
-
if ((videoOptions == null ? void 0 : videoOptions.timeSlice) != void 0) {
|
|
12383
|
-
timeSlice = videoOptions == null ? void 0 : videoOptions.timeSlice;
|
|
12384
|
-
}
|
|
12385
|
-
console.log("startRecording", timeSlice);
|
|
12386
|
-
try {
|
|
12387
|
-
mediaRecorder.onstart = () => {
|
|
12388
|
-
console.log("Grava\xE7\xE3o iniciada com sucesso!");
|
|
12389
|
-
resolve();
|
|
12390
|
-
};
|
|
12391
|
-
mediaRecorder.onerror = (e2) => {
|
|
12392
|
-
console.error("Erro no MediaRecorder:", e2);
|
|
12393
|
-
reject(e2);
|
|
12394
|
-
};
|
|
12395
|
-
console.log("mediaRecorder.state", mediaRecorder.state);
|
|
12396
|
-
console.log(stream.active);
|
|
12397
|
-
console.log(stream.getTracks().map((t2) => t2.readyState));
|
|
12398
|
-
mediaRecorder.start(timeSlice);
|
|
12399
|
-
} catch (e2) {
|
|
12400
|
-
console.error("Falha ao iniciar:", e2);
|
|
12401
|
-
reject(e2);
|
|
12402
|
-
}
|
|
12403
|
-
bufferSize = 0;
|
|
12404
|
-
stopped = false;
|
|
12405
|
-
setTimeout(async () => {
|
|
12406
|
-
if (mediaRecorder.state == "recording") return;
|
|
12407
|
-
+console.log("onstart Timeout");
|
|
12408
|
-
reject(new Error("onstart Timeout"));
|
|
12409
|
-
}, 2e3);
|
|
12410
|
-
});
|
|
12411
12340
|
}
|
|
12412
12341
|
function stopRecording() {
|
|
12413
12342
|
return new Promise((resolve) => {
|
|
12414
12343
|
if (mediaRecorder.state == "recording") {
|
|
12344
|
+
console.log("stopRecording Recorder est\xE1 em estado recording, iniciando stop");
|
|
12415
12345
|
resolvePromise = resolve;
|
|
12416
|
-
mediaRecorder.requestData();
|
|
12417
|
-
mediaRecorder.stop();
|
|
12418
12346
|
stopped = true;
|
|
12419
|
-
|
|
12420
|
-
el.stop();
|
|
12421
|
-
});
|
|
12347
|
+
mediaRecorder.stop();
|
|
12422
12348
|
} else {
|
|
12349
|
+
console.log("stopRecording Recorder n\xE3o est\xE1 em estado recording");
|
|
12423
12350
|
resolve();
|
|
12424
12351
|
}
|
|
12352
|
+
stream.getTracks().forEach((el) => {
|
|
12353
|
+
el.stop();
|
|
12354
|
+
});
|
|
12425
12355
|
});
|
|
12426
12356
|
}
|
|
12427
12357
|
function pauseRecording() {
|
|
@@ -12449,7 +12379,6 @@ function recorder(stream, buffer, videoOptions, onBufferSizeError = false, onBuf
|
|
|
12449
12379
|
}
|
|
12450
12380
|
return {
|
|
12451
12381
|
startRecording,
|
|
12452
|
-
startWithRetry,
|
|
12453
12382
|
stopRecording,
|
|
12454
12383
|
pauseRecording,
|
|
12455
12384
|
resumeRecording,
|
|
@@ -12458,6 +12387,46 @@ function recorder(stream, buffer, videoOptions, onBufferSizeError = false, onBuf
|
|
|
12458
12387
|
};
|
|
12459
12388
|
}
|
|
12460
12389
|
|
|
12390
|
+
// src/plugins/insights.ts
|
|
12391
|
+
var backendService;
|
|
12392
|
+
var init = (backend) => {
|
|
12393
|
+
backendService = backend;
|
|
12394
|
+
return backendService;
|
|
12395
|
+
};
|
|
12396
|
+
var eventNames = {
|
|
12397
|
+
DEVICES_CHECKED: "devices_checked",
|
|
12398
|
+
START: "start",
|
|
12399
|
+
FINISH: "finish",
|
|
12400
|
+
ERROR: "error",
|
|
12401
|
+
UPLOAD: "upload",
|
|
12402
|
+
UPLOAD_FILE: "upload_file",
|
|
12403
|
+
DOWNLOAD_VIDEO: "download_video",
|
|
12404
|
+
BUFFER_SIZE: "buffer_size",
|
|
12405
|
+
ANOTHER_STREAM: "another_stream",
|
|
12406
|
+
CHANGE_DEVICE: "change_device",
|
|
12407
|
+
STOP_SHARING_SCREEN: "stop_sharing_screen",
|
|
12408
|
+
ERROR_RECORDER_RTC: "error_recorder_rtc",
|
|
12409
|
+
BROWSER_NOT_SUPPORTED: "browser_not_supported",
|
|
12410
|
+
SAVE_ON_SESSION: "save_on_session"
|
|
12411
|
+
};
|
|
12412
|
+
var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
|
|
12413
|
+
var trackers = {
|
|
12414
|
+
registerDevicesChecked: (proctoringId2, success, description) => log(eventNames.DEVICES_CHECKED, { proctoringId: proctoringId2, success, description }),
|
|
12415
|
+
registerStart: (proctoringId2, success, description) => log(eventNames.START, { proctoringId: proctoringId2, success, description }),
|
|
12416
|
+
registerFinish: (proctoringId2, success, description) => log(eventNames.FINISH, { proctoringId: proctoringId2, success, description }),
|
|
12417
|
+
registerError: (proctoringId2, description) => log(eventNames.ERROR, { proctoringId: proctoringId2, description }),
|
|
12418
|
+
registerBrowserNotSupported: (proctoringId2, description) => log(eventNames.BROWSER_NOT_SUPPORTED, { proctoringId: proctoringId2, description }),
|
|
12419
|
+
registerUpload: (proctoringId2, success, description, serviceType, uploadTime) => log(eventNames.UPLOAD, { proctoringId: proctoringId2, success, description, serviceType, uploadTime }),
|
|
12420
|
+
registerUploadFile: (proctoringId2, description, fileType) => log(eventNames.UPLOAD_FILE, { proctoringId: proctoringId2, description, fileType }),
|
|
12421
|
+
registerChangeDevice: (proctoringId2, inOrOut, description) => log(eventNames.CHANGE_DEVICE, { proctoringId: proctoringId2, inOrOut, description }),
|
|
12422
|
+
registerStopSharingScreen: (proctoringId2, description) => log(eventNames.STOP_SHARING_SCREEN, { proctoringId: proctoringId2, description }),
|
|
12423
|
+
registerErrorRecorderRTC: (proctoringId2, description) => log(eventNames.ERROR_RECORDER_RTC, { proctoringId: proctoringId2, description }),
|
|
12424
|
+
registerDownloadFile: (proctoringId2, description) => log(eventNames.DOWNLOAD_VIDEO, { proctoringId: proctoringId2, description }),
|
|
12425
|
+
registerOnBufferSizeError: (proctoringId2, description) => log(eventNames.BUFFER_SIZE, { proctoringId: proctoringId2, description }),
|
|
12426
|
+
registerAnotherStream: (proctoringId2, description) => log(eventNames.ANOTHER_STREAM, { proctoringId: proctoringId2, description }),
|
|
12427
|
+
registerSaveOnSession: (proctoringId2, description) => log(eventNames.SAVE_ON_SESSION, { proctoringId: proctoringId2, description })
|
|
12428
|
+
};
|
|
12429
|
+
|
|
12461
12430
|
// src/new-flow/upload/UploadService.ts
|
|
12462
12431
|
var UploadService = class {
|
|
12463
12432
|
constructor(proctoringId2, backend) {
|
|
@@ -12870,15 +12839,13 @@ var CameraRecorder = class {
|
|
|
12870
12839
|
}
|
|
12871
12840
|
async bufferError(e2) {
|
|
12872
12841
|
var _a2, _b;
|
|
12873
|
-
console.log("buffer error Camera Recorder
|
|
12842
|
+
console.log("buffer error Camera Recorder error", e2);
|
|
12874
12843
|
const retryEnabled = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.retryEnabled) || false;
|
|
12875
12844
|
const maxRetries = ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.maxRetries) || 3;
|
|
12876
12845
|
if (retryEnabled && this.currentRetries < maxRetries) {
|
|
12877
12846
|
console.log("buffer error Camera Recorder retry");
|
|
12878
12847
|
await this.recordingStop();
|
|
12879
|
-
await this.startRecording(
|
|
12880
|
-
retry: true
|
|
12881
|
-
});
|
|
12848
|
+
await this.startRecording();
|
|
12882
12849
|
this.currentRetries++;
|
|
12883
12850
|
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback(this.cameraStream);
|
|
12884
12851
|
} else {
|
|
@@ -12973,34 +12940,10 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
12973
12940
|
console.log("waitForVideoFlow ok");
|
|
12974
12941
|
await new Promise((r2) => setTimeout(r2, 300));
|
|
12975
12942
|
}
|
|
12976
|
-
async startRecording(
|
|
12977
|
-
var _a2, _b, _c2, _d, _e2, _f, _g;
|
|
12943
|
+
async startRecording() {
|
|
12944
|
+
var _a2, _b, _c2, _d, _e2, _f, _g, _h;
|
|
12978
12945
|
console.log("startRecording Camera Recorder");
|
|
12979
|
-
|
|
12980
|
-
console.log("startRecording Camera Recorder initializeDetectors");
|
|
12981
|
-
await this.initializeDetectors();
|
|
12982
|
-
}
|
|
12983
|
-
const { cameraId, microphoneId } = this.options;
|
|
12984
|
-
const constraints = {
|
|
12985
|
-
audio: { deviceId: microphoneId },
|
|
12986
|
-
video: {
|
|
12987
|
-
deviceId: cameraId,
|
|
12988
|
-
width: this.videoOptions.width,
|
|
12989
|
-
height: this.videoOptions.height,
|
|
12990
|
-
frameRate: 15
|
|
12991
|
-
}
|
|
12992
|
-
};
|
|
12993
|
-
try {
|
|
12994
|
-
this.hardwareStream = await navigator.mediaDevices.getUserMedia(
|
|
12995
|
-
constraints
|
|
12996
|
-
);
|
|
12997
|
-
this.cameraStream = this.hardwareStream;
|
|
12998
|
-
} catch (error) {
|
|
12999
|
-
console.log("startRecording Camera Recorder error", error);
|
|
13000
|
-
if (error.toString() == "NotReadableError: Could not start video source")
|
|
13001
|
-
throw "N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa";
|
|
13002
|
-
throw error;
|
|
13003
|
-
}
|
|
12946
|
+
await this.startStream();
|
|
13004
12947
|
await this.attachAndWarmup(this.cameraStream);
|
|
13005
12948
|
const {
|
|
13006
12949
|
startRecording,
|
|
@@ -13029,118 +12972,24 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13029
12972
|
await this.recordingStart();
|
|
13030
12973
|
} catch (error) {
|
|
13031
12974
|
console.log("startRecording Camera Recorder error", error);
|
|
13032
|
-
|
|
13033
|
-
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
|
|
13037
|
-
|
|
13038
|
-
|
|
13039
|
-
|
|
13040
|
-
[width, height] = [height, width];
|
|
12975
|
+
this.stopRecording();
|
|
12976
|
+
const maxRetries = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.maxRetries) || 3;
|
|
12977
|
+
if (this.currentRetries < maxRetries) {
|
|
12978
|
+
console.log("buffer error Camera Recorder retry", this.currentRetries);
|
|
12979
|
+
this.currentRetries++;
|
|
12980
|
+
await this.startRecording();
|
|
12981
|
+
} else {
|
|
12982
|
+
throw error;
|
|
13041
12983
|
}
|
|
13042
12984
|
}
|
|
13043
|
-
if (this.
|
|
13044
|
-
throw STREAM_UNDER_MINIMUM_PERMITTED;
|
|
13045
|
-
} else if (this.videoOptions.width !== width || this.videoOptions.height !== height) {
|
|
13046
|
-
trackers.registerAnotherStream(
|
|
13047
|
-
this.proctoringId,
|
|
13048
|
-
`Maybe have another stream active
|
|
13049
|
-
Video Options: ${JSON.stringify(
|
|
13050
|
-
this.videoOptions,
|
|
13051
|
-
null,
|
|
13052
|
-
2
|
|
13053
|
-
)}
|
|
13054
|
-
Setting: ${JSON.stringify(settings, null, 2)}`
|
|
13055
|
-
);
|
|
13056
|
-
throw ANOTHER_STREAM_ACTIVE;
|
|
13057
|
-
}
|
|
13058
|
-
if ((_e2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _e2.detectFace) {
|
|
13059
|
-
await this.faceDetection.enableCam(this.cameraStream);
|
|
13060
|
-
}
|
|
13061
|
-
if (((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectPerson) || ((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectCellPhone)) {
|
|
13062
|
-
await this.objectDetection.enableCam(this.cameraStream);
|
|
13063
|
-
}
|
|
13064
|
-
this.filesToUpload = [];
|
|
13065
|
-
if (this.options.proctoringType == "REALTIME") {
|
|
13066
|
-
this.captureFrame();
|
|
13067
|
-
}
|
|
13068
|
-
this.packageCount = 0;
|
|
13069
|
-
console.log("startRecording Camera Recorder OK");
|
|
13070
|
-
}
|
|
13071
|
-
async startRecordingOld(options) {
|
|
13072
|
-
var _a2, _b, _c2, _d, _e2, _f, _g;
|
|
13073
|
-
console.log("startRecording Camera Recorder");
|
|
13074
|
-
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)) {
|
|
12985
|
+
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)) {
|
|
13075
12986
|
console.log("startRecording Camera Recorder initializeDetectors");
|
|
13076
12987
|
await this.initializeDetectors();
|
|
13077
12988
|
}
|
|
13078
|
-
const { cameraId, microphoneId, onBufferSizeErrorCallback } = this.options;
|
|
13079
|
-
const constraints = {
|
|
13080
|
-
audio: { deviceId: microphoneId },
|
|
13081
|
-
video: {
|
|
13082
|
-
deviceId: cameraId,
|
|
13083
|
-
width: this.videoOptions.width,
|
|
13084
|
-
height: this.videoOptions.height,
|
|
13085
|
-
frameRate: 15
|
|
13086
|
-
}
|
|
13087
|
-
};
|
|
13088
|
-
try {
|
|
13089
|
-
this.hardwareStream = await navigator.mediaDevices.getUserMedia(
|
|
13090
|
-
constraints
|
|
13091
|
-
);
|
|
13092
|
-
} catch (error) {
|
|
13093
|
-
console.log("startRecording Camera Recorder error", error);
|
|
13094
|
-
if (error.toString() == "NotReadableError: Could not start video source")
|
|
13095
|
-
throw "N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa";
|
|
13096
|
-
throw error;
|
|
13097
|
-
}
|
|
13098
|
-
this.cameraStream = this.hardwareStream;
|
|
13099
12989
|
const track = this.cameraStream.getVideoTracks()[0];
|
|
13100
12990
|
const settings = track.getSettings();
|
|
13101
12991
|
let { width = 0, height = 0 } = settings;
|
|
13102
|
-
|
|
13103
|
-
await new Promise((resolve) => {
|
|
13104
|
-
const interval = setInterval(() => {
|
|
13105
|
-
console.log("cameraStream.getVideoTracks()[0].readyState", this.cameraStream.getVideoTracks()[0].readyState);
|
|
13106
|
-
if (this.cameraStream.getVideoTracks()[0].readyState == "live") {
|
|
13107
|
-
clearInterval(interval);
|
|
13108
|
-
resolve();
|
|
13109
|
-
}
|
|
13110
|
-
}, 100);
|
|
13111
|
-
});
|
|
13112
|
-
await new Promise((r2) => setTimeout(r2, 300));
|
|
13113
|
-
const {
|
|
13114
|
-
startRecording,
|
|
13115
|
-
stopRecording,
|
|
13116
|
-
pauseRecording,
|
|
13117
|
-
resumeRecording,
|
|
13118
|
-
recorderOptions,
|
|
13119
|
-
getBufferSize
|
|
13120
|
-
} = recorder(
|
|
13121
|
-
this.cameraStream,
|
|
13122
|
-
// streamToRecord,
|
|
13123
|
-
this.blobs,
|
|
13124
|
-
this.videoOptions,
|
|
13125
|
-
this.options.onBufferSizeError,
|
|
13126
|
-
(e2) => this.bufferError(e2),
|
|
13127
|
-
false
|
|
13128
|
-
);
|
|
13129
|
-
this.recordingStart = startRecording;
|
|
13130
|
-
this.recordingStop = stopRecording;
|
|
13131
|
-
this.recordingPause = pauseRecording;
|
|
13132
|
-
this.recordingResume = resumeRecording;
|
|
13133
|
-
this.recorderOptions = recorderOptions;
|
|
13134
|
-
this.getBufferSize = getBufferSize;
|
|
13135
|
-
console.log("startRecording Camera Recorder recordingStart");
|
|
13136
|
-
try {
|
|
13137
|
-
await new Promise((r2) => setTimeout(r2, 500));
|
|
13138
|
-
await this.recordingStart();
|
|
13139
|
-
} catch (error) {
|
|
13140
|
-
console.log("startRecording Camera Recorder error", error);
|
|
13141
|
-
throw error;
|
|
13142
|
-
}
|
|
13143
|
-
const isPortrait = (_d = screen.orientation) == null ? void 0 : _d.type.includes("portrait");
|
|
12992
|
+
const isPortrait = (_e2 = screen.orientation) == null ? void 0 : _e2.type.includes("portrait");
|
|
13144
12993
|
if (isPortrait && isMobileDevice()) {
|
|
13145
12994
|
if (this.videoOptions.width == height && this.videoOptions.height == width) {
|
|
13146
12995
|
[width, height] = [height, width];
|
|
@@ -13161,10 +13010,10 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13161
13010
|
);
|
|
13162
13011
|
throw ANOTHER_STREAM_ACTIVE;
|
|
13163
13012
|
}
|
|
13164
|
-
if ((
|
|
13013
|
+
if ((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectFace) {
|
|
13165
13014
|
await this.faceDetection.enableCam(this.cameraStream);
|
|
13166
13015
|
}
|
|
13167
|
-
if (((
|
|
13016
|
+
if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectPerson) || ((_h = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _h.detectCellPhone)) {
|
|
13168
13017
|
await this.objectDetection.enableCam(this.cameraStream);
|
|
13169
13018
|
}
|
|
13170
13019
|
this.filesToUpload = [];
|
|
@@ -13172,7 +13021,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13172
13021
|
this.captureFrame();
|
|
13173
13022
|
}
|
|
13174
13023
|
this.packageCount = 0;
|
|
13175
|
-
console.log("startRecording Camera Recorder
|
|
13024
|
+
console.log("startRecording Camera Recorder OK");
|
|
13176
13025
|
}
|
|
13177
13026
|
async stopRecording() {
|
|
13178
13027
|
var _a2, _b, _c2;
|
|
@@ -15721,6 +15570,7 @@ var ScreenRecorder = class {
|
|
|
15721
15570
|
this.recordingStop && await this.recordingStop();
|
|
15722
15571
|
}
|
|
15723
15572
|
async saveOnSession(session) {
|
|
15573
|
+
if (isMobileDevice()) return;
|
|
15724
15574
|
session.addRecording({
|
|
15725
15575
|
device: "",
|
|
15726
15576
|
file: new File(this.blobs, `EP_${session.id}_screen_0.webm`, {
|