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/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
|
};
|
|
@@ -12340,6 +12286,7 @@ function recorder(stream, buffer, videoOptions, onBufferSizeError = false, onBuf
|
|
|
12340
12286
|
let started = false;
|
|
12341
12287
|
recorder2.onstart = () => {
|
|
12342
12288
|
started = true;
|
|
12289
|
+
console.log("recorder onstart");
|
|
12343
12290
|
resolve();
|
|
12344
12291
|
};
|
|
12345
12292
|
recorder2.onerror = (ev) => {
|
|
@@ -12374,86 +12321,37 @@ function recorder(stream, buffer, videoOptions, onBufferSizeError = false, onBuf
|
|
|
12374
12321
|
}, 2e3);
|
|
12375
12322
|
});
|
|
12376
12323
|
}
|
|
12377
|
-
async function startWithRetry(recorder2) {
|
|
12378
|
-
for (let i2 = 0; i2 < 3; i2++) {
|
|
12379
|
-
try {
|
|
12380
|
-
console.log("startWithRetry try", i2);
|
|
12381
|
-
await startRecorder(recorder2);
|
|
12382
|
-
if (recorder2.state === "recording") {
|
|
12383
|
-
bufferSize = 0;
|
|
12384
|
-
stopped = false;
|
|
12385
|
-
return;
|
|
12386
|
-
}
|
|
12387
|
-
} catch (e2) {
|
|
12388
|
-
console.error("Erro ao iniciar o recorder:", e2);
|
|
12389
|
-
}
|
|
12390
|
-
await new Promise((r2) => setTimeout(r2, 300));
|
|
12391
|
-
if (recorder2) {
|
|
12392
|
-
try {
|
|
12393
|
-
if (recorder2.state !== "inactive") {
|
|
12394
|
-
recorder2.stop();
|
|
12395
|
-
console.log("Recorder antigo parado");
|
|
12396
|
-
}
|
|
12397
|
-
} catch (e2) {
|
|
12398
|
-
console.warn("Erro ao parar recorder antigo:", e2);
|
|
12399
|
-
}
|
|
12400
|
-
}
|
|
12401
|
-
recorder2 = buildMediaRecorder(stream, recorderOptions);
|
|
12402
|
-
}
|
|
12403
|
-
throw new Error("Falha ao iniciar o recorder");
|
|
12404
|
-
}
|
|
12405
12324
|
async function startRecording() {
|
|
12406
12325
|
try {
|
|
12407
|
-
await
|
|
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");
|
|
12333
|
+
}
|
|
12408
12334
|
} catch (e2) {
|
|
12335
|
+
console.error("Erro ao iniciar o recorder:", e2);
|
|
12336
|
+
await new Promise((r2) => setTimeout(r2, 300));
|
|
12409
12337
|
throw e2;
|
|
12410
12338
|
}
|
|
12411
12339
|
return;
|
|
12412
|
-
return new Promise((resolve, reject) => {
|
|
12413
|
-
var timeSlice = 1e4;
|
|
12414
|
-
if ((videoOptions == null ? void 0 : videoOptions.timeSlice) != void 0) {
|
|
12415
|
-
timeSlice = videoOptions == null ? void 0 : videoOptions.timeSlice;
|
|
12416
|
-
}
|
|
12417
|
-
console.log("startRecording", timeSlice);
|
|
12418
|
-
try {
|
|
12419
|
-
mediaRecorder.onstart = () => {
|
|
12420
|
-
console.log("Grava\xE7\xE3o iniciada com sucesso!");
|
|
12421
|
-
resolve();
|
|
12422
|
-
};
|
|
12423
|
-
mediaRecorder.onerror = (e2) => {
|
|
12424
|
-
console.error("Erro no MediaRecorder:", e2);
|
|
12425
|
-
reject(e2);
|
|
12426
|
-
};
|
|
12427
|
-
console.log("mediaRecorder.state", mediaRecorder.state);
|
|
12428
|
-
console.log(stream.active);
|
|
12429
|
-
console.log(stream.getTracks().map((t2) => t2.readyState));
|
|
12430
|
-
mediaRecorder.start(timeSlice);
|
|
12431
|
-
} catch (e2) {
|
|
12432
|
-
console.error("Falha ao iniciar:", e2);
|
|
12433
|
-
reject(e2);
|
|
12434
|
-
}
|
|
12435
|
-
bufferSize = 0;
|
|
12436
|
-
stopped = false;
|
|
12437
|
-
setTimeout(async () => {
|
|
12438
|
-
if (mediaRecorder.state == "recording") return;
|
|
12439
|
-
+console.log("onstart Timeout");
|
|
12440
|
-
reject(new Error("onstart Timeout"));
|
|
12441
|
-
}, 2e3);
|
|
12442
|
-
});
|
|
12443
12340
|
}
|
|
12444
12341
|
function stopRecording() {
|
|
12445
12342
|
return new Promise((resolve) => {
|
|
12446
12343
|
if (mediaRecorder.state == "recording") {
|
|
12344
|
+
console.log("stopRecording Recorder est\xE1 em estado recording, iniciando stop");
|
|
12447
12345
|
resolvePromise = resolve;
|
|
12448
|
-
mediaRecorder.requestData();
|
|
12449
|
-
mediaRecorder.stop();
|
|
12450
12346
|
stopped = true;
|
|
12451
|
-
|
|
12452
|
-
el.stop();
|
|
12453
|
-
});
|
|
12347
|
+
mediaRecorder.stop();
|
|
12454
12348
|
} else {
|
|
12349
|
+
console.log("stopRecording Recorder n\xE3o est\xE1 em estado recording");
|
|
12455
12350
|
resolve();
|
|
12456
12351
|
}
|
|
12352
|
+
stream.getTracks().forEach((el) => {
|
|
12353
|
+
el.stop();
|
|
12354
|
+
});
|
|
12457
12355
|
});
|
|
12458
12356
|
}
|
|
12459
12357
|
function pauseRecording() {
|
|
@@ -12481,7 +12379,6 @@ function recorder(stream, buffer, videoOptions, onBufferSizeError = false, onBuf
|
|
|
12481
12379
|
}
|
|
12482
12380
|
return {
|
|
12483
12381
|
startRecording,
|
|
12484
|
-
startWithRetry,
|
|
12485
12382
|
stopRecording,
|
|
12486
12383
|
pauseRecording,
|
|
12487
12384
|
resumeRecording,
|
|
@@ -12490,6 +12387,46 @@ function recorder(stream, buffer, videoOptions, onBufferSizeError = false, onBuf
|
|
|
12490
12387
|
};
|
|
12491
12388
|
}
|
|
12492
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
|
+
|
|
12493
12430
|
// src/new-flow/upload/UploadService.ts
|
|
12494
12431
|
var UploadService = class {
|
|
12495
12432
|
constructor(proctoringId2, backend) {
|
|
@@ -12902,15 +12839,13 @@ var CameraRecorder = class {
|
|
|
12902
12839
|
}
|
|
12903
12840
|
async bufferError(e2) {
|
|
12904
12841
|
var _a2, _b;
|
|
12905
|
-
console.log("buffer error Camera Recorder
|
|
12842
|
+
console.log("buffer error Camera Recorder error", e2);
|
|
12906
12843
|
const retryEnabled = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.retryEnabled) || false;
|
|
12907
12844
|
const maxRetries = ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.maxRetries) || 3;
|
|
12908
12845
|
if (retryEnabled && this.currentRetries < maxRetries) {
|
|
12909
12846
|
console.log("buffer error Camera Recorder retry");
|
|
12910
12847
|
await this.recordingStop();
|
|
12911
|
-
await this.startRecording(
|
|
12912
|
-
retry: true
|
|
12913
|
-
});
|
|
12848
|
+
await this.startRecording();
|
|
12914
12849
|
this.currentRetries++;
|
|
12915
12850
|
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback(this.cameraStream);
|
|
12916
12851
|
} else {
|
|
@@ -13005,34 +12940,10 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13005
12940
|
console.log("waitForVideoFlow ok");
|
|
13006
12941
|
await new Promise((r2) => setTimeout(r2, 300));
|
|
13007
12942
|
}
|
|
13008
|
-
async startRecording(
|
|
13009
|
-
var _a2, _b, _c2, _d, _e2, _f, _g;
|
|
12943
|
+
async startRecording() {
|
|
12944
|
+
var _a2, _b, _c2, _d, _e2, _f, _g, _h;
|
|
13010
12945
|
console.log("startRecording Camera Recorder");
|
|
13011
|
-
|
|
13012
|
-
console.log("startRecording Camera Recorder initializeDetectors");
|
|
13013
|
-
await this.initializeDetectors();
|
|
13014
|
-
}
|
|
13015
|
-
const { cameraId, microphoneId } = this.options;
|
|
13016
|
-
const constraints = {
|
|
13017
|
-
audio: { deviceId: microphoneId },
|
|
13018
|
-
video: {
|
|
13019
|
-
deviceId: cameraId,
|
|
13020
|
-
width: this.videoOptions.width,
|
|
13021
|
-
height: this.videoOptions.height,
|
|
13022
|
-
frameRate: 15
|
|
13023
|
-
}
|
|
13024
|
-
};
|
|
13025
|
-
try {
|
|
13026
|
-
this.hardwareStream = await navigator.mediaDevices.getUserMedia(
|
|
13027
|
-
constraints
|
|
13028
|
-
);
|
|
13029
|
-
this.cameraStream = this.hardwareStream;
|
|
13030
|
-
} catch (error) {
|
|
13031
|
-
console.log("startRecording Camera Recorder error", error);
|
|
13032
|
-
if (error.toString() == "NotReadableError: Could not start video source")
|
|
13033
|
-
throw "N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa";
|
|
13034
|
-
throw error;
|
|
13035
|
-
}
|
|
12946
|
+
await this.startStream();
|
|
13036
12947
|
await this.attachAndWarmup(this.cameraStream);
|
|
13037
12948
|
const {
|
|
13038
12949
|
startRecording,
|
|
@@ -13061,118 +12972,24 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13061
12972
|
await this.recordingStart();
|
|
13062
12973
|
} catch (error) {
|
|
13063
12974
|
console.log("startRecording Camera Recorder error", error);
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
[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;
|
|
13073
12983
|
}
|
|
13074
12984
|
}
|
|
13075
|
-
if (this.
|
|
13076
|
-
throw STREAM_UNDER_MINIMUM_PERMITTED;
|
|
13077
|
-
} else if (this.videoOptions.width !== width || this.videoOptions.height !== height) {
|
|
13078
|
-
trackers.registerAnotherStream(
|
|
13079
|
-
this.proctoringId,
|
|
13080
|
-
`Maybe have another stream active
|
|
13081
|
-
Video Options: ${JSON.stringify(
|
|
13082
|
-
this.videoOptions,
|
|
13083
|
-
null,
|
|
13084
|
-
2
|
|
13085
|
-
)}
|
|
13086
|
-
Setting: ${JSON.stringify(settings, null, 2)}`
|
|
13087
|
-
);
|
|
13088
|
-
throw ANOTHER_STREAM_ACTIVE;
|
|
13089
|
-
}
|
|
13090
|
-
if ((_e2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _e2.detectFace) {
|
|
13091
|
-
await this.faceDetection.enableCam(this.cameraStream);
|
|
13092
|
-
}
|
|
13093
|
-
if (((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectPerson) || ((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectCellPhone)) {
|
|
13094
|
-
await this.objectDetection.enableCam(this.cameraStream);
|
|
13095
|
-
}
|
|
13096
|
-
this.filesToUpload = [];
|
|
13097
|
-
if (this.options.proctoringType == "REALTIME") {
|
|
13098
|
-
this.captureFrame();
|
|
13099
|
-
}
|
|
13100
|
-
this.packageCount = 0;
|
|
13101
|
-
console.log("startRecording Camera Recorder OK");
|
|
13102
|
-
}
|
|
13103
|
-
async startRecordingOld(options) {
|
|
13104
|
-
var _a2, _b, _c2, _d, _e2, _f, _g;
|
|
13105
|
-
console.log("startRecording Camera Recorder");
|
|
13106
|
-
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)) {
|
|
13107
12986
|
console.log("startRecording Camera Recorder initializeDetectors");
|
|
13108
12987
|
await this.initializeDetectors();
|
|
13109
12988
|
}
|
|
13110
|
-
const { cameraId, microphoneId, onBufferSizeErrorCallback } = this.options;
|
|
13111
|
-
const constraints = {
|
|
13112
|
-
audio: { deviceId: microphoneId },
|
|
13113
|
-
video: {
|
|
13114
|
-
deviceId: cameraId,
|
|
13115
|
-
width: this.videoOptions.width,
|
|
13116
|
-
height: this.videoOptions.height,
|
|
13117
|
-
frameRate: 15
|
|
13118
|
-
}
|
|
13119
|
-
};
|
|
13120
|
-
try {
|
|
13121
|
-
this.hardwareStream = await navigator.mediaDevices.getUserMedia(
|
|
13122
|
-
constraints
|
|
13123
|
-
);
|
|
13124
|
-
} catch (error) {
|
|
13125
|
-
console.log("startRecording Camera Recorder error", error);
|
|
13126
|
-
if (error.toString() == "NotReadableError: Could not start video source")
|
|
13127
|
-
throw "N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa";
|
|
13128
|
-
throw error;
|
|
13129
|
-
}
|
|
13130
|
-
this.cameraStream = this.hardwareStream;
|
|
13131
12989
|
const track = this.cameraStream.getVideoTracks()[0];
|
|
13132
12990
|
const settings = track.getSettings();
|
|
13133
12991
|
let { width = 0, height = 0 } = settings;
|
|
13134
|
-
|
|
13135
|
-
await new Promise((resolve) => {
|
|
13136
|
-
const interval = setInterval(() => {
|
|
13137
|
-
console.log("cameraStream.getVideoTracks()[0].readyState", this.cameraStream.getVideoTracks()[0].readyState);
|
|
13138
|
-
if (this.cameraStream.getVideoTracks()[0].readyState == "live") {
|
|
13139
|
-
clearInterval(interval);
|
|
13140
|
-
resolve();
|
|
13141
|
-
}
|
|
13142
|
-
}, 100);
|
|
13143
|
-
});
|
|
13144
|
-
await new Promise((r2) => setTimeout(r2, 300));
|
|
13145
|
-
const {
|
|
13146
|
-
startRecording,
|
|
13147
|
-
stopRecording,
|
|
13148
|
-
pauseRecording,
|
|
13149
|
-
resumeRecording,
|
|
13150
|
-
recorderOptions,
|
|
13151
|
-
getBufferSize
|
|
13152
|
-
} = recorder(
|
|
13153
|
-
this.cameraStream,
|
|
13154
|
-
// streamToRecord,
|
|
13155
|
-
this.blobs,
|
|
13156
|
-
this.videoOptions,
|
|
13157
|
-
this.options.onBufferSizeError,
|
|
13158
|
-
(e2) => this.bufferError(e2),
|
|
13159
|
-
false
|
|
13160
|
-
);
|
|
13161
|
-
this.recordingStart = startRecording;
|
|
13162
|
-
this.recordingStop = stopRecording;
|
|
13163
|
-
this.recordingPause = pauseRecording;
|
|
13164
|
-
this.recordingResume = resumeRecording;
|
|
13165
|
-
this.recorderOptions = recorderOptions;
|
|
13166
|
-
this.getBufferSize = getBufferSize;
|
|
13167
|
-
console.log("startRecording Camera Recorder recordingStart");
|
|
13168
|
-
try {
|
|
13169
|
-
await new Promise((r2) => setTimeout(r2, 500));
|
|
13170
|
-
await this.recordingStart();
|
|
13171
|
-
} catch (error) {
|
|
13172
|
-
console.log("startRecording Camera Recorder error", error);
|
|
13173
|
-
throw error;
|
|
13174
|
-
}
|
|
13175
|
-
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");
|
|
13176
12993
|
if (isPortrait && isMobileDevice()) {
|
|
13177
12994
|
if (this.videoOptions.width == height && this.videoOptions.height == width) {
|
|
13178
12995
|
[width, height] = [height, width];
|
|
@@ -13193,10 +13010,10 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13193
13010
|
);
|
|
13194
13011
|
throw ANOTHER_STREAM_ACTIVE;
|
|
13195
13012
|
}
|
|
13196
|
-
if ((
|
|
13013
|
+
if ((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectFace) {
|
|
13197
13014
|
await this.faceDetection.enableCam(this.cameraStream);
|
|
13198
13015
|
}
|
|
13199
|
-
if (((
|
|
13016
|
+
if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectPerson) || ((_h = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _h.detectCellPhone)) {
|
|
13200
13017
|
await this.objectDetection.enableCam(this.cameraStream);
|
|
13201
13018
|
}
|
|
13202
13019
|
this.filesToUpload = [];
|
|
@@ -13204,7 +13021,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
13204
13021
|
this.captureFrame();
|
|
13205
13022
|
}
|
|
13206
13023
|
this.packageCount = 0;
|
|
13207
|
-
console.log("startRecording Camera Recorder
|
|
13024
|
+
console.log("startRecording Camera Recorder OK");
|
|
13208
13025
|
}
|
|
13209
13026
|
async stopRecording() {
|
|
13210
13027
|
var _a2, _b, _c2;
|