easyproctor-hml 2.5.20 → 2.5.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -7
- package/esm/index.js +39 -226
- package/extension/{extensionEasyProctor.d.ts → extension.d.ts} +1 -1
- package/index.js +39 -226
- package/new-flow/recorders/CameraRecorder.d.ts +0 -1
- package/package.json +1 -1
- package/plugins/recorder.d.ts +2 -1
- package/proctoring/options/ProctoringVideoOptions.d.ts +3 -0
- package/proctoring/proctoring.d.ts +0 -6
- package/proctoring/useProctoring.d.ts +0 -2
- package/unpkg/easyproctor.min.js +39 -39
- package/extension/extensionEasyCatcher.d.ts +0 -11
package/index.js
CHANGED
|
@@ -30264,7 +30264,10 @@ function validatePartialVideoOptions(options) {
|
|
|
30264
30264
|
width: options.width,
|
|
30265
30265
|
height: options.height,
|
|
30266
30266
|
minWidth: options.minWidth,
|
|
30267
|
-
minHeight: options.minHeight
|
|
30267
|
+
minHeight: options.minHeight,
|
|
30268
|
+
timeSlice: options.timeSlice,
|
|
30269
|
+
videoBitsPerSecond: options.videoBitsPerSecond,
|
|
30270
|
+
mimeType: options.mimeType
|
|
30268
30271
|
};
|
|
30269
30272
|
} else {
|
|
30270
30273
|
return { width: 640, height: 480 };
|
|
@@ -30351,7 +30354,7 @@ var proctoringId;
|
|
|
30351
30354
|
function setRecorderProctoringId(id) {
|
|
30352
30355
|
proctoringId = id;
|
|
30353
30356
|
}
|
|
30354
|
-
function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorCallback, audio = false) {
|
|
30357
|
+
function recorder(stream4, buffer, videoOptions, onBufferSizeError = false, onBufferSizeErrorCallback, audio = false) {
|
|
30355
30358
|
let resolvePromise;
|
|
30356
30359
|
let stopped = false;
|
|
30357
30360
|
let onBufferSizeInterval;
|
|
@@ -30361,7 +30364,7 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30361
30364
|
let recorderOptions = {
|
|
30362
30365
|
// eslint-disable-next-line no-useless-escape
|
|
30363
30366
|
mimeType: "video/webm",
|
|
30364
|
-
videoBitsPerSecond: 128e3,
|
|
30367
|
+
videoBitsPerSecond: (videoOptions == null ? void 0 : videoOptions.videoBitsPerSecond) || 128e3,
|
|
30365
30368
|
audioBitsPerSecond: 64 * 1e3
|
|
30366
30369
|
};
|
|
30367
30370
|
if (MediaRecorder.isTypeSupported("video/webm;codecs=vp9")) {
|
|
@@ -30371,15 +30374,25 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30371
30374
|
"vp9 codec not supported. Using default mimeType without vp9."
|
|
30372
30375
|
);
|
|
30373
30376
|
}
|
|
30377
|
+
if (videoOptions == null ? void 0 : videoOptions.mimeType) {
|
|
30378
|
+
recorderOptions.mimeType = videoOptions == null ? void 0 : videoOptions.mimeType;
|
|
30379
|
+
}
|
|
30374
30380
|
if (audio) {
|
|
30375
30381
|
recorderOptions = {
|
|
30376
30382
|
mimeType: "audio/webm",
|
|
30377
30383
|
audioBitsPerSecond: 64 * 1e3
|
|
30378
30384
|
};
|
|
30379
30385
|
}
|
|
30386
|
+
console.log("recorderOptions bitsPerSecond", recorderOptions.bitsPerSecond);
|
|
30380
30387
|
const mediaRecorder = new MediaRecorder(stream4, recorderOptions);
|
|
30381
30388
|
mediaRecorder.ondataavailable = (e3) => {
|
|
30382
30389
|
bufferSize = bufferSize + e3.data.size;
|
|
30390
|
+
console.log("video tracks length > 0", stream4.getVideoTracks().length > 0);
|
|
30391
|
+
if (stream4.getVideoTracks().length > 0) {
|
|
30392
|
+
const videoTrack = stream4.getVideoTracks()[0];
|
|
30393
|
+
console.log(videoTrack.readyState);
|
|
30394
|
+
console.log(videoTrack.enabled);
|
|
30395
|
+
}
|
|
30383
30396
|
if (e3.data.size > 0) {
|
|
30384
30397
|
buffer.push(e3.data);
|
|
30385
30398
|
}
|
|
@@ -30407,14 +30420,10 @@ function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorC
|
|
|
30407
30420
|
function startRecording() {
|
|
30408
30421
|
return new Promise((resolve) => {
|
|
30409
30422
|
resolvePromise = resolve;
|
|
30410
|
-
|
|
30423
|
+
console.log("startRecording", videoOptions == null ? void 0 : videoOptions.timeSlice);
|
|
30424
|
+
mediaRecorder.start((videoOptions == null ? void 0 : videoOptions.timeSlice) || 1e4);
|
|
30411
30425
|
bufferSize = 0;
|
|
30412
30426
|
stopped = false;
|
|
30413
|
-
if (onBufferSizeError) {
|
|
30414
|
-
onBufferSizeInterval = setInterval(async () => {
|
|
30415
|
-
await mediaRecorder.requestData();
|
|
30416
|
-
}, 3e4);
|
|
30417
|
-
}
|
|
30418
30427
|
});
|
|
30419
30428
|
}
|
|
30420
30429
|
function stopRecording() {
|
|
@@ -30874,13 +30883,21 @@ var CameraRecorder = class {
|
|
|
30874
30883
|
}
|
|
30875
30884
|
}
|
|
30876
30885
|
configImageCapture() {
|
|
30886
|
+
var _a2;
|
|
30877
30887
|
this.video = document.createElement("video");
|
|
30878
30888
|
this.canvas = document.createElement("canvas");
|
|
30879
30889
|
this.video.srcObject = this.cameraStream;
|
|
30880
30890
|
this.video.play();
|
|
30881
30891
|
this.video.muted = true;
|
|
30882
|
-
|
|
30883
|
-
|
|
30892
|
+
const isPortrait = (_a2 = screen.orientation) == null ? void 0 : _a2.type.includes("portrait");
|
|
30893
|
+
if (isPortrait && isMobileDevice()) {
|
|
30894
|
+
console.log("configurando canvas em portrait");
|
|
30895
|
+
this.canvas.width = this.videoOptions.height / 2;
|
|
30896
|
+
this.canvas.height = this.videoOptions.width / 2;
|
|
30897
|
+
} else {
|
|
30898
|
+
this.canvas.width = this.videoOptions.width / 2;
|
|
30899
|
+
this.canvas.height = this.videoOptions.height / 2;
|
|
30900
|
+
}
|
|
30884
30901
|
}
|
|
30885
30902
|
async bufferError(e3) {
|
|
30886
30903
|
var _a2, _b;
|
|
@@ -30937,6 +30954,7 @@ var CameraRecorder = class {
|
|
|
30937
30954
|
this.cameraStream,
|
|
30938
30955
|
// streamToRecord,
|
|
30939
30956
|
this.blobs,
|
|
30957
|
+
this.videoOptions,
|
|
30940
30958
|
this.options.onBufferSizeError,
|
|
30941
30959
|
(e3) => this.bufferError(e3),
|
|
30942
30960
|
false
|
|
@@ -31088,7 +31106,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31088
31106
|
const packSize = (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimePackageSize;
|
|
31089
31107
|
this.imageCount = 0;
|
|
31090
31108
|
this.imageInterval = setInterval(async () => {
|
|
31091
|
-
console.log("capturando frame " + this.imageCount);
|
|
31092
31109
|
this.canvas.getContext("2d").drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
|
|
31093
31110
|
const image_data_url = this.canvas.toDataURL("image/jpeg");
|
|
31094
31111
|
if (this.proctoringId == void 0) return;
|
|
@@ -31220,45 +31237,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
31220
31237
|
}
|
|
31221
31238
|
this.noiseWait++;
|
|
31222
31239
|
}
|
|
31223
|
-
/**
|
|
31224
|
-
* Cria um stream processado onde os frames são rotacionados via Canvas.
|
|
31225
|
-
* Isso corrige o problema de gravação deitada em iOS/Mobile.
|
|
31226
|
-
*/
|
|
31227
|
-
createRotatedStream(originalStream) {
|
|
31228
|
-
this.internalClonedStream = originalStream.clone();
|
|
31229
|
-
const video = document.createElement("video");
|
|
31230
|
-
video.srcObject = this.internalClonedStream;
|
|
31231
|
-
video.muted = true;
|
|
31232
|
-
video.play();
|
|
31233
|
-
const canvas = document.createElement("canvas");
|
|
31234
|
-
const ctx = canvas.getContext("2d");
|
|
31235
|
-
const track = originalStream.getVideoTracks()[0];
|
|
31236
|
-
const settings = track.getSettings();
|
|
31237
|
-
const width = settings.width || 640;
|
|
31238
|
-
const height = settings.height || 480;
|
|
31239
|
-
canvas.width = height;
|
|
31240
|
-
canvas.height = width;
|
|
31241
|
-
const draw = () => {
|
|
31242
|
-
if (video.paused || video.ended) return;
|
|
31243
|
-
if (!this.isCanvasLoopActive) return;
|
|
31244
|
-
if (ctx) {
|
|
31245
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
31246
|
-
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
31247
|
-
}
|
|
31248
|
-
if (this.isCanvasLoopActive) {
|
|
31249
|
-
this.animationFrameId = requestAnimationFrame(draw);
|
|
31250
|
-
}
|
|
31251
|
-
};
|
|
31252
|
-
video.onplaying = () => {
|
|
31253
|
-
this.isCanvasLoopActive = true;
|
|
31254
|
-
draw();
|
|
31255
|
-
};
|
|
31256
|
-
const canvasStream = canvas.captureStream(30);
|
|
31257
|
-
originalStream.getAudioTracks().forEach((track2) => {
|
|
31258
|
-
canvasStream.addTrack(track2);
|
|
31259
|
-
});
|
|
31260
|
-
return canvasStream;
|
|
31261
|
-
}
|
|
31262
31240
|
};
|
|
31263
31241
|
|
|
31264
31242
|
// src/new-flow/checkers/DeviceCheckerUI.ts
|
|
@@ -32655,9 +32633,7 @@ var CapturePhoto = class {
|
|
|
32655
32633
|
);
|
|
32656
32634
|
await this.cameraRecorder.startRecording();
|
|
32657
32635
|
cameraContainer.srcObject = this.cameraRecorder.cameraStream;
|
|
32658
|
-
cameraContainer.play()
|
|
32659
|
-
console.warn("Autoplay bloqueado ou erro ao iniciar v\xEDdeo:", e3);
|
|
32660
|
-
});
|
|
32636
|
+
cameraContainer.play();
|
|
32661
32637
|
}
|
|
32662
32638
|
shot() {
|
|
32663
32639
|
const cameraContainer = document.querySelector("#cameraStream");
|
|
@@ -32750,9 +32726,6 @@ var CapturePhoto = class {
|
|
|
32750
32726
|
const video = document.createElement("video");
|
|
32751
32727
|
video.setAttribute("id", "cameraStream");
|
|
32752
32728
|
video.muted = true;
|
|
32753
|
-
video.setAttribute("playsinline", "true");
|
|
32754
|
-
video.setAttribute("webkit-playsinline", "true");
|
|
32755
|
-
video.autoplay = true;
|
|
32756
32729
|
divCamera.style.position = "fixed";
|
|
32757
32730
|
divCamera.style.top = "0";
|
|
32758
32731
|
divCamera.style.left = "0";
|
|
@@ -32939,8 +32912,8 @@ var CapturePhoto = class {
|
|
|
32939
32912
|
}
|
|
32940
32913
|
};
|
|
32941
32914
|
|
|
32942
|
-
// src/extension/
|
|
32943
|
-
var
|
|
32915
|
+
// src/extension/extension.ts
|
|
32916
|
+
var Extension = class {
|
|
32944
32917
|
constructor() {
|
|
32945
32918
|
this.hasExtension = false;
|
|
32946
32919
|
this.tryes = 0;
|
|
@@ -32985,89 +32958,6 @@ var ExtensionEasyProctor = class {
|
|
|
32985
32958
|
}
|
|
32986
32959
|
};
|
|
32987
32960
|
|
|
32988
|
-
// src/extension/extensionEasyCatcher.ts
|
|
32989
|
-
var ExtensionEasyCatcher = class {
|
|
32990
|
-
constructor(options) {
|
|
32991
|
-
this.hasExtension = false;
|
|
32992
|
-
this.tryes = 0;
|
|
32993
|
-
this.responseStart = false;
|
|
32994
|
-
this.options = options || {};
|
|
32995
|
-
}
|
|
32996
|
-
/**
|
|
32997
|
-
* Verifica se a extensão está instalada e ativa.
|
|
32998
|
-
* Retorna o número da versão se encontrada, ou lança erro após timeout.
|
|
32999
|
-
*/
|
|
33000
|
-
checkExtensionInstalled(timeoutMs = 2e3) {
|
|
33001
|
-
return new Promise((resolve, reject) => {
|
|
33002
|
-
let handled = false;
|
|
33003
|
-
const handler = (event) => {
|
|
33004
|
-
if (event.source === window && event.data.sender === "easyproctor-extension" && event.data.message_name === "version") {
|
|
33005
|
-
handled = true;
|
|
33006
|
-
window.removeEventListener("message", handler);
|
|
33007
|
-
resolve(event.data.message);
|
|
33008
|
-
}
|
|
33009
|
-
};
|
|
33010
|
-
window.addEventListener("message", handler);
|
|
33011
|
-
window.postMessage({
|
|
33012
|
-
type: "easycatcher",
|
|
33013
|
-
func: "verifyExtensionEasycatcher"
|
|
33014
|
-
}, "*");
|
|
33015
|
-
setTimeout(() => {
|
|
33016
|
-
if (!handled) {
|
|
33017
|
-
window.removeEventListener("message", handler);
|
|
33018
|
-
reject(new Error("Extens\xE3o n\xE3o detectada ou n\xE3o respondeu."));
|
|
33019
|
-
}
|
|
33020
|
-
}, timeoutMs);
|
|
33021
|
-
});
|
|
33022
|
-
}
|
|
33023
|
-
/**
|
|
33024
|
-
* Solicita o JSON da sessão atual capturado pela extensão.
|
|
33025
|
-
*/
|
|
33026
|
-
getSessionData(timeoutMs = 5e3) {
|
|
33027
|
-
return new Promise((resolve, reject) => {
|
|
33028
|
-
let handled = false;
|
|
33029
|
-
const handler = (event) => {
|
|
33030
|
-
if (event.source === window && event.data.sender === "easyproctor-extension" && event.data.message_name === "data_response") {
|
|
33031
|
-
handled = true;
|
|
33032
|
-
window.removeEventListener("message", handler);
|
|
33033
|
-
resolve(event.data.payload);
|
|
33034
|
-
}
|
|
33035
|
-
};
|
|
33036
|
-
window.addEventListener("message", handler);
|
|
33037
|
-
window.postMessage({
|
|
33038
|
-
type: "easycatcher",
|
|
33039
|
-
func: "getDataExtensionEasycatcher"
|
|
33040
|
-
}, "*");
|
|
33041
|
-
setTimeout(() => {
|
|
33042
|
-
if (!handled) {
|
|
33043
|
-
window.removeEventListener("message", handler);
|
|
33044
|
-
reject(new Error("Timeout ao aguardar dados da extens\xE3o."));
|
|
33045
|
-
}
|
|
33046
|
-
}, timeoutMs);
|
|
33047
|
-
});
|
|
33048
|
-
}
|
|
33049
|
-
start() {
|
|
33050
|
-
return new Promise((resolve, reject) => {
|
|
33051
|
-
let handled = false;
|
|
33052
|
-
const handler = (event) => {
|
|
33053
|
-
if (event.source === window && event.data.sender === "easyproctor-extension" && event.data.message_name === "started_confirmed") {
|
|
33054
|
-
handled = true;
|
|
33055
|
-
window.removeEventListener("message", handler);
|
|
33056
|
-
resolve(true);
|
|
33057
|
-
}
|
|
33058
|
-
};
|
|
33059
|
-
window.addEventListener("message", handler);
|
|
33060
|
-
window.postMessage({ type: "easycatcher", func: "startExtensionEasycatcher" }, "*");
|
|
33061
|
-
setTimeout(() => {
|
|
33062
|
-
if (!handled) {
|
|
33063
|
-
window.removeEventListener("message", handler);
|
|
33064
|
-
reject(new Error("Timeout: Extens\xE3o n\xE3o confirmou o in\xEDcio."));
|
|
33065
|
-
}
|
|
33066
|
-
}, 3e3);
|
|
33067
|
-
});
|
|
33068
|
-
}
|
|
33069
|
-
};
|
|
33070
|
-
|
|
33071
32961
|
// src/modules/onChangeDevices.ts
|
|
33072
32962
|
var onChangeDevices = class {
|
|
33073
32963
|
constructor(repositoryDevices, proctoringId2, sessionOptions, allRecorders) {
|
|
@@ -33504,7 +33394,7 @@ var AudioRecorder = class {
|
|
|
33504
33394
|
audio: { deviceId: this.options.microphoneId || "default" }
|
|
33505
33395
|
};
|
|
33506
33396
|
this.audioStream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
33507
|
-
const { startRecording, stopRecording, pauseRecording, resumeRecording } = recorder(this.audioStream, this.blobs, void 0, void 0, true);
|
|
33397
|
+
const { startRecording, stopRecording, pauseRecording, resumeRecording } = recorder(this.audioStream, this.blobs, null, void 0, void 0, true);
|
|
33508
33398
|
this.recordingStart = startRecording;
|
|
33509
33399
|
this.recordingStop = stopRecording;
|
|
33510
33400
|
this.recordingPause = pauseRecording;
|
|
@@ -36095,7 +35985,7 @@ var ScreenRecorder = class {
|
|
|
36095
35985
|
});
|
|
36096
35986
|
throw NOT_SHARED_SCREEN;
|
|
36097
35987
|
}
|
|
36098
|
-
const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs, this.options.onBufferSizeError, onBufferSizeErrorCallback);
|
|
35988
|
+
const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs, null, this.options.onBufferSizeError, onBufferSizeErrorCallback);
|
|
36099
35989
|
this.recordingStart = startRecording;
|
|
36100
35990
|
this.recordingStop = stopRecording;
|
|
36101
35991
|
this.recordingStart();
|
|
@@ -36317,7 +36207,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36317
36207
|
this.connection = null;
|
|
36318
36208
|
this.context = context;
|
|
36319
36209
|
this.onRealtimeAlertsCallback = onRealtimeAlertsCallback;
|
|
36320
|
-
console.log("context -> ", context);
|
|
36321
36210
|
this.backend = new BackendService({
|
|
36322
36211
|
type: (context == null ? void 0 : context.type) || "prod",
|
|
36323
36212
|
token: context.token
|
|
@@ -36331,7 +36220,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36331
36220
|
try {
|
|
36332
36221
|
this.transmissionOk = false;
|
|
36333
36222
|
const response = await this.backend.externalCameraCheckTransmission("" + this.externalSessionId);
|
|
36334
|
-
console.log(response);
|
|
36335
36223
|
let attempts = 0;
|
|
36336
36224
|
while (!this.transmissionOk && attempts <= 5) {
|
|
36337
36225
|
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
@@ -36348,16 +36236,13 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36348
36236
|
try {
|
|
36349
36237
|
this.proctoringId = proctoringId2;
|
|
36350
36238
|
const response = await this.backend.externalCameraStartTransmission("" + this.externalSessionId, proctoringId2);
|
|
36351
|
-
console.log(response);
|
|
36352
36239
|
} catch (error) {
|
|
36353
|
-
console.error("Erro ao iniciar transmiss\xE3o:", error);
|
|
36354
36240
|
throw new Error("N\xE3o foi poss\xEDvel iniciar a transmiss\xE3o.");
|
|
36355
36241
|
}
|
|
36356
36242
|
}
|
|
36357
36243
|
async goToPositionGuide() {
|
|
36358
36244
|
try {
|
|
36359
36245
|
const response = await this.backend.goToExternalCameraPositionStep("" + this.externalSessionId);
|
|
36360
|
-
console.log(response);
|
|
36361
36246
|
} catch (error) {
|
|
36362
36247
|
console.error("Erro ao enviar comando de Position:", error);
|
|
36363
36248
|
throw new Error("N\xE3o foi poss\xEDvel enviar comando de Position Guide.");
|
|
@@ -36367,7 +36252,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36367
36252
|
if (this.connection) {
|
|
36368
36253
|
const actionMessage = new ActionMessage();
|
|
36369
36254
|
actionMessage.command = "Reset";
|
|
36370
|
-
console.log("Enviando comando 'Reset' para o aplicativo...");
|
|
36371
36255
|
this.connection.invoke(
|
|
36372
36256
|
"SendAction",
|
|
36373
36257
|
this.externalSessionId,
|
|
@@ -36381,7 +36265,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36381
36265
|
this.onTakePictureCallback = onTakePictureCallback;
|
|
36382
36266
|
const actionMessage = new ActionMessage();
|
|
36383
36267
|
actionMessage.command = "Capture";
|
|
36384
|
-
console.log("Enviando comando 'Capture' para o aplicativo...");
|
|
36385
36268
|
this.connection.invoke(
|
|
36386
36269
|
"SendAction",
|
|
36387
36270
|
this.externalSessionId,
|
|
@@ -36400,7 +36283,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36400
36283
|
await this.reset();
|
|
36401
36284
|
const response = await this.backend.externalCameraStartSession();
|
|
36402
36285
|
this.externalSessionId = response.externalSessionId;
|
|
36403
|
-
console.log(this.externalSessionId);
|
|
36404
36286
|
this.currentStep = 0 /* STARTED */;
|
|
36405
36287
|
const pairingObject = {
|
|
36406
36288
|
externalSessionId: this.externalSessionId,
|
|
@@ -36409,7 +36291,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36409
36291
|
};
|
|
36410
36292
|
const pairingDataString = JSON.stringify(pairingObject);
|
|
36411
36293
|
this.qrCodeBase64Image = await import_qrcode.default.toDataURL(pairingDataString);
|
|
36412
|
-
console.log(this.qrCodeBase64Image);
|
|
36413
36294
|
return this.qrCodeBase64Image;
|
|
36414
36295
|
} catch (error) {
|
|
36415
36296
|
this.disconnectWebSocket();
|
|
@@ -36508,7 +36389,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36508
36389
|
var _a2;
|
|
36509
36390
|
const actionMessage = new ActionMessage();
|
|
36510
36391
|
actionMessage.command = "Cancel";
|
|
36511
|
-
console.log("Enviando comando 'Cancel' para o aplicativo...");
|
|
36512
36392
|
(_a2 = this.connection) == null ? void 0 : _a2.invoke(
|
|
36513
36393
|
"SendAction",
|
|
36514
36394
|
this.externalSessionId,
|
|
@@ -36848,8 +36728,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36848
36728
|
this.connection.on(
|
|
36849
36729
|
"ReceiveMessage",
|
|
36850
36730
|
(sessionId, messageStr) => {
|
|
36851
|
-
console.log("sessionId: ", sessionId);
|
|
36852
|
-
console.log("Message: ", messageStr);
|
|
36853
36731
|
if (sessionId !== this.externalSessionId) {
|
|
36854
36732
|
console.warn("Sess\xE3o diferente!");
|
|
36855
36733
|
return;
|
|
@@ -36857,7 +36735,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36857
36735
|
try {
|
|
36858
36736
|
const messageKey = messageStr;
|
|
36859
36737
|
const message = ExternalCameraStatusEnum[messageKey];
|
|
36860
|
-
console.log("Mensagem -> ", message);
|
|
36861
36738
|
this.handleWebSocketMessage(message);
|
|
36862
36739
|
} catch (e3) {
|
|
36863
36740
|
console.error("Erro ao processar mensagem do WebSocket:", e3);
|
|
@@ -36867,8 +36744,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36867
36744
|
this.connection.on(
|
|
36868
36745
|
"ReceiveAction",
|
|
36869
36746
|
(sessionId, actionMessage) => {
|
|
36870
|
-
console.log("sessionId: ", sessionId);
|
|
36871
|
-
console.log("Message: ", actionMessage);
|
|
36872
36747
|
if (sessionId !== this.externalSessionId) {
|
|
36873
36748
|
console.warn("Sess\xE3o diferente!");
|
|
36874
36749
|
return;
|
|
@@ -36882,7 +36757,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
36882
36757
|
);
|
|
36883
36758
|
try {
|
|
36884
36759
|
await this.connection.start();
|
|
36885
|
-
console.log("Conectado ao Hub SignalR com sucesso!");
|
|
36886
36760
|
} catch (err) {
|
|
36887
36761
|
console.error("Falha ao conectar ou entrar no grupo do SignalR: ", err);
|
|
36888
36762
|
throw new Error("N\xE3o foi poss\xEDvel conectar ao servi\xE7o em tempo real.");
|
|
@@ -37009,7 +36883,6 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
|
|
|
37009
36883
|
if (this.connection) {
|
|
37010
36884
|
try {
|
|
37011
36885
|
await this.connection.stop();
|
|
37012
|
-
console.log("Desconectado do SignalR.");
|
|
37013
36886
|
} catch (err) {
|
|
37014
36887
|
console.error("Erro ao desconectar do SignalR:", err);
|
|
37015
36888
|
} finally {
|
|
@@ -37043,7 +36916,6 @@ var Proctoring = class {
|
|
|
37043
36916
|
constructor(context) {
|
|
37044
36917
|
this.context = context;
|
|
37045
36918
|
this.deviceData = null;
|
|
37046
|
-
this.sessionStartTime = 0;
|
|
37047
36919
|
this.paramsConfig = {
|
|
37048
36920
|
audioBehaviourParameters: {
|
|
37049
36921
|
recordingBitrate: 128,
|
|
@@ -37267,7 +37139,10 @@ var Proctoring = class {
|
|
|
37267
37139
|
width: this.videoOptions.width,
|
|
37268
37140
|
height: this.videoOptions.height,
|
|
37269
37141
|
minWidth: this.videoOptions.minWidth,
|
|
37270
|
-
minHeight: this.videoOptions.minHeight
|
|
37142
|
+
minHeight: this.videoOptions.minHeight,
|
|
37143
|
+
timeSlice: this.videoOptions.timeSlice,
|
|
37144
|
+
videoBitsPerSecond: this.videoOptions.videoBitsPerSecond,
|
|
37145
|
+
mimeType: this.videoOptions.mimeType
|
|
37271
37146
|
},
|
|
37272
37147
|
this.paramsConfig,
|
|
37273
37148
|
this.backend,
|
|
@@ -37318,10 +37193,7 @@ var Proctoring = class {
|
|
|
37318
37193
|
if (this.context.token === void 0) {
|
|
37319
37194
|
throw TOKEN_MISSING;
|
|
37320
37195
|
}
|
|
37321
|
-
|
|
37322
|
-
this.extensionEasycatcher = new ExtensionEasyCatcher();
|
|
37323
|
-
}
|
|
37324
|
-
this.extension = new ExtensionEasyProctor();
|
|
37196
|
+
this.extension = new Extension();
|
|
37325
37197
|
this.extension.addEventListener();
|
|
37326
37198
|
const baseURL = this.backend.selectBaseUrl(this.context.type);
|
|
37327
37199
|
const devices = await enumarateDevices();
|
|
@@ -37370,7 +37242,6 @@ var Proctoring = class {
|
|
|
37370
37242
|
} catch (error) {
|
|
37371
37243
|
throw EXTERNAL_CAMERA_NOT_STARTED;
|
|
37372
37244
|
}
|
|
37373
|
-
this.sessionStartTime = Date.now();
|
|
37374
37245
|
this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
|
|
37375
37246
|
this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
|
|
37376
37247
|
this.proctoringSession.setProctoringId(this.proctoringId);
|
|
@@ -37546,7 +37417,6 @@ Upload Services: ${uploaderServices}`,
|
|
|
37546
37417
|
});
|
|
37547
37418
|
if (this.appChecker) {
|
|
37548
37419
|
const externalSessionId = this.appChecker.getExternalCameraSessionId();
|
|
37549
|
-
console.log("externalSessionId -> ", externalSessionId);
|
|
37550
37420
|
if (externalSessionId != "null") {
|
|
37551
37421
|
await this.backend.externalCameraFinish(externalSessionId);
|
|
37552
37422
|
}
|
|
@@ -37669,59 +37539,6 @@ Error: ` + error
|
|
|
37669
37539
|
_screenStream: (_a2 = this.allRecorders.screenRecorder) == null ? void 0 : _a2.screenStream
|
|
37670
37540
|
};
|
|
37671
37541
|
}
|
|
37672
|
-
async startChallenge(templateId) {
|
|
37673
|
-
if (!this.sessionOptions.useChallenge) {
|
|
37674
|
-
throw new Error("useChallenge is set as false on start method");
|
|
37675
|
-
}
|
|
37676
|
-
await this.extensionEasycatcher.checkExtensionInstalled().catch((err) => {
|
|
37677
|
-
throw new Error("EasyCatcher Extension is not installed");
|
|
37678
|
-
});
|
|
37679
|
-
this.extensionEasycatcher.start();
|
|
37680
|
-
const start = Date.now() - this.sessionStartTime;
|
|
37681
|
-
await this.backend.startChallenge({
|
|
37682
|
-
proctoringId: this.proctoringId,
|
|
37683
|
-
templateId,
|
|
37684
|
-
start
|
|
37685
|
-
}).then((resp) => {
|
|
37686
|
-
console.log(resp);
|
|
37687
|
-
this.challengeId = resp.id;
|
|
37688
|
-
}).catch((reason) => {
|
|
37689
|
-
trackers.registerError(
|
|
37690
|
-
this.proctoringId,
|
|
37691
|
-
"N\xE3o foi poss\xEDvel iniciar desafio!"
|
|
37692
|
-
);
|
|
37693
|
-
throw reason;
|
|
37694
|
-
});
|
|
37695
|
-
this.isChallengeRunning = true;
|
|
37696
|
-
}
|
|
37697
|
-
async stopChallenge() {
|
|
37698
|
-
if (!this.isChallengeRunning) {
|
|
37699
|
-
throw new Error("Challenge not started");
|
|
37700
|
-
}
|
|
37701
|
-
try {
|
|
37702
|
-
const sessionData = await this.extensionEasycatcher.getSessionData();
|
|
37703
|
-
const end = Date.now() - this.sessionStartTime;
|
|
37704
|
-
await this.backend.stopChallenge(
|
|
37705
|
-
this.challengeId,
|
|
37706
|
-
{
|
|
37707
|
-
end,
|
|
37708
|
-
data: sessionData
|
|
37709
|
-
}
|
|
37710
|
-
).catch((reason) => {
|
|
37711
|
-
trackers.registerError(
|
|
37712
|
-
this.proctoringId,
|
|
37713
|
-
"N\xE3o foi poss\xEDvel finalizar o desafio no backend!"
|
|
37714
|
-
);
|
|
37715
|
-
return void 0;
|
|
37716
|
-
});
|
|
37717
|
-
this.isChallengeRunning = false;
|
|
37718
|
-
} catch (error) {
|
|
37719
|
-
trackers.registerError(
|
|
37720
|
-
this.proctoringId,
|
|
37721
|
-
"Erro ao recuperar dados da extens\xE3o: " + error.message
|
|
37722
|
-
);
|
|
37723
|
-
}
|
|
37724
|
-
}
|
|
37725
37542
|
};
|
|
37726
37543
|
|
|
37727
37544
|
// src/proctoring/SignTerm.ts
|
|
@@ -37949,8 +37766,6 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
37949
37766
|
return originalStart(parameters2, videoOptions);
|
|
37950
37767
|
};
|
|
37951
37768
|
const finish = proctoring.finish.bind(proctoring);
|
|
37952
|
-
const startChallenge = proctoring.startChallenge.bind(proctoring);
|
|
37953
|
-
const stopChallenge = proctoring.stopChallenge.bind(proctoring);
|
|
37954
37769
|
const pause = proctoring.pause.bind(proctoring);
|
|
37955
37770
|
const resume = proctoring.resume.bind(proctoring);
|
|
37956
37771
|
const onFocus = proctoring.setOnFocusCallback.bind(proctoring);
|
|
@@ -37973,8 +37788,6 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
37973
37788
|
login,
|
|
37974
37789
|
start,
|
|
37975
37790
|
finish,
|
|
37976
|
-
startChallenge,
|
|
37977
|
-
stopChallenge,
|
|
37978
37791
|
onFocus,
|
|
37979
37792
|
onLostFocus,
|
|
37980
37793
|
onChangeDevices: onChangeDevices2,
|
package/package.json
CHANGED
package/plugins/recorder.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ProctoringVideoOptions } from "../proctoring/options/ProctoringVideoOptions";
|
|
1
2
|
export declare function setRecorderProctoringId(id: string): void;
|
|
2
|
-
export default function recorder(stream: MediaStream, buffer: Blob[], onBufferSizeError?: boolean, onBufferSizeErrorCallback?: (e?: any) => void, audio?: boolean): {
|
|
3
|
+
export default function recorder(stream: MediaStream, buffer: Blob[], videoOptions: ProctoringVideoOptions | null, onBufferSizeError?: boolean, onBufferSizeErrorCallback?: (e?: any) => void, audio?: boolean): {
|
|
3
4
|
startRecording: () => Promise<void>;
|
|
4
5
|
stopRecording: () => Promise<void>;
|
|
5
6
|
pauseRecording: () => Promise<void>;
|
|
@@ -3,6 +3,9 @@ export interface ProctoringVideoOptions {
|
|
|
3
3
|
height: number;
|
|
4
4
|
minWidth?: number;
|
|
5
5
|
minHeight?: number;
|
|
6
|
+
timeSlice?: number;
|
|
7
|
+
videoBitsPerSecond?: number;
|
|
8
|
+
mimeType?: string;
|
|
6
9
|
}
|
|
7
10
|
export declare function validatePartialVideoOptions(options: Partial<ProctoringVideoOptions>): ProctoringVideoOptions;
|
|
8
11
|
export declare const getDefaultProctoringVideoOptions: ProctoringVideoOptions;
|
|
@@ -41,9 +41,7 @@ export declare class Proctoring {
|
|
|
41
41
|
private readonly repository;
|
|
42
42
|
private readonly repositoryDevices;
|
|
43
43
|
private extension;
|
|
44
|
-
private extensionEasycatcher;
|
|
45
44
|
private deviceData;
|
|
46
|
-
private sessionStartTime;
|
|
47
45
|
private paramsConfig;
|
|
48
46
|
private proctoringId;
|
|
49
47
|
private insights?;
|
|
@@ -94,8 +92,4 @@ export declare class Proctoring {
|
|
|
94
92
|
audioStream?: MediaStream;
|
|
95
93
|
_screenStream: MediaStream | undefined;
|
|
96
94
|
}>;
|
|
97
|
-
private isChallengeRunning;
|
|
98
|
-
private challengeId;
|
|
99
|
-
startChallenge(templateId: string): Promise<void>;
|
|
100
|
-
stopChallenge(): Promise<void>;
|
|
101
95
|
}
|
|
@@ -5,8 +5,6 @@ export declare function useProctoring(proctoringOptions: ProctoringContext, envi
|
|
|
5
5
|
login: () => Promise<void>;
|
|
6
6
|
start: (parameters: any, videoOptions: any) => Promise<import("../dtos/StartProctoringResponse").default>;
|
|
7
7
|
finish: (options?: import("./proctoring").ProctoringFinisherOptions) => Promise<void>;
|
|
8
|
-
startChallenge: (templateId: string) => Promise<void>;
|
|
9
|
-
stopChallenge: () => Promise<void>;
|
|
10
8
|
onFocus: (cb: () => void) => Promise<void>;
|
|
11
9
|
onLostFocus: (cb: () => void) => Promise<void>;
|
|
12
10
|
onChangeDevices: (options?: import("./proctoring").ProctoringChangeDevicesOptions) => Promise<void>;
|