easyproctor 2.1.1 → 2.2.0
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 +6 -0
- package/errors/errors.d.ts +1 -0
- package/esm/index.js +817 -148
- package/index.js +817 -148
- package/interfaces/ParamsConfig.d.ts +3 -0
- package/modules/SpyCam.d.ts +31 -0
- package/new-flow/backend/BackendService.d.ts +3 -1
- package/new-flow/backend/SpyCamBackendService.d.ts +27 -0
- package/new-flow/checkers/DeviceCheckerService.d.ts +5 -0
- package/new-flow/checkers/DeviceCheckerUI.d.ts +2 -0
- package/new-flow/proctoring/ProctoringSession.d.ts +12 -2
- package/new-flow/recorders/CameraRecorder.d.ts +6 -2
- package/new-flow/recorders/IRecorder.d.ts +3 -1
- package/package.json +2 -2
- package/plugins/insights.d.ts +1 -2
- package/plugins/recorder.d.ts +3 -2
- package/proctoring/SignTerm.d.ts +15 -0
- package/proctoring/options/ProctoringOptions.d.ts +1 -0
- package/proctoring/proctoring.d.ts +2 -1
- package/proctoring/useProctoring.d.ts +2 -1
- package/unpkg/easyproctor.min.js +28 -28
package/esm/index.js
CHANGED
|
@@ -4510,40 +4510,6 @@ var FaceDetection = class extends BaseDetection {
|
|
|
4510
4510
|
}
|
|
4511
4511
|
};
|
|
4512
4512
|
|
|
4513
|
-
// src/proctoring/options/ProctoringOptions.ts
|
|
4514
|
-
var getDefaultProctoringOptions = {
|
|
4515
|
-
cameraId: void 0,
|
|
4516
|
-
microphoneId: void 0,
|
|
4517
|
-
allowMultipleMonitors: false,
|
|
4518
|
-
allowOnlyFirstMonitor: true,
|
|
4519
|
-
captureScreen: true,
|
|
4520
|
-
noiseLimit: 40,
|
|
4521
|
-
proctoringType: "IMAGE",
|
|
4522
|
-
insights: "",
|
|
4523
|
-
onBufferSizeError: false,
|
|
4524
|
-
useGeolocation: false
|
|
4525
|
-
};
|
|
4526
|
-
|
|
4527
|
-
// src/proctoring/options/ProctoringVideoOptions.ts
|
|
4528
|
-
function validatePartialVideoOptions(options) {
|
|
4529
|
-
if (!!options.width && !!options.height) {
|
|
4530
|
-
return {
|
|
4531
|
-
width: options.width,
|
|
4532
|
-
height: options.height,
|
|
4533
|
-
minWidth: options.minWidth,
|
|
4534
|
-
minHeight: options.minHeight
|
|
4535
|
-
};
|
|
4536
|
-
} else {
|
|
4537
|
-
return { width: 640, height: 480 };
|
|
4538
|
-
}
|
|
4539
|
-
}
|
|
4540
|
-
var getDefaultProctoringVideoOptions = {
|
|
4541
|
-
width: 1280,
|
|
4542
|
-
height: 720,
|
|
4543
|
-
minWidth: 640,
|
|
4544
|
-
minHeight: 480
|
|
4545
|
-
};
|
|
4546
|
-
|
|
4547
4513
|
// node_modules/axios/lib/helpers/bind.js
|
|
4548
4514
|
function bind(fn3, thisArg) {
|
|
4549
4515
|
return function wrap() {
|
|
@@ -6641,21 +6607,21 @@ var BackendService = class {
|
|
|
6641
6607
|
});
|
|
6642
6608
|
return url.data;
|
|
6643
6609
|
}
|
|
6644
|
-
async getSignedUrl(token, file,
|
|
6610
|
+
async getSignedUrl(token, file, proctoringId2) {
|
|
6645
6611
|
const url = await this.makeRequestAxios({
|
|
6646
6612
|
path: `/upload/signed-url`,
|
|
6647
6613
|
method: "POST",
|
|
6648
6614
|
jwt: token,
|
|
6649
6615
|
body: {
|
|
6650
|
-
objectName: `${
|
|
6616
|
+
objectName: `${proctoringId2}/${file.name}`,
|
|
6651
6617
|
contentType: file.type
|
|
6652
6618
|
}
|
|
6653
6619
|
});
|
|
6654
6620
|
return url.data;
|
|
6655
6621
|
}
|
|
6656
|
-
async
|
|
6622
|
+
async saveAlerts(proctoringOptions, proctoringSession) {
|
|
6657
6623
|
await this.makeRequest({
|
|
6658
|
-
path: "/proctoring/save-
|
|
6624
|
+
path: "/proctoring/save-alerts",
|
|
6659
6625
|
method: "POST",
|
|
6660
6626
|
jwt: proctoringOptions.token,
|
|
6661
6627
|
body: {
|
|
@@ -6695,6 +6661,22 @@ var BackendService = class {
|
|
|
6695
6661
|
jwt: this.token
|
|
6696
6662
|
});
|
|
6697
6663
|
}
|
|
6664
|
+
async signTerm() {
|
|
6665
|
+
return await this.makeRequest({
|
|
6666
|
+
path: `/User/sign-terms`,
|
|
6667
|
+
method: "PATCH",
|
|
6668
|
+
body: {},
|
|
6669
|
+
jwt: this.token
|
|
6670
|
+
});
|
|
6671
|
+
}
|
|
6672
|
+
async signTermUrl() {
|
|
6673
|
+
const result = await this.makeRequestAxios({
|
|
6674
|
+
path: `/User/sign-terms-url`,
|
|
6675
|
+
method: "GET",
|
|
6676
|
+
jwt: this.token
|
|
6677
|
+
});
|
|
6678
|
+
return result.data;
|
|
6679
|
+
}
|
|
6698
6680
|
async getServerHour(token) {
|
|
6699
6681
|
return await this.makeRequest({
|
|
6700
6682
|
path: `/Proctoring/server-hour`,
|
|
@@ -6762,6 +6744,77 @@ var BackendService = class {
|
|
|
6762
6744
|
}
|
|
6763
6745
|
};
|
|
6764
6746
|
|
|
6747
|
+
// src/new-flow/backend/SpyCamBackendService.ts
|
|
6748
|
+
var SpyCamBackendService = class {
|
|
6749
|
+
constructor() {
|
|
6750
|
+
this.baseUrl = "https://localhost:5080";
|
|
6751
|
+
}
|
|
6752
|
+
async isAlive() {
|
|
6753
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
6754
|
+
path: `/api/usb-device-manager/is-alive`,
|
|
6755
|
+
method: "GET",
|
|
6756
|
+
jwt: this.token
|
|
6757
|
+
}).catch((error) => {
|
|
6758
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
6759
|
+
});
|
|
6760
|
+
return paramsConfig.data;
|
|
6761
|
+
}
|
|
6762
|
+
async isPluggedIn() {
|
|
6763
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
6764
|
+
path: `/api/usb-device-manager/is-plugged-in`,
|
|
6765
|
+
method: "GET",
|
|
6766
|
+
jwt: this.token
|
|
6767
|
+
}).catch((error) => {
|
|
6768
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
6769
|
+
});
|
|
6770
|
+
return paramsConfig.data;
|
|
6771
|
+
}
|
|
6772
|
+
async ConnectAndScan() {
|
|
6773
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
6774
|
+
path: `/api/usb-device-manager/connect-and-scan`,
|
|
6775
|
+
method: "GET",
|
|
6776
|
+
jwt: this.token
|
|
6777
|
+
}).catch((error) => {
|
|
6778
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
6779
|
+
});
|
|
6780
|
+
return paramsConfig.data;
|
|
6781
|
+
}
|
|
6782
|
+
async Devices({
|
|
6783
|
+
deviceType,
|
|
6784
|
+
rssiThreshold,
|
|
6785
|
+
packageRateThreshold
|
|
6786
|
+
}) {
|
|
6787
|
+
const queryParams = [];
|
|
6788
|
+
deviceType && queryParams.push(`deviceType=${deviceType}`);
|
|
6789
|
+
rssiThreshold && queryParams.push(`rssiThreshold=${rssiThreshold}`);
|
|
6790
|
+
packageRateThreshold && queryParams.push(`packageRateThreshold=${packageRateThreshold}`);
|
|
6791
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
6792
|
+
path: `/api/usb-device-manager/devices?${queryParams.join("&")}`,
|
|
6793
|
+
method: "GET",
|
|
6794
|
+
jwt: this.token
|
|
6795
|
+
}).catch((error) => {
|
|
6796
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
6797
|
+
});
|
|
6798
|
+
return paramsConfig.data;
|
|
6799
|
+
}
|
|
6800
|
+
async makeRequestAxios(data) {
|
|
6801
|
+
const { path, method, body, jwt } = data;
|
|
6802
|
+
const resp = await axios_default.request({
|
|
6803
|
+
url: this.baseUrl + path,
|
|
6804
|
+
method,
|
|
6805
|
+
headers: {
|
|
6806
|
+
Authorization: `Bearer ${jwt}`,
|
|
6807
|
+
"Access-Control-Allow-Origin": "*"
|
|
6808
|
+
},
|
|
6809
|
+
data: body
|
|
6810
|
+
});
|
|
6811
|
+
if (resp.status >= 400) {
|
|
6812
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
6813
|
+
}
|
|
6814
|
+
return resp;
|
|
6815
|
+
}
|
|
6816
|
+
};
|
|
6817
|
+
|
|
6765
6818
|
// src/new-flow/proctoring/ProctoringSession.ts
|
|
6766
6819
|
var ProctoringSession = class {
|
|
6767
6820
|
constructor() {
|
|
@@ -6793,8 +6846,8 @@ var ProctoringSession = class {
|
|
|
6793
6846
|
this.state = "Ended" /* Ended */;
|
|
6794
6847
|
this.sessionDuration = Date.now() - this.startedAt.getTime();
|
|
6795
6848
|
}
|
|
6796
|
-
setProctoringId(
|
|
6797
|
-
this.id =
|
|
6849
|
+
setProctoringId(proctoringId2) {
|
|
6850
|
+
this.id = proctoringId2;
|
|
6798
6851
|
}
|
|
6799
6852
|
setEndConfirmed() {
|
|
6800
6853
|
this.state = "EndConfirmed" /* EndConfirmed */;
|
|
@@ -6813,6 +6866,164 @@ var ProctoringSession = class {
|
|
|
6813
6866
|
}
|
|
6814
6867
|
};
|
|
6815
6868
|
|
|
6869
|
+
// src/modules/SpyCam.ts
|
|
6870
|
+
var SpyCam = class {
|
|
6871
|
+
constructor(context, options) {
|
|
6872
|
+
this.backendService = new SpyCamBackendService();
|
|
6873
|
+
this.scanInterval = 5;
|
|
6874
|
+
this.options = {};
|
|
6875
|
+
this.options = options;
|
|
6876
|
+
this.context = context;
|
|
6877
|
+
this.backend = new BackendService({
|
|
6878
|
+
type: (context == null ? void 0 : context.type) || "prod",
|
|
6879
|
+
token: context.token
|
|
6880
|
+
});
|
|
6881
|
+
this.currentIsPlugged = true;
|
|
6882
|
+
}
|
|
6883
|
+
setProctoringId(proctoringId2) {
|
|
6884
|
+
this.proctoringId = proctoringId2;
|
|
6885
|
+
}
|
|
6886
|
+
async isPluggedIn(sendEvent = false) {
|
|
6887
|
+
var _a2, _b, _c2, _d;
|
|
6888
|
+
try {
|
|
6889
|
+
const isPlugged = await this.backendService.isPluggedIn();
|
|
6890
|
+
if (this.proctoringId && sendEvent) {
|
|
6891
|
+
if (isPlugged) {
|
|
6892
|
+
if (!this.currentIsPlugged) {
|
|
6893
|
+
(_b = (_a2 = this.options).onRealtimeAlertsCallback) == null ? void 0 : _b.call(_a2, {
|
|
6894
|
+
type: "spycam",
|
|
6895
|
+
message: "Spycam disconnected",
|
|
6896
|
+
description: "Dispositivo de varredura conectado.",
|
|
6897
|
+
status: "OK"
|
|
6898
|
+
});
|
|
6899
|
+
}
|
|
6900
|
+
} else {
|
|
6901
|
+
const session = new ProctoringSession();
|
|
6902
|
+
session.setProctoringId(this.proctoringId);
|
|
6903
|
+
session.addAlert({
|
|
6904
|
+
begin: Date.now() - this.startTime.getTime(),
|
|
6905
|
+
end: 0,
|
|
6906
|
+
alert: 33 /* SpyDeviceDisconnected */,
|
|
6907
|
+
type: 5 /* Environment */
|
|
6908
|
+
});
|
|
6909
|
+
await this.backend.saveAlerts(this.context, session);
|
|
6910
|
+
(_d = (_c2 = this.options).onRealtimeAlertsCallback) == null ? void 0 : _d.call(_c2, {
|
|
6911
|
+
type: "spycam",
|
|
6912
|
+
message: "Spycam disconnected",
|
|
6913
|
+
description: "Nenhum dispositivo de varredura conectado.",
|
|
6914
|
+
status: "ALERT"
|
|
6915
|
+
});
|
|
6916
|
+
}
|
|
6917
|
+
}
|
|
6918
|
+
this.currentIsPlugged = isPlugged;
|
|
6919
|
+
return this.currentIsPlugged;
|
|
6920
|
+
} catch (error) {
|
|
6921
|
+
throw error;
|
|
6922
|
+
}
|
|
6923
|
+
}
|
|
6924
|
+
async isAlive() {
|
|
6925
|
+
try {
|
|
6926
|
+
return await this.backendService.isAlive();
|
|
6927
|
+
} catch (error) {
|
|
6928
|
+
throw error;
|
|
6929
|
+
}
|
|
6930
|
+
}
|
|
6931
|
+
connectAndScan() {
|
|
6932
|
+
return this.backendService.ConnectAndScan();
|
|
6933
|
+
}
|
|
6934
|
+
async devices({
|
|
6935
|
+
deviceType,
|
|
6936
|
+
rssiThreshold,
|
|
6937
|
+
packageRateThreshold
|
|
6938
|
+
}) {
|
|
6939
|
+
var _a2, _b;
|
|
6940
|
+
const devices = await this.backendService.Devices(
|
|
6941
|
+
{
|
|
6942
|
+
deviceType,
|
|
6943
|
+
rssiThreshold,
|
|
6944
|
+
packageRateThreshold
|
|
6945
|
+
}
|
|
6946
|
+
);
|
|
6947
|
+
if (devices.length > 0) {
|
|
6948
|
+
(_b = (_a2 = this.options).onRealtimeAlertsCallback) == null ? void 0 : _b.call(_a2, {
|
|
6949
|
+
type: "spycam",
|
|
6950
|
+
message: "Spycam detected",
|
|
6951
|
+
description: "Dispositivo espi\xE3o detectado.",
|
|
6952
|
+
data: devices
|
|
6953
|
+
});
|
|
6954
|
+
if (this.proctoringId) {
|
|
6955
|
+
const session = new ProctoringSession();
|
|
6956
|
+
session.setProctoringId(this.proctoringId);
|
|
6957
|
+
session.addAlert({
|
|
6958
|
+
begin: Date.now() - this.startTime.getTime(),
|
|
6959
|
+
end: 0,
|
|
6960
|
+
alert: 32 /* PotentialCamera */,
|
|
6961
|
+
type: 5 /* Environment */
|
|
6962
|
+
});
|
|
6963
|
+
await this.backend.saveAlerts(this.context, session);
|
|
6964
|
+
}
|
|
6965
|
+
}
|
|
6966
|
+
return devices;
|
|
6967
|
+
}
|
|
6968
|
+
async startCheckSpyCam(spyScanInterval, {
|
|
6969
|
+
deviceType,
|
|
6970
|
+
rssiThreshold,
|
|
6971
|
+
packageRateThreshold
|
|
6972
|
+
}) {
|
|
6973
|
+
this.scanInterval = spyScanInterval;
|
|
6974
|
+
this.startTime = new Date(Date.now());
|
|
6975
|
+
await this.isPluggedIn(true);
|
|
6976
|
+
this.checkSpyCam = setInterval(async () => {
|
|
6977
|
+
const isPlugged = await this.isPluggedIn(true);
|
|
6978
|
+
if (isPlugged) {
|
|
6979
|
+
await this.devices({
|
|
6980
|
+
deviceType,
|
|
6981
|
+
rssiThreshold,
|
|
6982
|
+
packageRateThreshold
|
|
6983
|
+
});
|
|
6984
|
+
}
|
|
6985
|
+
}, this.scanInterval * 6e4);
|
|
6986
|
+
}
|
|
6987
|
+
stopCheckSpyCam() {
|
|
6988
|
+
clearInterval(this.checkSpyCam);
|
|
6989
|
+
}
|
|
6990
|
+
};
|
|
6991
|
+
|
|
6992
|
+
// src/proctoring/options/ProctoringOptions.ts
|
|
6993
|
+
var getDefaultProctoringOptions = {
|
|
6994
|
+
cameraId: void 0,
|
|
6995
|
+
microphoneId: void 0,
|
|
6996
|
+
allowMultipleMonitors: false,
|
|
6997
|
+
allowOnlyFirstMonitor: true,
|
|
6998
|
+
captureScreen: true,
|
|
6999
|
+
noiseLimit: 40,
|
|
7000
|
+
proctoringType: "IMAGE",
|
|
7001
|
+
insights: "",
|
|
7002
|
+
onBufferSizeError: false,
|
|
7003
|
+
useGeolocation: false,
|
|
7004
|
+
useSpyScan: false
|
|
7005
|
+
};
|
|
7006
|
+
|
|
7007
|
+
// src/proctoring/options/ProctoringVideoOptions.ts
|
|
7008
|
+
function validatePartialVideoOptions(options) {
|
|
7009
|
+
if (!!options.width && !!options.height) {
|
|
7010
|
+
return {
|
|
7011
|
+
width: options.width,
|
|
7012
|
+
height: options.height,
|
|
7013
|
+
minWidth: options.minWidth,
|
|
7014
|
+
minHeight: options.minHeight
|
|
7015
|
+
};
|
|
7016
|
+
} else {
|
|
7017
|
+
return { width: 640, height: 480 };
|
|
7018
|
+
}
|
|
7019
|
+
}
|
|
7020
|
+
var getDefaultProctoringVideoOptions = {
|
|
7021
|
+
width: 1280,
|
|
7022
|
+
height: 720,
|
|
7023
|
+
minWidth: 640,
|
|
7024
|
+
minHeight: 480
|
|
7025
|
+
};
|
|
7026
|
+
|
|
6816
7027
|
// src/plugins/insights.ts
|
|
6817
7028
|
var backendService;
|
|
6818
7029
|
var init = (backend) => {
|
|
@@ -6823,55 +7034,65 @@ var eventNames = {
|
|
|
6823
7034
|
START: "start",
|
|
6824
7035
|
FINISH: "finish",
|
|
6825
7036
|
ERROR: "error",
|
|
6826
|
-
|
|
7037
|
+
UPLOAD: "upload",
|
|
7038
|
+
UPLOAD_FILE: "upload_file",
|
|
6827
7039
|
DOWNLOAD_VIDEO: "download_video",
|
|
6828
7040
|
BUFFER_SIZE: "buffer_size",
|
|
6829
7041
|
ANOTHER_STREAM: "another_stream",
|
|
7042
|
+
CHANGE_DEVICE: "change_device",
|
|
7043
|
+
STOP_SHARING_SCREEN: "stop_sharing_screen",
|
|
7044
|
+
ERROR_RECORDER_RTC: "error_recorder_rtc",
|
|
6830
7045
|
BROWSER_NOT_SUPPORTED: "browser_not_supported",
|
|
6831
7046
|
SAVE_ON_SESSION: "save_on_session"
|
|
6832
7047
|
};
|
|
6833
7048
|
var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
|
|
6834
7049
|
var trackers = {
|
|
6835
|
-
registerStart: (
|
|
6836
|
-
registerFinish: (
|
|
6837
|
-
registerError: (
|
|
6838
|
-
registerBrowserNotSupported: (
|
|
6839
|
-
registerUpload: (
|
|
6840
|
-
registerUploadFile: (
|
|
6841
|
-
registerChangeDevice: (
|
|
6842
|
-
registerStopSharingScreen: (
|
|
6843
|
-
registerErrorRecorderRTC: (
|
|
6844
|
-
registerDownloadFile: (
|
|
6845
|
-
registerOnBufferSizeError: (
|
|
6846
|
-
registerAnotherStream: (
|
|
6847
|
-
registerSaveOnSession: (
|
|
7050
|
+
registerStart: (proctoringId2, success, description) => log(eventNames.START, { proctoringId: proctoringId2, success, description }),
|
|
7051
|
+
registerFinish: (proctoringId2, success, description) => log(eventNames.FINISH, { proctoringId: proctoringId2, success, description }),
|
|
7052
|
+
registerError: (proctoringId2, description) => log(eventNames.ERROR, { proctoringId: proctoringId2, description }),
|
|
7053
|
+
registerBrowserNotSupported: (proctoringId2, description) => log(eventNames.BROWSER_NOT_SUPPORTED, { proctoringId: proctoringId2, description }),
|
|
7054
|
+
registerUpload: (proctoringId2, success, description, serviceType, uploadTime) => log(eventNames.UPLOAD, { proctoringId: proctoringId2, success, description, serviceType, uploadTime }),
|
|
7055
|
+
registerUploadFile: (proctoringId2, description, fileType) => log(eventNames.UPLOAD_FILE, { proctoringId: proctoringId2, description, fileType }),
|
|
7056
|
+
registerChangeDevice: (proctoringId2, inOrOut, description) => log(eventNames.CHANGE_DEVICE, { proctoringId: proctoringId2, inOrOut, description }),
|
|
7057
|
+
registerStopSharingScreen: (proctoringId2, description) => log(eventNames.STOP_SHARING_SCREEN, { proctoringId: proctoringId2, description }),
|
|
7058
|
+
registerErrorRecorderRTC: (proctoringId2, description) => log(eventNames.ERROR_RECORDER_RTC, { proctoringId: proctoringId2, description }),
|
|
7059
|
+
registerDownloadFile: (proctoringId2, description) => log(eventNames.DOWNLOAD_VIDEO, { proctoringId: proctoringId2, description }),
|
|
7060
|
+
registerOnBufferSizeError: (proctoringId2, description) => log(eventNames.BUFFER_SIZE, { proctoringId: proctoringId2, description }),
|
|
7061
|
+
registerAnotherStream: (proctoringId2, description) => log(eventNames.ANOTHER_STREAM, { proctoringId: proctoringId2, description }),
|
|
7062
|
+
registerSaveOnSession: (proctoringId2, description) => log(eventNames.SAVE_ON_SESSION, { proctoringId: proctoringId2, description })
|
|
6848
7063
|
};
|
|
6849
7064
|
|
|
6850
7065
|
// src/plugins/recorder.ts
|
|
6851
|
-
|
|
7066
|
+
var proctoringId;
|
|
7067
|
+
function setRecorderProctoringId(id) {
|
|
7068
|
+
proctoringId = id;
|
|
7069
|
+
}
|
|
7070
|
+
function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCallback, audio = false) {
|
|
6852
7071
|
let resolvePromise;
|
|
6853
7072
|
let stopped = false;
|
|
6854
7073
|
let onBufferSizeInterval;
|
|
6855
7074
|
let lastEvent;
|
|
6856
7075
|
let bufferSize;
|
|
6857
7076
|
bufferSize = 0;
|
|
6858
|
-
let
|
|
7077
|
+
let recorderOptions = {
|
|
6859
7078
|
mimeType: "video/webm",
|
|
6860
7079
|
videoBitsPerSecond: 128e3,
|
|
6861
7080
|
audioBitsPerSecond: 64 * 1e3
|
|
6862
7081
|
};
|
|
6863
7082
|
if (MediaRecorder.isTypeSupported("video/webm;codecs=vp9")) {
|
|
6864
|
-
|
|
7083
|
+
recorderOptions.mimeType = "video/webm;codecs=vp9";
|
|
6865
7084
|
} else {
|
|
6866
|
-
console.warn(
|
|
7085
|
+
console.warn(
|
|
7086
|
+
"vp9 codec not supported. Using default mimeType without vp9."
|
|
7087
|
+
);
|
|
6867
7088
|
}
|
|
6868
7089
|
if (audio) {
|
|
6869
|
-
|
|
7090
|
+
recorderOptions = {
|
|
6870
7091
|
mimeType: "audio/webm",
|
|
6871
7092
|
audioBitsPerSecond: 64 * 1e3
|
|
6872
7093
|
};
|
|
6873
7094
|
}
|
|
6874
|
-
const mediaRecorder = new MediaRecorder(stream,
|
|
7095
|
+
const mediaRecorder = new MediaRecorder(stream, recorderOptions);
|
|
6875
7096
|
mediaRecorder.ondataavailable = (e3) => {
|
|
6876
7097
|
bufferSize = bufferSize + e3.data.size;
|
|
6877
7098
|
if (e3.data.size > 0) {
|
|
@@ -6879,9 +7100,15 @@ function recorder(stream, buffer, proctoringId, onBufferSizeError = false, onBuf
|
|
|
6879
7100
|
}
|
|
6880
7101
|
if (!stopped) {
|
|
6881
7102
|
if (lastEvent && e3.data.size === lastEvent.data.size || e3.data.size === 0) {
|
|
7103
|
+
proctoringId && lastEvent && e3.data.size === lastEvent.data.size && trackers.registerOnBufferSizeError(
|
|
7104
|
+
proctoringId,
|
|
7105
|
+
`onBufferSizeError: Recorder size freezed: ${e3.data.size} Mb`
|
|
7106
|
+
);
|
|
7107
|
+
proctoringId && e3.data.size === 0 && trackers.registerOnBufferSizeError(
|
|
7108
|
+
proctoringId,
|
|
7109
|
+
`onBufferSizeError: Recorder size equal 0 Mb`
|
|
7110
|
+
);
|
|
6882
7111
|
onBufferSizeErrorCallback && onBufferSizeErrorCallback();
|
|
6883
|
-
proctoringId && lastEvent && e3.data.size === lastEvent.data.size && trackers.registerOnBufferSizeError(proctoringId, `onBufferSizeError: Recorder size freezed: ${e3.data.size} Mb`);
|
|
6884
|
-
proctoringId && e3.data.size === 0 && trackers.registerOnBufferSizeError(proctoringId, `onBufferSizeError: Recorder size equal 0 Mb`);
|
|
6885
7112
|
}
|
|
6886
7113
|
lastEvent = e3;
|
|
6887
7114
|
} else {
|
|
@@ -6943,17 +7170,24 @@ function recorder(stream, buffer, proctoringId, onBufferSizeError = false, onBuf
|
|
|
6943
7170
|
function getBufferSize() {
|
|
6944
7171
|
return bufferSize;
|
|
6945
7172
|
}
|
|
6946
|
-
return {
|
|
7173
|
+
return {
|
|
7174
|
+
startRecording,
|
|
7175
|
+
stopRecording,
|
|
7176
|
+
pauseRecording,
|
|
7177
|
+
resumeRecording,
|
|
7178
|
+
recorderOptions,
|
|
7179
|
+
getBufferSize
|
|
7180
|
+
};
|
|
6947
7181
|
}
|
|
6948
7182
|
|
|
6949
7183
|
// src/new-flow/upload/UploadService.ts
|
|
6950
7184
|
var UploadService = class {
|
|
6951
|
-
constructor(
|
|
7185
|
+
constructor(proctoringId2, backend) {
|
|
6952
7186
|
this.backend = backend;
|
|
6953
7187
|
this.imageUrlPackage = [];
|
|
6954
7188
|
this.imageBatchNum = 0;
|
|
6955
7189
|
this.contImages = 0;
|
|
6956
|
-
this.proctoringId =
|
|
7190
|
+
this.proctoringId = proctoringId2;
|
|
6957
7191
|
}
|
|
6958
7192
|
async uploadImages(data, token, packSize) {
|
|
6959
7193
|
const { file, onProgress } = data;
|
|
@@ -7095,6 +7329,7 @@ var STREAM_UNDER_MINIMUM_PERMITTED = "stream_under_minimum_permitted";
|
|
|
7095
7329
|
var BROWSER_NOT_SUPPORTED = "browser_not_supported";
|
|
7096
7330
|
var TOKEN_MISSING = "token_missing";
|
|
7097
7331
|
var CREDENTIALS_MISSING = "credentials_missing";
|
|
7332
|
+
var SPY_SCAN_API_NOT_FOUND = "spy_scan_api_not_found";
|
|
7098
7333
|
|
|
7099
7334
|
// src/modules/objectDetection.ts
|
|
7100
7335
|
var ObjectDetection = class extends BaseDetection {
|
|
@@ -7252,7 +7487,7 @@ var CameraRecorder = class {
|
|
|
7252
7487
|
cameraId: void 0,
|
|
7253
7488
|
microphoneId: void 0,
|
|
7254
7489
|
onBufferSizeError: false,
|
|
7255
|
-
onBufferSizeErrorCallback: () => {
|
|
7490
|
+
onBufferSizeErrorCallback: (cameraStream) => {
|
|
7256
7491
|
},
|
|
7257
7492
|
proctoringType: "IMAGE",
|
|
7258
7493
|
onChangeDevicesCallback: (devices) => {
|
|
@@ -7269,6 +7504,7 @@ var CameraRecorder = class {
|
|
|
7269
7504
|
this.blobsRTC = [];
|
|
7270
7505
|
this.imageCount = 0;
|
|
7271
7506
|
this.filesToUpload = [];
|
|
7507
|
+
this.currentRetries = 0;
|
|
7272
7508
|
this.noiseWait = 20;
|
|
7273
7509
|
this.options = options;
|
|
7274
7510
|
this.videoOptions = videoOptions;
|
|
@@ -7276,19 +7512,30 @@ var CameraRecorder = class {
|
|
|
7276
7512
|
this.backendToken = backendToken;
|
|
7277
7513
|
paramsConfig && (this.paramsConfig = paramsConfig);
|
|
7278
7514
|
}
|
|
7279
|
-
setProctoringId(
|
|
7280
|
-
this.proctoringId =
|
|
7515
|
+
setProctoringId(proctoringId2) {
|
|
7516
|
+
this.proctoringId = proctoringId2;
|
|
7281
7517
|
this.proctoringId && this.backend && (this.upload = new UploadService(this.proctoringId, this.backend));
|
|
7518
|
+
setRecorderProctoringId(proctoringId2);
|
|
7282
7519
|
}
|
|
7283
7520
|
async initializeDetectors() {
|
|
7284
7521
|
var _a2, _b, _c2;
|
|
7285
7522
|
buildVideoPreview();
|
|
7286
7523
|
if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone)) {
|
|
7287
|
-
this.objectDetection = new ObjectDetection(
|
|
7524
|
+
this.objectDetection = new ObjectDetection(
|
|
7525
|
+
{
|
|
7526
|
+
onRealtimeAlertsCallback: (response) => this.options.onRealtimeAlertsCallback(response)
|
|
7527
|
+
},
|
|
7528
|
+
this.paramsConfig
|
|
7529
|
+
);
|
|
7288
7530
|
await this.objectDetection.initializeDetector();
|
|
7289
7531
|
}
|
|
7290
7532
|
if ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace) {
|
|
7291
|
-
this.faceDetection = new FaceDetection(
|
|
7533
|
+
this.faceDetection = new FaceDetection(
|
|
7534
|
+
{
|
|
7535
|
+
onRealtimeAlertsCallback: (response) => this.options.onRealtimeAlertsCallback(response)
|
|
7536
|
+
},
|
|
7537
|
+
this.paramsConfig
|
|
7538
|
+
);
|
|
7292
7539
|
await this.faceDetection.initializeDetector();
|
|
7293
7540
|
}
|
|
7294
7541
|
}
|
|
@@ -7301,9 +7548,25 @@ var CameraRecorder = class {
|
|
|
7301
7548
|
this.canvas.width = this.videoOptions.width;
|
|
7302
7549
|
this.canvas.height = this.videoOptions.height;
|
|
7303
7550
|
}
|
|
7304
|
-
async
|
|
7551
|
+
async bufferError(e3) {
|
|
7552
|
+
var _a2, _b;
|
|
7553
|
+
console.log("buffer error Camera Recorder params " + this.paramsConfig.videoBehaviourParameters);
|
|
7554
|
+
const retryEnabled = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.retryEnabled) || false;
|
|
7555
|
+
const maxRetries = ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.maxRetries) || 3;
|
|
7556
|
+
if (retryEnabled && this.currentRetries < maxRetries) {
|
|
7557
|
+
await this.recordingStop();
|
|
7558
|
+
await this.startRecording({
|
|
7559
|
+
retry: true
|
|
7560
|
+
});
|
|
7561
|
+
this.currentRetries++;
|
|
7562
|
+
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback(this.cameraStream);
|
|
7563
|
+
} else {
|
|
7564
|
+
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback();
|
|
7565
|
+
}
|
|
7566
|
+
}
|
|
7567
|
+
async startRecording(options) {
|
|
7305
7568
|
var _a2, _b, _c2, _d, _e3, _f, _g;
|
|
7306
|
-
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)) {
|
|
7569
|
+
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)) {
|
|
7307
7570
|
await this.initializeDetectors();
|
|
7308
7571
|
}
|
|
7309
7572
|
const { cameraId, microphoneId, onBufferSizeErrorCallback } = this.options;
|
|
@@ -7317,18 +7580,33 @@ var CameraRecorder = class {
|
|
|
7317
7580
|
}
|
|
7318
7581
|
};
|
|
7319
7582
|
try {
|
|
7320
|
-
this.cameraStream = await navigator.mediaDevices.getUserMedia(
|
|
7583
|
+
this.cameraStream = await navigator.mediaDevices.getUserMedia(
|
|
7584
|
+
constraints
|
|
7585
|
+
);
|
|
7321
7586
|
} catch (error) {
|
|
7322
7587
|
if (error.toString() == "NotReadableError: Could not start video source")
|
|
7323
7588
|
throw "N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa";
|
|
7324
7589
|
throw error;
|
|
7325
7590
|
}
|
|
7326
|
-
const {
|
|
7591
|
+
const {
|
|
7592
|
+
startRecording,
|
|
7593
|
+
stopRecording,
|
|
7594
|
+
pauseRecording,
|
|
7595
|
+
resumeRecording,
|
|
7596
|
+
recorderOptions,
|
|
7597
|
+
getBufferSize
|
|
7598
|
+
} = recorder(
|
|
7599
|
+
this.cameraStream,
|
|
7600
|
+
this.blobs,
|
|
7601
|
+
this.options.onBufferSizeError,
|
|
7602
|
+
(e3) => this.bufferError(e3),
|
|
7603
|
+
false
|
|
7604
|
+
);
|
|
7327
7605
|
this.recordingStart = startRecording;
|
|
7328
7606
|
this.recordingStop = stopRecording;
|
|
7329
7607
|
this.recordingPause = pauseRecording;
|
|
7330
7608
|
this.recordingResume = resumeRecording;
|
|
7331
|
-
this.recorderOptions =
|
|
7609
|
+
this.recorderOptions = recorderOptions;
|
|
7332
7610
|
this.getBufferSize = getBufferSize;
|
|
7333
7611
|
this.recordingStart();
|
|
7334
7612
|
const tracks = this.cameraStream.getVideoTracks();
|
|
@@ -7336,9 +7614,16 @@ var CameraRecorder = class {
|
|
|
7336
7614
|
if (this.videoOptions.minWidth > settings.width || this.videoOptions.minHeight > settings.height) {
|
|
7337
7615
|
throw STREAM_UNDER_MINIMUM_PERMITTED;
|
|
7338
7616
|
} else if (this.videoOptions.width !== settings.width || this.videoOptions.height !== settings.height) {
|
|
7339
|
-
trackers.registerAnotherStream(
|
|
7340
|
-
|
|
7341
|
-
|
|
7617
|
+
trackers.registerAnotherStream(
|
|
7618
|
+
this.proctoringId,
|
|
7619
|
+
`Maybe have another stream active
|
|
7620
|
+
Video Options: ${JSON.stringify(
|
|
7621
|
+
this.videoOptions,
|
|
7622
|
+
null,
|
|
7623
|
+
2
|
|
7624
|
+
)}
|
|
7625
|
+
Setting: ${JSON.stringify(settings, null, 2)}`
|
|
7626
|
+
);
|
|
7342
7627
|
throw ANOTHER_STREAM_ACTIVE;
|
|
7343
7628
|
}
|
|
7344
7629
|
((_d = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _d.useUploadImage) && this.options.proctoringType == "IMAGE" && this.photoShotsCycle();
|
|
@@ -7362,8 +7647,13 @@ Setting: ${JSON.stringify(settings, null, 2)}`);
|
|
|
7362
7647
|
const packSize = this.paramsConfig.imageBehaviourParameters.uploadInterval;
|
|
7363
7648
|
for (let i3 = 0; i3 < size; i3++) {
|
|
7364
7649
|
if (i3 == size - 1 && this.filesToUpload[0]) {
|
|
7365
|
-
const imageName = this.filesToUpload[0].name.replace(
|
|
7366
|
-
|
|
7650
|
+
const imageName = this.filesToUpload[0].name.replace(
|
|
7651
|
+
".jpg",
|
|
7652
|
+
"_realtime.jpg"
|
|
7653
|
+
);
|
|
7654
|
+
const file = new File([this.filesToUpload[0]], imageName, {
|
|
7655
|
+
type: "image/jpeg"
|
|
7656
|
+
});
|
|
7367
7657
|
this.filesToUpload[0] = file;
|
|
7368
7658
|
}
|
|
7369
7659
|
this.filesToUpload[0] && await this.upload.uploadImages(
|
|
@@ -7389,9 +7679,19 @@ Setting: ${JSON.stringify(settings, null, 2)}`);
|
|
|
7389
7679
|
let imageFile;
|
|
7390
7680
|
this.configImageCapture();
|
|
7391
7681
|
this.imageInterval = setInterval(async () => {
|
|
7392
|
-
this.canvas.getContext("2d").drawImage(
|
|
7682
|
+
this.canvas.getContext("2d").drawImage(
|
|
7683
|
+
this.video,
|
|
7684
|
+
0,
|
|
7685
|
+
0,
|
|
7686
|
+
this.videoOptions.width,
|
|
7687
|
+
this.videoOptions.height
|
|
7688
|
+
);
|
|
7393
7689
|
const image_data_url = this.canvas.toDataURL("image/jpeg");
|
|
7394
|
-
imageFile = await this.getFile(
|
|
7690
|
+
imageFile = await this.getFile(
|
|
7691
|
+
image_data_url,
|
|
7692
|
+
`${this.proctoringId}_${this.imageCount + 1}.jpg`,
|
|
7693
|
+
"image/jpeg"
|
|
7694
|
+
);
|
|
7395
7695
|
if (imageFile && this.upload && this.backendToken) {
|
|
7396
7696
|
this.upload.upload(
|
|
7397
7697
|
{
|
|
@@ -7485,7 +7785,10 @@ Setting: ${JSON.stringify(settings, null, 2)}`);
|
|
|
7485
7785
|
async saveOnSession(session) {
|
|
7486
7786
|
var _a2, _b;
|
|
7487
7787
|
if (this.blobs != null)
|
|
7488
|
-
trackers.registerSaveOnSession(
|
|
7788
|
+
trackers.registerSaveOnSession(
|
|
7789
|
+
this.proctoringId,
|
|
7790
|
+
`Blobs Length: ${this.blobs.length} Buffer Size: ${this.getBufferSize()} `
|
|
7791
|
+
);
|
|
7489
7792
|
const settings = this.cameraStream.getVideoTracks()[0].getSettings();
|
|
7490
7793
|
const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
|
|
7491
7794
|
if (this.options.proctoringType == "VIDEO" || this.options.proctoringType == "REALTIME" || this.options.proctoringType == "IMAGE" && ((_a2 = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _a2.saveVideo)) {
|
|
@@ -7815,10 +8118,29 @@ var DeviceCheckerUI = class {
|
|
|
7815
8118
|
checkmark_AmbientVerify.appendChild(checkmark_kick_AmbientVerify);
|
|
7816
8119
|
alertDivAmbientVerify.appendChild(checkmark_AmbientVerify);
|
|
7817
8120
|
alertDivAmbientVerify.appendChild(ambientVerifyAlert);
|
|
8121
|
+
const alertDivSpyCam = document.createElement("div");
|
|
8122
|
+
alertDivSpyCam.setAttribute("class", "alert-div");
|
|
8123
|
+
alertDivSpyCam.setAttribute("id", "alertDivSpyCam");
|
|
8124
|
+
alertDivSpyCam.style.display = "none";
|
|
8125
|
+
const SpyCamAlert = document.createElement("error");
|
|
8126
|
+
SpyCamAlert.setAttribute("id", "SpyCamAlert");
|
|
8127
|
+
SpyCamAlert.innerText = "Verifica\xE7\xE3o de Spy Cam";
|
|
8128
|
+
SpyCamAlert.style.marginLeft = "10px";
|
|
8129
|
+
const checkmark_SpyCam = document.createElement("span");
|
|
8130
|
+
const checkmark_stem_SpyCam = document.createElement("div");
|
|
8131
|
+
const checkmark_kick_SpyCam = document.createElement("div");
|
|
8132
|
+
checkmark_SpyCam.setAttribute("id", "checkmark_SpyCam");
|
|
8133
|
+
checkmark_stem_SpyCam.setAttribute("id", "checkmark_stem_SpyCam");
|
|
8134
|
+
checkmark_kick_SpyCam.setAttribute("id", "checkmark_kick_SpyCam");
|
|
8135
|
+
checkmark_SpyCam.appendChild(checkmark_stem_SpyCam);
|
|
8136
|
+
checkmark_SpyCam.appendChild(checkmark_kick_SpyCam);
|
|
8137
|
+
alertDivSpyCam.appendChild(checkmark_SpyCam);
|
|
8138
|
+
alertDivSpyCam.appendChild(SpyCamAlert);
|
|
7818
8139
|
center.style.transform = "rotateY(180deg)";
|
|
7819
8140
|
center.appendChild(alertDivResolution);
|
|
7820
8141
|
center.appendChild(alertDivFacePosition);
|
|
7821
8142
|
center.appendChild(alertDivAmbientVerify);
|
|
8143
|
+
center.appendChild(alertDivSpyCam);
|
|
7822
8144
|
divCamera.appendChild(center);
|
|
7823
8145
|
videoDiv.appendChild(video);
|
|
7824
8146
|
divCamera.appendChild(videoDiv);
|
|
@@ -7997,10 +8319,13 @@ var DeviceCheckerUI = class {
|
|
|
7997
8319
|
fontWeight: "bold",
|
|
7998
8320
|
borderRadius: "10px",
|
|
7999
8321
|
paddingTop: "5px",
|
|
8000
|
-
paddingBottom: "5px"
|
|
8001
|
-
disabled: true
|
|
8322
|
+
paddingBottom: "5px"
|
|
8002
8323
|
};
|
|
8003
8324
|
this.applyStyles(button, buttonStyles);
|
|
8325
|
+
if (this.options.useSpyScan) {
|
|
8326
|
+
button.style.cursor = "not-allowed";
|
|
8327
|
+
button.setAttribute("disabled", "true");
|
|
8328
|
+
}
|
|
8004
8329
|
divBtn.appendChild(buttonCancel);
|
|
8005
8330
|
divBtn.appendChild(divider);
|
|
8006
8331
|
divBtn.appendChild(button);
|
|
@@ -8060,6 +8385,8 @@ var DeviceCheckerUI = class {
|
|
|
8060
8385
|
});
|
|
8061
8386
|
});
|
|
8062
8387
|
confirmBtn == null ? void 0 : confirmBtn.addEventListener("click", () => {
|
|
8388
|
+
if (confirmBtn.disabled)
|
|
8389
|
+
return;
|
|
8063
8390
|
closeCheckDevices();
|
|
8064
8391
|
this.closeModal();
|
|
8065
8392
|
resolve({
|
|
@@ -8110,6 +8437,68 @@ var DeviceCheckerUI = class {
|
|
|
8110
8437
|
}
|
|
8111
8438
|
}
|
|
8112
8439
|
}
|
|
8440
|
+
waitingSpyDevices(waiting) {
|
|
8441
|
+
const SpyCamAlert = document.getElementById("SpyCamAlert");
|
|
8442
|
+
const alertDivSpyCam = document.getElementById(
|
|
8443
|
+
"alertDivSpyCam"
|
|
8444
|
+
);
|
|
8445
|
+
alertDivSpyCam && (alertDivSpyCam.style.display = "flex");
|
|
8446
|
+
if (waiting) {
|
|
8447
|
+
SpyCamAlert && (SpyCamAlert.style.color = "#c7c7c7");
|
|
8448
|
+
SpyCamAlert && (SpyCamAlert.innerText = "Verificando Spy Cam...");
|
|
8449
|
+
const confirmBtn = document.getElementById("confirmBtn");
|
|
8450
|
+
if (confirmBtn)
|
|
8451
|
+
confirmBtn.setAttribute("disabled", "true");
|
|
8452
|
+
confirmBtn && (confirmBtn.style.cursor = "not-allowed");
|
|
8453
|
+
} else {
|
|
8454
|
+
SpyCamAlert && (SpyCamAlert.style.color = "#16A34A");
|
|
8455
|
+
SpyCamAlert && (SpyCamAlert.innerText = "Verifica\xE7\xE3o de Spy Cam");
|
|
8456
|
+
const confirmBtn = document.getElementById("confirmBtn");
|
|
8457
|
+
if (confirmBtn)
|
|
8458
|
+
confirmBtn.setAttribute("disabled", "false");
|
|
8459
|
+
confirmBtn && (confirmBtn.style.cursor = "pointer");
|
|
8460
|
+
}
|
|
8461
|
+
}
|
|
8462
|
+
isSpyDevicesUI(allowedDevices) {
|
|
8463
|
+
const SpyCamAlert = document.getElementById("SpyCamAlert");
|
|
8464
|
+
const confirmBtn = document.getElementById("confirmBtn");
|
|
8465
|
+
const alertDivSpyCam = document.getElementById(
|
|
8466
|
+
"alertDivSpyCam"
|
|
8467
|
+
);
|
|
8468
|
+
alertDivSpyCam && (alertDivSpyCam.style.display = "flex");
|
|
8469
|
+
const checkmark_SpyCam = document.getElementById(
|
|
8470
|
+
"checkmark_SpyCam"
|
|
8471
|
+
);
|
|
8472
|
+
const checkmark_stem_SpyCam = document.getElementById(
|
|
8473
|
+
"checkmark_stem_SpyCam"
|
|
8474
|
+
);
|
|
8475
|
+
const checkmark_kick_SpyCam = document.getElementById(
|
|
8476
|
+
"checkmark_kick_SpyCam"
|
|
8477
|
+
);
|
|
8478
|
+
if (allowedDevices) {
|
|
8479
|
+
SpyCamAlert && (SpyCamAlert.style.color = "#16A34A");
|
|
8480
|
+
if (checkmark_SpyCam) {
|
|
8481
|
+
checkmark_SpyCam.setAttribute("class", "checkmark");
|
|
8482
|
+
checkmark_stem_SpyCam.setAttribute("class", "checkmark_stem");
|
|
8483
|
+
checkmark_kick_SpyCam.setAttribute("class", "checkmark_kick");
|
|
8484
|
+
}
|
|
8485
|
+
} else {
|
|
8486
|
+
if (checkmark_SpyCam) {
|
|
8487
|
+
SpyCamAlert && (SpyCamAlert.style.color = "#FF0000");
|
|
8488
|
+
checkmark_SpyCam.setAttribute("class", "checkmark_error");
|
|
8489
|
+
checkmark_stem_SpyCam.setAttribute(
|
|
8490
|
+
"class",
|
|
8491
|
+
"checkmark_stem_error"
|
|
8492
|
+
);
|
|
8493
|
+
checkmark_kick_SpyCam.setAttribute(
|
|
8494
|
+
"class",
|
|
8495
|
+
"checkmark_kick_error"
|
|
8496
|
+
);
|
|
8497
|
+
}
|
|
8498
|
+
}
|
|
8499
|
+
this.options.useSpyScan && (confirmBtn == null ? void 0 : confirmBtn.removeAttribute("disabled"));
|
|
8500
|
+
confirmBtn && (confirmBtn.style.cursor = "pointer");
|
|
8501
|
+
}
|
|
8113
8502
|
isUnderResolutionUI(allowedResolution) {
|
|
8114
8503
|
const error = document.getElementById("resolutionAlert");
|
|
8115
8504
|
const alertDivResolution = document.getElementById("alertDivResolution");
|
|
@@ -8246,7 +8635,12 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
|
|
|
8246
8635
|
// src/new-flow/checkers/DeviceCheckerService.ts
|
|
8247
8636
|
var _DeviceCheckerService = class {
|
|
8248
8637
|
constructor(context) {
|
|
8249
|
-
this.videoOptions = {
|
|
8638
|
+
this.videoOptions = {
|
|
8639
|
+
width: 1080,
|
|
8640
|
+
height: 720,
|
|
8641
|
+
minWidth: 0,
|
|
8642
|
+
minHeight: 0
|
|
8643
|
+
};
|
|
8250
8644
|
this.volumeMedia = 0;
|
|
8251
8645
|
this.volumeSum = 0;
|
|
8252
8646
|
this.volumeCounter = 0;
|
|
@@ -8255,8 +8649,16 @@ var _DeviceCheckerService = class {
|
|
|
8255
8649
|
this.allowedAmbient = true;
|
|
8256
8650
|
this.allowedPositionFace = true;
|
|
8257
8651
|
this.allowedMicrophone = false;
|
|
8652
|
+
this.allowedSpyScan = null;
|
|
8258
8653
|
this.noiseLimit = 0;
|
|
8259
|
-
this.faceDetection = new FaceDetection(
|
|
8654
|
+
this.faceDetection = new FaceDetection(
|
|
8655
|
+
{
|
|
8656
|
+
onRealtimeAlertsCallback: (response) => this.realtimeAlerts(response)
|
|
8657
|
+
},
|
|
8658
|
+
{ videoBehaviourParameters: { detectFace: true } },
|
|
8659
|
+
"cameraStream",
|
|
8660
|
+
"liveCheckDevices"
|
|
8661
|
+
);
|
|
8260
8662
|
this.context = context;
|
|
8261
8663
|
this.backend = new BackendService({
|
|
8262
8664
|
type: (context == null ? void 0 : context.type) || "prod",
|
|
@@ -8267,41 +8669,55 @@ var _DeviceCheckerService = class {
|
|
|
8267
8669
|
if (_DeviceCheckerService.isModalOpen) {
|
|
8268
8670
|
return Promise.reject("Modal j\xE1 est\xE1 aberto");
|
|
8269
8671
|
}
|
|
8672
|
+
this.options = {
|
|
8673
|
+
...getDefaultProctoringOptions,
|
|
8674
|
+
...options,
|
|
8675
|
+
captureScreen: false,
|
|
8676
|
+
allowMultipleMonitors: true,
|
|
8677
|
+
allowOnlyFirstMonitor: false
|
|
8678
|
+
};
|
|
8270
8679
|
_DeviceCheckerService.isModalOpen = true;
|
|
8271
8680
|
try {
|
|
8272
8681
|
await this.faceDetection.initializeDetector();
|
|
8273
|
-
const { cameraStream } = await this.startCheckDevices(
|
|
8682
|
+
const { cameraStream } = await this.startCheckDevices(
|
|
8683
|
+
options,
|
|
8684
|
+
_videoOptions
|
|
8685
|
+
);
|
|
8686
|
+
this.checkSpyScan();
|
|
8274
8687
|
const returnData = { cameraStream: this.cameraRecorder.cameraStream };
|
|
8275
8688
|
this.onUpdateCb = (e3) => onUpdate(e3);
|
|
8276
|
-
const resultPromise = new Promise(
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8689
|
+
const resultPromise = new Promise(
|
|
8690
|
+
(resolve, reject) => {
|
|
8691
|
+
onModalConfirm(() => {
|
|
8692
|
+
this.closeCheckDevices();
|
|
8693
|
+
resolve({
|
|
8694
|
+
result: true,
|
|
8695
|
+
cameraId: options.cameraId || "default",
|
|
8696
|
+
microphoneId: options.microphoneId || "default",
|
|
8697
|
+
volumeRange: this.volumeMedia,
|
|
8698
|
+
allowedResolution: this.allowedResolution,
|
|
8699
|
+
allowedPositionFace: this.allowedPositionFace,
|
|
8700
|
+
allowedAmbient: this.allowedAmbient,
|
|
8701
|
+
allowedMicrophone: this.allowedMicrophone,
|
|
8702
|
+
allowedSpyScan: this.allowedSpyScan,
|
|
8703
|
+
faceDetectionAlerts: this.faceDetectionAlerts
|
|
8704
|
+
});
|
|
8705
|
+
_DeviceCheckerService.isModalOpen = false;
|
|
8289
8706
|
});
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8707
|
+
onModalCancel(() => {
|
|
8708
|
+
this.closeCheckDevices();
|
|
8709
|
+
resolve({
|
|
8710
|
+
result: false
|
|
8711
|
+
});
|
|
8712
|
+
_DeviceCheckerService.isModalOpen = false;
|
|
8296
8713
|
});
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
});
|
|
8714
|
+
}
|
|
8715
|
+
);
|
|
8300
8716
|
return { ...returnData, result: resultPromise };
|
|
8301
8717
|
} catch (error) {
|
|
8302
8718
|
this.closeCheckDevices();
|
|
8303
8719
|
_DeviceCheckerService.isModalOpen = false;
|
|
8304
|
-
|
|
8720
|
+
throw error;
|
|
8305
8721
|
}
|
|
8306
8722
|
}
|
|
8307
8723
|
onUpdateCallback() {
|
|
@@ -8311,6 +8727,7 @@ var _DeviceCheckerService = class {
|
|
|
8311
8727
|
allowedPositionFace: this.allowedPositionFace,
|
|
8312
8728
|
allowedAmbient: this.allowedAmbient,
|
|
8313
8729
|
allowedMicrophone: this.allowedMicrophone,
|
|
8730
|
+
allowedSpyScan: this.allowedSpyScan,
|
|
8314
8731
|
faceDetectionAlerts: this.faceDetectionAlerts
|
|
8315
8732
|
});
|
|
8316
8733
|
}
|
|
@@ -8331,11 +8748,14 @@ var _DeviceCheckerService = class {
|
|
|
8331
8748
|
allowOnlyFirstMonitor: false
|
|
8332
8749
|
};
|
|
8333
8750
|
this.videoOptions = { ...this.videoOptions, ..._videoOptions };
|
|
8334
|
-
const paramsConfig = await this.backend.getParamsConfig(
|
|
8751
|
+
const paramsConfig = await this.backend.getParamsConfig(
|
|
8752
|
+
this.context
|
|
8753
|
+
);
|
|
8335
8754
|
this.noiseLimit = ((_a2 = paramsConfig.audioBehaviourParameters) == null ? void 0 : _a2.noiseLimit) || 40;
|
|
8336
8755
|
await this.faceDetection.initializeDetector();
|
|
8337
8756
|
this.DeviceCheckerUI.checkDevicesInterface();
|
|
8338
8757
|
this.startCheckDevices(options, _videoOptions);
|
|
8758
|
+
await this.checkSpyScan();
|
|
8339
8759
|
const { cameraId, microphoneId, result } = await this.DeviceCheckerUI.modalActions(() => this.closeCheckDevices());
|
|
8340
8760
|
return new Promise((resolve) => {
|
|
8341
8761
|
resolve({
|
|
@@ -8347,6 +8767,7 @@ var _DeviceCheckerService = class {
|
|
|
8347
8767
|
allowedPositionFace: this.allowedPositionFace,
|
|
8348
8768
|
allowedAmbient: this.allowedAmbient,
|
|
8349
8769
|
allowedMicrophone: this.allowedMicrophone,
|
|
8770
|
+
allowedSpyScan: this.allowedSpyScan,
|
|
8350
8771
|
faceDetectionAlerts: this.faceDetectionAlerts
|
|
8351
8772
|
});
|
|
8352
8773
|
});
|
|
@@ -8413,10 +8834,7 @@ var _DeviceCheckerService = class {
|
|
|
8413
8834
|
this.DeviceCheckerUI && this.DeviceCheckerUI.audioDeviceInterfaceUIErrorExec();
|
|
8414
8835
|
});
|
|
8415
8836
|
}
|
|
8416
|
-
async changeSelectedDevice({
|
|
8417
|
-
cameraId,
|
|
8418
|
-
microphoneId
|
|
8419
|
-
}) {
|
|
8837
|
+
async changeSelectedDevice({ cameraId, microphoneId }) {
|
|
8420
8838
|
var _a2;
|
|
8421
8839
|
this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
|
|
8422
8840
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
@@ -8442,7 +8860,10 @@ var _DeviceCheckerService = class {
|
|
|
8442
8860
|
};
|
|
8443
8861
|
}
|
|
8444
8862
|
async startCheckDevices(options = getDefaultProctoringOptions, _videoOptions) {
|
|
8445
|
-
this.DeviceCheckerUI && this.DeviceCheckerUI.setSelectOption(
|
|
8863
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.setSelectOption(
|
|
8864
|
+
options,
|
|
8865
|
+
(e3) => this.changeSelectedDevice(e3)
|
|
8866
|
+
);
|
|
8446
8867
|
this.videoOptions = validatePartialVideoOptions(_videoOptions);
|
|
8447
8868
|
await checkPermissions();
|
|
8448
8869
|
this.cameraRecorder = new CameraRecorder(
|
|
@@ -8463,7 +8884,7 @@ var _DeviceCheckerService = class {
|
|
|
8463
8884
|
this.audioDeviceInterface(this.cameraRecorder.cameraStream);
|
|
8464
8885
|
if (this.DeviceCheckerUI) {
|
|
8465
8886
|
const button = document.querySelector("#confirmBtn");
|
|
8466
|
-
button.disabled = false;
|
|
8887
|
+
!this.options.useSpyScan && (button.disabled = false);
|
|
8467
8888
|
}
|
|
8468
8889
|
return {
|
|
8469
8890
|
cameraStream: this.cameraRecorder.cameraStream
|
|
@@ -8479,6 +8900,39 @@ var _DeviceCheckerService = class {
|
|
|
8479
8900
|
this.DeviceCheckerUI = void 0;
|
|
8480
8901
|
this.onUpdateCb = void 0;
|
|
8481
8902
|
}
|
|
8903
|
+
async checkSpyScan() {
|
|
8904
|
+
this.spycam = new SpyCam(this.context, {});
|
|
8905
|
+
this.allowedSpyScan = null;
|
|
8906
|
+
if (this.options.useSpyScan) {
|
|
8907
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.waitingSpyDevices(true);
|
|
8908
|
+
try {
|
|
8909
|
+
const isPlugged = await this.spycam.isPluggedIn();
|
|
8910
|
+
if (isPlugged) {
|
|
8911
|
+
await this.spycam.devices({
|
|
8912
|
+
deviceType: 3 /* POTENCIAL_CAMERA */
|
|
8913
|
+
}).then((devices) => {
|
|
8914
|
+
if ((devices == null ? void 0 : devices.length) > 0) {
|
|
8915
|
+
this.allowedSpyScan = false;
|
|
8916
|
+
} else {
|
|
8917
|
+
this.allowedSpyScan = true;
|
|
8918
|
+
}
|
|
8919
|
+
}).finally(() => {
|
|
8920
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.waitingSpyDevices(false);
|
|
8921
|
+
this.DeviceCheckerUI && this.allowedSpyScan != null && this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan);
|
|
8922
|
+
});
|
|
8923
|
+
} else {
|
|
8924
|
+
this.allowedSpyScan = false;
|
|
8925
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.waitingSpyDevices(false);
|
|
8926
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan);
|
|
8927
|
+
}
|
|
8928
|
+
} catch (error) {
|
|
8929
|
+
this.allowedSpyScan = false;
|
|
8930
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.waitingSpyDevices(false);
|
|
8931
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan);
|
|
8932
|
+
console.log(error);
|
|
8933
|
+
}
|
|
8934
|
+
}
|
|
8935
|
+
}
|
|
8482
8936
|
};
|
|
8483
8937
|
var DeviceCheckerService = _DeviceCheckerService;
|
|
8484
8938
|
DeviceCheckerService.isModalOpen = false;
|
|
@@ -8840,9 +9294,9 @@ var Extension = class {
|
|
|
8840
9294
|
|
|
8841
9295
|
// src/modules/onChangeDevices.ts
|
|
8842
9296
|
var onChangeDevices = class {
|
|
8843
|
-
constructor(repositoryDevices,
|
|
9297
|
+
constructor(repositoryDevices, proctoringId2) {
|
|
8844
9298
|
this.repositoryDevices = repositoryDevices;
|
|
8845
|
-
this.proctoringId =
|
|
9299
|
+
this.proctoringId = proctoringId2;
|
|
8846
9300
|
}
|
|
8847
9301
|
startRecording(options) {
|
|
8848
9302
|
navigator.mediaDevices.ondevicechange = () => {
|
|
@@ -8873,7 +9327,7 @@ var onChangeDevices = class {
|
|
|
8873
9327
|
};
|
|
8874
9328
|
await this.repositoryDevices.save({ ...devices, id: "devices", status: devices.cameras.length > (copy == null ? void 0 : copy.cameras.length) || devices.microphones.length > (copy == null ? void 0 : copy.microphones.length) ? "in" : "out" });
|
|
8875
9329
|
if (options.status && (devicesChanged.cameras.length != 0 || devicesChanged.microphones.length != 0)) {
|
|
8876
|
-
trackers.registerChangeDevice(this.proctoringId, devicesChanged.status, devicesChanged);
|
|
9330
|
+
trackers.registerChangeDevice(this.proctoringId, devicesChanged.status, JSON.stringify(devicesChanged, null, 2));
|
|
8877
9331
|
options.status(devicesChanged);
|
|
8878
9332
|
}
|
|
8879
9333
|
}
|
|
@@ -8882,9 +9336,9 @@ var onChangeDevices = class {
|
|
|
8882
9336
|
// src/new-flow/download/downloadService.ts
|
|
8883
9337
|
var import_file_saver = __toESM(require_FileSaver_min());
|
|
8884
9338
|
var DownloadService = class {
|
|
8885
|
-
constructor(
|
|
9339
|
+
constructor(proctoringId2) {
|
|
8886
9340
|
this.loadingBoolean = true;
|
|
8887
|
-
this.proctoringId =
|
|
9341
|
+
this.proctoringId = proctoringId2;
|
|
8888
9342
|
}
|
|
8889
9343
|
async upload(data, token) {
|
|
8890
9344
|
const { file, onProgress } = data;
|
|
@@ -8916,7 +9370,7 @@ var ProctoringRecorder = class {
|
|
|
8916
9370
|
async startAll() {
|
|
8917
9371
|
this.session.start();
|
|
8918
9372
|
for (const rec of this.recorders) {
|
|
8919
|
-
await rec.startRecording();
|
|
9373
|
+
await rec.startRecording({ retry: false });
|
|
8920
9374
|
}
|
|
8921
9375
|
}
|
|
8922
9376
|
async pauseAll() {
|
|
@@ -8946,9 +9400,9 @@ var ProctoringRecorder = class {
|
|
|
8946
9400
|
|
|
8947
9401
|
// src/new-flow/proctoring/ProctoringUploader.ts
|
|
8948
9402
|
var ProctoringUploader = class {
|
|
8949
|
-
constructor(session,
|
|
9403
|
+
constructor(session, proctoringId2, uploadServices) {
|
|
8950
9404
|
this.session = session;
|
|
8951
|
-
this.proctoringId =
|
|
9405
|
+
this.proctoringId = proctoringId2;
|
|
8952
9406
|
this.uploadServices = uploadServices;
|
|
8953
9407
|
}
|
|
8954
9408
|
async upload(token, progress) {
|
|
@@ -9070,7 +9524,8 @@ var AlertRecorder = class {
|
|
|
9070
9524
|
this.alerts.push({
|
|
9071
9525
|
begin: Date.now() - this.startTime.getTime(),
|
|
9072
9526
|
end: 0,
|
|
9073
|
-
alert: 25 /* LostFocus
|
|
9527
|
+
alert: 25 /* LostFocus */,
|
|
9528
|
+
type: 3 /* Screen */
|
|
9074
9529
|
});
|
|
9075
9530
|
}
|
|
9076
9531
|
}
|
|
@@ -9102,7 +9557,7 @@ var AudioRecorder = class {
|
|
|
9102
9557
|
audio: { deviceId: this.options.microphoneId || "default" }
|
|
9103
9558
|
};
|
|
9104
9559
|
this.audioStream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
9105
|
-
const { startRecording, stopRecording, pauseRecording, resumeRecording } = recorder(this.audioStream, this.blobs, void 0, void 0,
|
|
9560
|
+
const { startRecording, stopRecording, pauseRecording, resumeRecording } = recorder(this.audioStream, this.blobs, void 0, void 0, true);
|
|
9106
9561
|
this.recordingStart = startRecording;
|
|
9107
9562
|
this.recordingStop = stopRecording;
|
|
9108
9563
|
this.recordingPause = pauseRecording;
|
|
@@ -11417,8 +11872,8 @@ var NoiseRecorder = class {
|
|
|
11417
11872
|
this.backend = backend;
|
|
11418
11873
|
this.backendToken = backendToken;
|
|
11419
11874
|
}
|
|
11420
|
-
setProctoringId(
|
|
11421
|
-
this.proctoringId =
|
|
11875
|
+
setProctoringId(proctoringId2) {
|
|
11876
|
+
this.proctoringId = proctoringId2;
|
|
11422
11877
|
this.proctoringId && this.backend && (this.upload = new UploadService(this.proctoringId, this.backend));
|
|
11423
11878
|
}
|
|
11424
11879
|
async startRecording() {
|
|
@@ -11629,8 +12084,9 @@ var ScreenRecorder = class {
|
|
|
11629
12084
|
this.blobsFinal = [];
|
|
11630
12085
|
this.options = options;
|
|
11631
12086
|
}
|
|
11632
|
-
setProctoringId(
|
|
11633
|
-
this.proctoringId =
|
|
12087
|
+
setProctoringId(proctoringId2) {
|
|
12088
|
+
this.proctoringId = proctoringId2;
|
|
12089
|
+
setRecorderProctoringId(proctoringId2);
|
|
11634
12090
|
}
|
|
11635
12091
|
async startRecording() {
|
|
11636
12092
|
this.startTime = new Date(Date.now());
|
|
@@ -11678,7 +12134,7 @@ var ScreenRecorder = class {
|
|
|
11678
12134
|
});
|
|
11679
12135
|
throw NOT_SHARED_SCREEN;
|
|
11680
12136
|
}
|
|
11681
|
-
const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs, this.
|
|
12137
|
+
const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs, this.options.onBufferSizeError, onBufferSizeErrorCallback);
|
|
11682
12138
|
this.recordingStart = startRecording;
|
|
11683
12139
|
this.recordingStop = stopRecording;
|
|
11684
12140
|
this.recordingStart();
|
|
@@ -11935,7 +12391,7 @@ var Proctoring = class {
|
|
|
11935
12391
|
this.onRealtimeAlertsCallback = (response) => {
|
|
11936
12392
|
return;
|
|
11937
12393
|
};
|
|
11938
|
-
this.onBufferSizeErrorCallback = () => {
|
|
12394
|
+
this.onBufferSizeErrorCallback = (cameraStream) => {
|
|
11939
12395
|
return;
|
|
11940
12396
|
};
|
|
11941
12397
|
var _a2;
|
|
@@ -11977,7 +12433,7 @@ var Proctoring = class {
|
|
|
11977
12433
|
this.onRealtimeAlertsCallback = (response) => options.data && options.data(response);
|
|
11978
12434
|
}
|
|
11979
12435
|
setOnBufferSizeErrorCallback(cb) {
|
|
11980
|
-
this.onBufferSizeErrorCallback = () => cb();
|
|
12436
|
+
this.onBufferSizeErrorCallback = (cameraStream) => cb(cameraStream);
|
|
11981
12437
|
}
|
|
11982
12438
|
createRecorders(options = getDefaultProctoringOptions) {
|
|
11983
12439
|
var _a2, _b;
|
|
@@ -11987,7 +12443,7 @@ var Proctoring = class {
|
|
|
11987
12443
|
cameraId: this.sessionOptions.cameraId,
|
|
11988
12444
|
microphoneId: this.sessionOptions.microphoneId,
|
|
11989
12445
|
onBufferSizeError: this.sessionOptions.onBufferSizeError,
|
|
11990
|
-
onBufferSizeErrorCallback: () => this.onBufferSizeErrorCallback(),
|
|
12446
|
+
onBufferSizeErrorCallback: (cameraStream) => this.onBufferSizeErrorCallback(cameraStream),
|
|
11991
12447
|
proctoringType: this.sessionOptions.proctoringType,
|
|
11992
12448
|
onChangeDevicesCallback: (devices) => this.onChangeDevicesCallback(devices),
|
|
11993
12449
|
onRealtimeAlertsCallback: (response) => this.onRealtimeAlertsCallback(response)
|
|
@@ -12041,6 +12497,7 @@ var Proctoring = class {
|
|
|
12041
12497
|
this.context.token = await this.auth.login();
|
|
12042
12498
|
}
|
|
12043
12499
|
async start(options = getDefaultProctoringOptions, _videoOptions = {}) {
|
|
12500
|
+
var _a2;
|
|
12044
12501
|
try {
|
|
12045
12502
|
if (this.context.token === void 0) {
|
|
12046
12503
|
throw TOKEN_MISSING;
|
|
@@ -12055,6 +12512,13 @@ var Proctoring = class {
|
|
|
12055
12512
|
await this.initConfig(options.useGeolocation);
|
|
12056
12513
|
await this.verifyBrowser();
|
|
12057
12514
|
this.sessionOptions.captureScreen && await this.verifyMultipleMonitors(this.sessionOptions);
|
|
12515
|
+
try {
|
|
12516
|
+
if (options == null ? void 0 : options.useSpyScan) {
|
|
12517
|
+
await this.spyCam.isAlive();
|
|
12518
|
+
}
|
|
12519
|
+
} catch (error) {
|
|
12520
|
+
throw SPY_SCAN_API_NOT_FOUND;
|
|
12521
|
+
}
|
|
12058
12522
|
if (this.state != "Stop" /* Stop */) {
|
|
12059
12523
|
throw PROCTORING_ALREADY_STARTED;
|
|
12060
12524
|
}
|
|
@@ -12079,6 +12543,12 @@ var Proctoring = class {
|
|
|
12079
12543
|
this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
|
|
12080
12544
|
this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
|
|
12081
12545
|
this.proctoringSession.setProctoringId(this.proctoringId);
|
|
12546
|
+
if (options == null ? void 0 : options.useSpyScan) {
|
|
12547
|
+
this.spyCam.setProctoringId(this.proctoringId);
|
|
12548
|
+
this.spyCam.startCheckSpyCam((_a2 = this.paramsConfig.spyScanInterval) != null ? _a2 : 5, {
|
|
12549
|
+
deviceType: 3 /* POTENCIAL_CAMERA */
|
|
12550
|
+
});
|
|
12551
|
+
}
|
|
12082
12552
|
await this.repository.save(this.proctoringSession);
|
|
12083
12553
|
const _navigator = {};
|
|
12084
12554
|
for (const i3 in navigator)
|
|
@@ -12112,6 +12582,7 @@ Error: ${error}`
|
|
|
12112
12582
|
async cancel() {
|
|
12113
12583
|
if (this.state === "Recording" /* Recording */ || this.state === "Starting" /* Starting */) {
|
|
12114
12584
|
await this.recorder.stopAll();
|
|
12585
|
+
this.spyCam && await this.spyCam.stopCheckSpyCam();
|
|
12115
12586
|
}
|
|
12116
12587
|
this.state = "Stop" /* Stop */;
|
|
12117
12588
|
}
|
|
@@ -12122,6 +12593,7 @@ Error: ${error}`
|
|
|
12122
12593
|
throw PROCTORING_NOT_STARTED;
|
|
12123
12594
|
}
|
|
12124
12595
|
await this.recorder.stopAll();
|
|
12596
|
+
this.spyCam && this.spyCam.stopCheckSpyCam();
|
|
12125
12597
|
await this.recorder.saveAllOnSession();
|
|
12126
12598
|
await this.repository.save(this.proctoringSession);
|
|
12127
12599
|
let uploader;
|
|
@@ -12200,7 +12672,7 @@ Upload Services: ${uploaderServices}`,
|
|
|
12200
12672
|
);
|
|
12201
12673
|
}
|
|
12202
12674
|
if (this.proctoringSession.alerts.length > 0) {
|
|
12203
|
-
await this.backend.
|
|
12675
|
+
await this.backend.saveAlerts(this.context, this.proctoringSession).catch((err) => {
|
|
12204
12676
|
trackers.registerFinish(
|
|
12205
12677
|
this.proctoringSession.id,
|
|
12206
12678
|
false,
|
|
@@ -12254,6 +12726,7 @@ Error: ` + error
|
|
|
12254
12726
|
}
|
|
12255
12727
|
}
|
|
12256
12728
|
async initConfig(useGeolocation) {
|
|
12729
|
+
var _a2;
|
|
12257
12730
|
try {
|
|
12258
12731
|
const paramsConfig = await this.backend.getParamsConfig(
|
|
12259
12732
|
this.context
|
|
@@ -12280,6 +12753,11 @@ Error: ` + error
|
|
|
12280
12753
|
});
|
|
12281
12754
|
}
|
|
12282
12755
|
init(this.backend);
|
|
12756
|
+
if ((_a2 = this.sessionOptions) == null ? void 0 : _a2.useSpyScan) {
|
|
12757
|
+
this.spyCam = new SpyCam(this.context, {
|
|
12758
|
+
onRealtimeAlertsCallback: (response) => this.onRealtimeAlertsCallback(response)
|
|
12759
|
+
});
|
|
12760
|
+
}
|
|
12283
12761
|
} catch (err) {
|
|
12284
12762
|
this.proctoringId && trackers.registerError(this.proctoringId, "Erro no initConfig!");
|
|
12285
12763
|
await this.cancel();
|
|
@@ -12325,6 +12803,200 @@ Error: ` + error
|
|
|
12325
12803
|
}
|
|
12326
12804
|
};
|
|
12327
12805
|
|
|
12806
|
+
// src/proctoring/SignTerm.ts
|
|
12807
|
+
var _SignTerm = class {
|
|
12808
|
+
constructor(context) {
|
|
12809
|
+
this.backend = new BackendService({
|
|
12810
|
+
type: (context == null ? void 0 : context.type) || "prod",
|
|
12811
|
+
token: context.token
|
|
12812
|
+
});
|
|
12813
|
+
}
|
|
12814
|
+
async signInTerms() {
|
|
12815
|
+
if (_SignTerm.isModalOpen) {
|
|
12816
|
+
return Promise.reject();
|
|
12817
|
+
}
|
|
12818
|
+
_SignTerm.isModalOpen = true;
|
|
12819
|
+
try {
|
|
12820
|
+
const response = await this.openModal();
|
|
12821
|
+
return new Promise((resolve) => {
|
|
12822
|
+
resolve(response);
|
|
12823
|
+
});
|
|
12824
|
+
} catch (error) {
|
|
12825
|
+
this.closeModal();
|
|
12826
|
+
return Promise.reject(error);
|
|
12827
|
+
}
|
|
12828
|
+
}
|
|
12829
|
+
openModal() {
|
|
12830
|
+
return new Promise((resolve, reject) => {
|
|
12831
|
+
const fullBg = document.createElement("div");
|
|
12832
|
+
fullBg.setAttribute("id", "signTermModal");
|
|
12833
|
+
const fullBgStyles = {
|
|
12834
|
+
backgroundColor: "rgba(0,0,0,0.4)",
|
|
12835
|
+
zIndex: "1000",
|
|
12836
|
+
position: "fixed",
|
|
12837
|
+
top: "0",
|
|
12838
|
+
left: "0",
|
|
12839
|
+
height: "100vh",
|
|
12840
|
+
width: "100%",
|
|
12841
|
+
display: "flex",
|
|
12842
|
+
alignItems: "center",
|
|
12843
|
+
justifyContent: "center"
|
|
12844
|
+
};
|
|
12845
|
+
this.applyStyles(fullBg, fullBgStyles);
|
|
12846
|
+
const modal = document.createElement("div");
|
|
12847
|
+
const modalStyles = {
|
|
12848
|
+
backgroundColor: "#fff",
|
|
12849
|
+
zIndex: "1001",
|
|
12850
|
+
width: "850px",
|
|
12851
|
+
maxHeight: "95%",
|
|
12852
|
+
borderRadius: "10px",
|
|
12853
|
+
display: "flex",
|
|
12854
|
+
flexDirection: "column",
|
|
12855
|
+
alignItems: "center"
|
|
12856
|
+
};
|
|
12857
|
+
this.applyStyles(modal, modalStyles);
|
|
12858
|
+
const h3 = document.createElement("h3");
|
|
12859
|
+
h3.innerText = "Termo de consentimento para coleta e uso de dados";
|
|
12860
|
+
const h3Styles = {
|
|
12861
|
+
color: "rgba(0, 0, 0, .7)",
|
|
12862
|
+
fontWeight: "bold",
|
|
12863
|
+
fontSize: "20px",
|
|
12864
|
+
marginBottom: "15px",
|
|
12865
|
+
padding: "20px 0px",
|
|
12866
|
+
borderBottom: "2px solid rgba(0, 0, 0, .1)",
|
|
12867
|
+
width: "100%",
|
|
12868
|
+
textAlign: "center"
|
|
12869
|
+
};
|
|
12870
|
+
this.applyStyles(h3, h3Styles);
|
|
12871
|
+
modal.appendChild(h3);
|
|
12872
|
+
const docEmbed = document.createElement("iframe");
|
|
12873
|
+
const defaultUrl = "https://docs.google.com/document/u/3/d/e/2PACX-1vRMgrLhDLyDP8BHmotfPDpwAFaDHqK-mA4eBJ0Cy1mDdvHcWLsx47H4otII_4qi4rhtSf6B0OO97e9c/pub";
|
|
12874
|
+
this.backend.signTermUrl().then((response) => {
|
|
12875
|
+
if (!response)
|
|
12876
|
+
throw new Error("N\xE3o foi poss\xEDvel obter o termo de consentimento");
|
|
12877
|
+
docEmbed.setAttribute("src", response);
|
|
12878
|
+
}).catch(() => {
|
|
12879
|
+
docEmbed.setAttribute("src", defaultUrl);
|
|
12880
|
+
});
|
|
12881
|
+
const docEmbedStyles = {
|
|
12882
|
+
width: "100%",
|
|
12883
|
+
height: "500px",
|
|
12884
|
+
border: "1px solid rgba(0, 0, 0, .1)",
|
|
12885
|
+
margin: "20px",
|
|
12886
|
+
borderRadius: "5px"
|
|
12887
|
+
};
|
|
12888
|
+
this.applyStyles(docEmbed, docEmbedStyles);
|
|
12889
|
+
modal.appendChild(docEmbed);
|
|
12890
|
+
const checkboxContainer = document.createElement("div");
|
|
12891
|
+
const checkbox = document.createElement("input");
|
|
12892
|
+
checkbox.setAttribute("type", "checkbox");
|
|
12893
|
+
checkbox.setAttribute("id", "termsCheckbox");
|
|
12894
|
+
const checkboxLabel = document.createElement("label");
|
|
12895
|
+
checkboxLabel.setAttribute("for", "termsCheckbox");
|
|
12896
|
+
checkboxLabel.innerText = "Li e aceito os termos e condi\xE7\xF5es";
|
|
12897
|
+
const checkboxContainerStyles = {
|
|
12898
|
+
display: "flex",
|
|
12899
|
+
alignItems: "center",
|
|
12900
|
+
gap: "10px",
|
|
12901
|
+
margin: "20px",
|
|
12902
|
+
width: "100%",
|
|
12903
|
+
paddingLeft: "20px"
|
|
12904
|
+
};
|
|
12905
|
+
this.applyStyles(checkboxContainer, checkboxContainerStyles);
|
|
12906
|
+
checkboxContainer.appendChild(checkbox);
|
|
12907
|
+
checkboxContainer.appendChild(checkboxLabel);
|
|
12908
|
+
modal.appendChild(checkboxContainer);
|
|
12909
|
+
const divBtn = document.createElement("div");
|
|
12910
|
+
const divBtnStyles = {
|
|
12911
|
+
width: "100%",
|
|
12912
|
+
display: "flex",
|
|
12913
|
+
alignItems: "center",
|
|
12914
|
+
justifyContent: "center",
|
|
12915
|
+
borderTop: "2px solid rgba(0, 0, 0, .1)"
|
|
12916
|
+
};
|
|
12917
|
+
this.applyStyles(divBtn, divBtnStyles);
|
|
12918
|
+
const buttonCancel = document.createElement("button");
|
|
12919
|
+
buttonCancel.innerText = "Cancelar";
|
|
12920
|
+
const buttonCancelStyles = {
|
|
12921
|
+
width: "100%",
|
|
12922
|
+
height: "70px",
|
|
12923
|
+
backgroundColor: "#FFF",
|
|
12924
|
+
border: "none",
|
|
12925
|
+
color: "rgba(0, 0, 0, .7)",
|
|
12926
|
+
fontWeight: "bold",
|
|
12927
|
+
borderRadius: "10px",
|
|
12928
|
+
paddingTop: "5px",
|
|
12929
|
+
paddingBottom: "5px"
|
|
12930
|
+
};
|
|
12931
|
+
this.applyStyles(buttonCancel, buttonCancelStyles);
|
|
12932
|
+
buttonCancel.addEventListener("click", () => {
|
|
12933
|
+
this.closeModal();
|
|
12934
|
+
resolve(false);
|
|
12935
|
+
});
|
|
12936
|
+
const divider = document.createElement("span");
|
|
12937
|
+
const dividerStyles = {
|
|
12938
|
+
width: "3px",
|
|
12939
|
+
height: "70px",
|
|
12940
|
+
margin: "0px 2px",
|
|
12941
|
+
background: "rgba(0, 0, 0, .1)"
|
|
12942
|
+
};
|
|
12943
|
+
this.applyStyles(divider, dividerStyles);
|
|
12944
|
+
const button = document.createElement("button");
|
|
12945
|
+
button.innerText = "Continuar";
|
|
12946
|
+
button.setAttribute("id", "confirmBtn");
|
|
12947
|
+
const buttonStyles = {
|
|
12948
|
+
width: "100%",
|
|
12949
|
+
height: "70px",
|
|
12950
|
+
backgroundColor: "#FFF",
|
|
12951
|
+
border: "none",
|
|
12952
|
+
color: "rgba(0, 0, 0, .7)",
|
|
12953
|
+
fontWeight: "bold",
|
|
12954
|
+
borderRadius: "10px",
|
|
12955
|
+
paddingTop: "5px",
|
|
12956
|
+
paddingBottom: "5px",
|
|
12957
|
+
disabled: true,
|
|
12958
|
+
cursor: "not-allowed"
|
|
12959
|
+
};
|
|
12960
|
+
this.applyStyles(button, buttonStyles);
|
|
12961
|
+
button.disabled = true;
|
|
12962
|
+
button.addEventListener("click", () => {
|
|
12963
|
+
this.closeModal();
|
|
12964
|
+
this.backend.signTerm().then(() => {
|
|
12965
|
+
resolve(true);
|
|
12966
|
+
});
|
|
12967
|
+
});
|
|
12968
|
+
checkbox.addEventListener("change", (e3) => {
|
|
12969
|
+
button.disabled = !e3.target.checked;
|
|
12970
|
+
if (e3.target.checked) {
|
|
12971
|
+
button.style.color = "#007bff";
|
|
12972
|
+
button.style.cursor = "pointer";
|
|
12973
|
+
} else {
|
|
12974
|
+
button.style.color = "rgba(0, 0, 0, .7)";
|
|
12975
|
+
button.style.cursor = "not-allowed";
|
|
12976
|
+
}
|
|
12977
|
+
});
|
|
12978
|
+
divBtn.appendChild(buttonCancel);
|
|
12979
|
+
divBtn.appendChild(divider);
|
|
12980
|
+
divBtn.appendChild(button);
|
|
12981
|
+
modal.appendChild(divBtn);
|
|
12982
|
+
fullBg.appendChild(modal);
|
|
12983
|
+
document.body.appendChild(fullBg);
|
|
12984
|
+
});
|
|
12985
|
+
}
|
|
12986
|
+
async closeModal() {
|
|
12987
|
+
_SignTerm.isModalOpen = false;
|
|
12988
|
+
const signTermModal = document.querySelector("#signTermModal");
|
|
12989
|
+
signTermModal == null ? void 0 : signTermModal.remove();
|
|
12990
|
+
}
|
|
12991
|
+
applyStyles(element, styles) {
|
|
12992
|
+
for (const [property, value] of Object.entries(styles)) {
|
|
12993
|
+
element.style[property] = value;
|
|
12994
|
+
}
|
|
12995
|
+
}
|
|
12996
|
+
};
|
|
12997
|
+
var SignTerm = _SignTerm;
|
|
12998
|
+
SignTerm.isModalOpen = false;
|
|
12999
|
+
|
|
12328
13000
|
// src/proctoring/useProctoring.ts
|
|
12329
13001
|
function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
12330
13002
|
if (!proctoringOptions.showConsole) {
|
|
@@ -12335,22 +13007,17 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
12335
13007
|
console.error = () => {
|
|
12336
13008
|
};
|
|
12337
13009
|
}
|
|
12338
|
-
const
|
|
12339
|
-
type: enviromentConfig,
|
|
12340
|
-
clientId: proctoringOptions.clientId,
|
|
12341
|
-
examId: proctoringOptions.examId,
|
|
12342
|
-
token: proctoringOptions.token,
|
|
12343
|
-
credentials: proctoringOptions.credentials,
|
|
12344
|
-
showConsole: proctoringOptions.showConsole
|
|
12345
|
-
});
|
|
12346
|
-
const checker = new DeviceCheckerService({
|
|
13010
|
+
const parameters = {
|
|
12347
13011
|
type: enviromentConfig,
|
|
12348
13012
|
clientId: proctoringOptions.clientId,
|
|
12349
13013
|
examId: proctoringOptions.examId,
|
|
12350
13014
|
token: proctoringOptions.token,
|
|
12351
13015
|
credentials: proctoringOptions.credentials,
|
|
12352
13016
|
showConsole: proctoringOptions.showConsole
|
|
12353
|
-
}
|
|
13017
|
+
};
|
|
13018
|
+
const proctoring = new Proctoring(parameters);
|
|
13019
|
+
const checker = new DeviceCheckerService(parameters);
|
|
13020
|
+
const signTerm = new SignTerm(parameters);
|
|
12354
13021
|
const photo = new CapturePhoto();
|
|
12355
13022
|
const login = proctoring.login.bind(proctoring);
|
|
12356
13023
|
const start = proctoring.start.bind(proctoring);
|
|
@@ -12363,6 +13030,7 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
12363
13030
|
const onBufferSizeError = proctoring.setOnBufferSizeErrorCallback.bind(proctoring);
|
|
12364
13031
|
const onStopSharingScreen = proctoring.setOnStopSharingScreenCallback.bind(proctoring);
|
|
12365
13032
|
const onRealtimeAlerts = proctoring.onRealtimeAlerts.bind(proctoring);
|
|
13033
|
+
const signInTerms = signTerm.signInTerms.bind(signTerm);
|
|
12366
13034
|
const checkDevices = checker.checkDevices.bind(checker);
|
|
12367
13035
|
const runCheckDevicesFlow = checker.runCheckDevicesFlow.bind(checker);
|
|
12368
13036
|
const changeSelectedDevice = checker.changeSelectedDevice.bind(checker);
|
|
@@ -12383,7 +13051,8 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
12383
13051
|
enumarateDevices,
|
|
12384
13052
|
checkPermissions,
|
|
12385
13053
|
checkIfhasMultipleMonitors,
|
|
12386
|
-
onStopSharingScreen
|
|
13054
|
+
onStopSharingScreen,
|
|
13055
|
+
signInTerms
|
|
12387
13056
|
};
|
|
12388
13057
|
}
|
|
12389
13058
|
|