easyproctor 2.1.0 → 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 +10 -0
- package/errors/errors.d.ts +1 -0
- package/esm/index.js +856 -148
- package/index.js +856 -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 +6 -1
- 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 +8 -2
- package/new-flow/recorders/IRecorder.d.ts +3 -1
- package/package.json +2 -2
- package/plugins/insights.d.ts +3 -2
- package/plugins/recorder.d.ts +4 -1
- package/proctoring/SignTerm.d.ts +15 -0
- package/proctoring/options/ProctoringOptions.d.ts +1 -0
- package/proctoring/options/ProctoringVideoOptions.d.ts +1 -0
- package/proctoring/proctoring.d.ts +2 -1
- package/proctoring/useProctoring.d.ts +3 -2
- package/unpkg/easyproctor.min.js +34 -25
package/esm/index.js
CHANGED
|
@@ -4510,34 +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
|
-
|
|
4541
4513
|
// node_modules/axios/lib/helpers/bind.js
|
|
4542
4514
|
function bind(fn3, thisArg) {
|
|
4543
4515
|
return function wrap() {
|
|
@@ -6635,21 +6607,21 @@ var BackendService = class {
|
|
|
6635
6607
|
});
|
|
6636
6608
|
return url.data;
|
|
6637
6609
|
}
|
|
6638
|
-
async getSignedUrl(token, file,
|
|
6610
|
+
async getSignedUrl(token, file, proctoringId2) {
|
|
6639
6611
|
const url = await this.makeRequestAxios({
|
|
6640
6612
|
path: `/upload/signed-url`,
|
|
6641
6613
|
method: "POST",
|
|
6642
6614
|
jwt: token,
|
|
6643
6615
|
body: {
|
|
6644
|
-
objectName: `${
|
|
6616
|
+
objectName: `${proctoringId2}/${file.name}`,
|
|
6645
6617
|
contentType: file.type
|
|
6646
6618
|
}
|
|
6647
6619
|
});
|
|
6648
6620
|
return url.data;
|
|
6649
6621
|
}
|
|
6650
|
-
async
|
|
6622
|
+
async saveAlerts(proctoringOptions, proctoringSession) {
|
|
6651
6623
|
await this.makeRequest({
|
|
6652
|
-
path: "/proctoring/save-
|
|
6624
|
+
path: "/proctoring/save-alerts",
|
|
6653
6625
|
method: "POST",
|
|
6654
6626
|
jwt: proctoringOptions.token,
|
|
6655
6627
|
body: {
|
|
@@ -6689,6 +6661,22 @@ var BackendService = class {
|
|
|
6689
6661
|
jwt: this.token
|
|
6690
6662
|
});
|
|
6691
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
|
+
}
|
|
6692
6680
|
async getServerHour(token) {
|
|
6693
6681
|
return await this.makeRequest({
|
|
6694
6682
|
path: `/Proctoring/server-hour`,
|
|
@@ -6756,6 +6744,77 @@ var BackendService = class {
|
|
|
6756
6744
|
}
|
|
6757
6745
|
};
|
|
6758
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
|
+
|
|
6759
6818
|
// src/new-flow/proctoring/ProctoringSession.ts
|
|
6760
6819
|
var ProctoringSession = class {
|
|
6761
6820
|
constructor() {
|
|
@@ -6787,8 +6846,8 @@ var ProctoringSession = class {
|
|
|
6787
6846
|
this.state = "Ended" /* Ended */;
|
|
6788
6847
|
this.sessionDuration = Date.now() - this.startedAt.getTime();
|
|
6789
6848
|
}
|
|
6790
|
-
setProctoringId(
|
|
6791
|
-
this.id =
|
|
6849
|
+
setProctoringId(proctoringId2) {
|
|
6850
|
+
this.id = proctoringId2;
|
|
6792
6851
|
}
|
|
6793
6852
|
setEndConfirmed() {
|
|
6794
6853
|
this.state = "EndConfirmed" /* EndConfirmed */;
|
|
@@ -6807,6 +6866,164 @@ var ProctoringSession = class {
|
|
|
6807
6866
|
}
|
|
6808
6867
|
};
|
|
6809
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
|
+
|
|
6810
7027
|
// src/plugins/insights.ts
|
|
6811
7028
|
var backendService;
|
|
6812
7029
|
var init = (backend) => {
|
|
@@ -6817,53 +7034,81 @@ var eventNames = {
|
|
|
6817
7034
|
START: "start",
|
|
6818
7035
|
FINISH: "finish",
|
|
6819
7036
|
ERROR: "error",
|
|
6820
|
-
|
|
7037
|
+
UPLOAD: "upload",
|
|
7038
|
+
UPLOAD_FILE: "upload_file",
|
|
7039
|
+
DOWNLOAD_VIDEO: "download_video",
|
|
6821
7040
|
BUFFER_SIZE: "buffer_size",
|
|
6822
7041
|
ANOTHER_STREAM: "another_stream",
|
|
6823
|
-
|
|
7042
|
+
CHANGE_DEVICE: "change_device",
|
|
7043
|
+
STOP_SHARING_SCREEN: "stop_sharing_screen",
|
|
7044
|
+
ERROR_RECORDER_RTC: "error_recorder_rtc",
|
|
7045
|
+
BROWSER_NOT_SUPPORTED: "browser_not_supported",
|
|
7046
|
+
SAVE_ON_SESSION: "save_on_session"
|
|
6824
7047
|
};
|
|
6825
7048
|
var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
|
|
6826
7049
|
var trackers = {
|
|
6827
|
-
registerStart: (
|
|
6828
|
-
registerFinish: (
|
|
6829
|
-
registerError: (
|
|
6830
|
-
registerBrowserNotSupported: (
|
|
6831
|
-
registerUpload: (
|
|
6832
|
-
registerUploadFile: (
|
|
6833
|
-
registerChangeDevice: (
|
|
6834
|
-
registerStopSharingScreen: (
|
|
6835
|
-
registerErrorRecorderRTC: (
|
|
6836
|
-
|
|
6837
|
-
|
|
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 })
|
|
6838
7063
|
};
|
|
6839
7064
|
|
|
6840
7065
|
// src/plugins/recorder.ts
|
|
6841
|
-
|
|
7066
|
+
var proctoringId;
|
|
7067
|
+
function setRecorderProctoringId(id) {
|
|
7068
|
+
proctoringId = id;
|
|
7069
|
+
}
|
|
7070
|
+
function recorder(stream, buffer, onBufferSizeError = false, onBufferSizeErrorCallback, audio = false) {
|
|
6842
7071
|
let resolvePromise;
|
|
6843
7072
|
let stopped = false;
|
|
6844
7073
|
let onBufferSizeInterval;
|
|
6845
7074
|
let lastEvent;
|
|
6846
|
-
let
|
|
7075
|
+
let bufferSize;
|
|
7076
|
+
bufferSize = 0;
|
|
7077
|
+
let recorderOptions = {
|
|
6847
7078
|
mimeType: "video/webm",
|
|
6848
7079
|
videoBitsPerSecond: 128e3,
|
|
6849
7080
|
audioBitsPerSecond: 64 * 1e3
|
|
6850
7081
|
};
|
|
7082
|
+
if (MediaRecorder.isTypeSupported("video/webm;codecs=vp9")) {
|
|
7083
|
+
recorderOptions.mimeType = "video/webm;codecs=vp9";
|
|
7084
|
+
} else {
|
|
7085
|
+
console.warn(
|
|
7086
|
+
"vp9 codec not supported. Using default mimeType without vp9."
|
|
7087
|
+
);
|
|
7088
|
+
}
|
|
6851
7089
|
if (audio) {
|
|
6852
|
-
|
|
7090
|
+
recorderOptions = {
|
|
6853
7091
|
mimeType: "audio/webm",
|
|
6854
7092
|
audioBitsPerSecond: 64 * 1e3
|
|
6855
7093
|
};
|
|
6856
7094
|
}
|
|
6857
|
-
const mediaRecorder = new MediaRecorder(stream,
|
|
7095
|
+
const mediaRecorder = new MediaRecorder(stream, recorderOptions);
|
|
6858
7096
|
mediaRecorder.ondataavailable = (e3) => {
|
|
7097
|
+
bufferSize = bufferSize + e3.data.size;
|
|
6859
7098
|
if (e3.data.size > 0) {
|
|
6860
7099
|
buffer.push(e3.data);
|
|
6861
7100
|
}
|
|
6862
7101
|
if (!stopped) {
|
|
6863
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
|
+
);
|
|
6864
7111
|
onBufferSizeErrorCallback && onBufferSizeErrorCallback();
|
|
6865
|
-
proctoringId && lastEvent && e3.data.size === lastEvent.data.size && trackers.registerOnBufferSizeError(proctoringId, `onBufferSizeError: Recorder size freezed: ${e3.data.size} Mb`);
|
|
6866
|
-
proctoringId && e3.data.size === 0 && trackers.registerOnBufferSizeError(proctoringId, `onBufferSizeError: Recorder size equal 0 Mb`);
|
|
6867
7112
|
}
|
|
6868
7113
|
lastEvent = e3;
|
|
6869
7114
|
} else {
|
|
@@ -6878,6 +7123,7 @@ function recorder(stream, buffer, proctoringId, onBufferSizeError = false, onBuf
|
|
|
6878
7123
|
return new Promise((resolve) => {
|
|
6879
7124
|
resolvePromise = resolve;
|
|
6880
7125
|
mediaRecorder.start();
|
|
7126
|
+
bufferSize = 0;
|
|
6881
7127
|
stopped = false;
|
|
6882
7128
|
if (onBufferSizeError) {
|
|
6883
7129
|
onBufferSizeInterval = setInterval(async () => {
|
|
@@ -6921,17 +7167,27 @@ function recorder(stream, buffer, proctoringId, onBufferSizeError = false, onBuf
|
|
|
6921
7167
|
}
|
|
6922
7168
|
});
|
|
6923
7169
|
}
|
|
6924
|
-
|
|
7170
|
+
function getBufferSize() {
|
|
7171
|
+
return bufferSize;
|
|
7172
|
+
}
|
|
7173
|
+
return {
|
|
7174
|
+
startRecording,
|
|
7175
|
+
stopRecording,
|
|
7176
|
+
pauseRecording,
|
|
7177
|
+
resumeRecording,
|
|
7178
|
+
recorderOptions,
|
|
7179
|
+
getBufferSize
|
|
7180
|
+
};
|
|
6925
7181
|
}
|
|
6926
7182
|
|
|
6927
7183
|
// src/new-flow/upload/UploadService.ts
|
|
6928
7184
|
var UploadService = class {
|
|
6929
|
-
constructor(
|
|
7185
|
+
constructor(proctoringId2, backend) {
|
|
6930
7186
|
this.backend = backend;
|
|
6931
7187
|
this.imageUrlPackage = [];
|
|
6932
7188
|
this.imageBatchNum = 0;
|
|
6933
7189
|
this.contImages = 0;
|
|
6934
|
-
this.proctoringId =
|
|
7190
|
+
this.proctoringId = proctoringId2;
|
|
6935
7191
|
}
|
|
6936
7192
|
async uploadImages(data, token, packSize) {
|
|
6937
7193
|
const { file, onProgress } = data;
|
|
@@ -7073,6 +7329,7 @@ var STREAM_UNDER_MINIMUM_PERMITTED = "stream_under_minimum_permitted";
|
|
|
7073
7329
|
var BROWSER_NOT_SUPPORTED = "browser_not_supported";
|
|
7074
7330
|
var TOKEN_MISSING = "token_missing";
|
|
7075
7331
|
var CREDENTIALS_MISSING = "credentials_missing";
|
|
7332
|
+
var SPY_SCAN_API_NOT_FOUND = "spy_scan_api_not_found";
|
|
7076
7333
|
|
|
7077
7334
|
// src/modules/objectDetection.ts
|
|
7078
7335
|
var ObjectDetection = class extends BaseDetection {
|
|
@@ -7230,7 +7487,7 @@ var CameraRecorder = class {
|
|
|
7230
7487
|
cameraId: void 0,
|
|
7231
7488
|
microphoneId: void 0,
|
|
7232
7489
|
onBufferSizeError: false,
|
|
7233
|
-
onBufferSizeErrorCallback: () => {
|
|
7490
|
+
onBufferSizeErrorCallback: (cameraStream) => {
|
|
7234
7491
|
},
|
|
7235
7492
|
proctoringType: "IMAGE",
|
|
7236
7493
|
onChangeDevicesCallback: (devices) => {
|
|
@@ -7247,6 +7504,7 @@ var CameraRecorder = class {
|
|
|
7247
7504
|
this.blobsRTC = [];
|
|
7248
7505
|
this.imageCount = 0;
|
|
7249
7506
|
this.filesToUpload = [];
|
|
7507
|
+
this.currentRetries = 0;
|
|
7250
7508
|
this.noiseWait = 20;
|
|
7251
7509
|
this.options = options;
|
|
7252
7510
|
this.videoOptions = videoOptions;
|
|
@@ -7254,19 +7512,30 @@ var CameraRecorder = class {
|
|
|
7254
7512
|
this.backendToken = backendToken;
|
|
7255
7513
|
paramsConfig && (this.paramsConfig = paramsConfig);
|
|
7256
7514
|
}
|
|
7257
|
-
setProctoringId(
|
|
7258
|
-
this.proctoringId =
|
|
7515
|
+
setProctoringId(proctoringId2) {
|
|
7516
|
+
this.proctoringId = proctoringId2;
|
|
7259
7517
|
this.proctoringId && this.backend && (this.upload = new UploadService(this.proctoringId, this.backend));
|
|
7518
|
+
setRecorderProctoringId(proctoringId2);
|
|
7260
7519
|
}
|
|
7261
7520
|
async initializeDetectors() {
|
|
7262
7521
|
var _a2, _b, _c2;
|
|
7263
7522
|
buildVideoPreview();
|
|
7264
7523
|
if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone)) {
|
|
7265
|
-
this.objectDetection = new ObjectDetection(
|
|
7524
|
+
this.objectDetection = new ObjectDetection(
|
|
7525
|
+
{
|
|
7526
|
+
onRealtimeAlertsCallback: (response) => this.options.onRealtimeAlertsCallback(response)
|
|
7527
|
+
},
|
|
7528
|
+
this.paramsConfig
|
|
7529
|
+
);
|
|
7266
7530
|
await this.objectDetection.initializeDetector();
|
|
7267
7531
|
}
|
|
7268
7532
|
if ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace) {
|
|
7269
|
-
this.faceDetection = new FaceDetection(
|
|
7533
|
+
this.faceDetection = new FaceDetection(
|
|
7534
|
+
{
|
|
7535
|
+
onRealtimeAlertsCallback: (response) => this.options.onRealtimeAlertsCallback(response)
|
|
7536
|
+
},
|
|
7537
|
+
this.paramsConfig
|
|
7538
|
+
);
|
|
7270
7539
|
await this.faceDetection.initializeDetector();
|
|
7271
7540
|
}
|
|
7272
7541
|
}
|
|
@@ -7279,9 +7548,25 @@ var CameraRecorder = class {
|
|
|
7279
7548
|
this.canvas.width = this.videoOptions.width;
|
|
7280
7549
|
this.canvas.height = this.videoOptions.height;
|
|
7281
7550
|
}
|
|
7282
|
-
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) {
|
|
7283
7568
|
var _a2, _b, _c2, _d, _e3, _f, _g;
|
|
7284
|
-
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)) {
|
|
7285
7570
|
await this.initializeDetectors();
|
|
7286
7571
|
}
|
|
7287
7572
|
const { cameraId, microphoneId, onBufferSizeErrorCallback } = this.options;
|
|
@@ -7295,26 +7580,50 @@ var CameraRecorder = class {
|
|
|
7295
7580
|
}
|
|
7296
7581
|
};
|
|
7297
7582
|
try {
|
|
7298
|
-
this.cameraStream = await navigator.mediaDevices.getUserMedia(
|
|
7583
|
+
this.cameraStream = await navigator.mediaDevices.getUserMedia(
|
|
7584
|
+
constraints
|
|
7585
|
+
);
|
|
7299
7586
|
} catch (error) {
|
|
7300
7587
|
if (error.toString() == "NotReadableError: Could not start video source")
|
|
7301
7588
|
throw "N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa";
|
|
7302
7589
|
throw error;
|
|
7303
7590
|
}
|
|
7304
|
-
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
|
+
);
|
|
7305
7605
|
this.recordingStart = startRecording;
|
|
7306
7606
|
this.recordingStop = stopRecording;
|
|
7307
7607
|
this.recordingPause = pauseRecording;
|
|
7308
7608
|
this.recordingResume = resumeRecording;
|
|
7609
|
+
this.recorderOptions = recorderOptions;
|
|
7610
|
+
this.getBufferSize = getBufferSize;
|
|
7309
7611
|
this.recordingStart();
|
|
7310
7612
|
const tracks = this.cameraStream.getVideoTracks();
|
|
7311
7613
|
const settings = tracks[0].getSettings();
|
|
7312
7614
|
if (this.videoOptions.minWidth > settings.width || this.videoOptions.minHeight > settings.height) {
|
|
7313
7615
|
throw STREAM_UNDER_MINIMUM_PERMITTED;
|
|
7314
7616
|
} else if (this.videoOptions.width !== settings.width || this.videoOptions.height !== settings.height) {
|
|
7315
|
-
trackers.registerAnotherStream(
|
|
7316
|
-
|
|
7317
|
-
|
|
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
|
+
);
|
|
7318
7627
|
throw ANOTHER_STREAM_ACTIVE;
|
|
7319
7628
|
}
|
|
7320
7629
|
((_d = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _d.useUploadImage) && this.options.proctoringType == "IMAGE" && this.photoShotsCycle();
|
|
@@ -7338,8 +7647,13 @@ Setting: ${settings}`);
|
|
|
7338
7647
|
const packSize = this.paramsConfig.imageBehaviourParameters.uploadInterval;
|
|
7339
7648
|
for (let i3 = 0; i3 < size; i3++) {
|
|
7340
7649
|
if (i3 == size - 1 && this.filesToUpload[0]) {
|
|
7341
|
-
const imageName = this.filesToUpload[0].name.replace(
|
|
7342
|
-
|
|
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
|
+
});
|
|
7343
7657
|
this.filesToUpload[0] = file;
|
|
7344
7658
|
}
|
|
7345
7659
|
this.filesToUpload[0] && await this.upload.uploadImages(
|
|
@@ -7365,9 +7679,19 @@ Setting: ${settings}`);
|
|
|
7365
7679
|
let imageFile;
|
|
7366
7680
|
this.configImageCapture();
|
|
7367
7681
|
this.imageInterval = setInterval(async () => {
|
|
7368
|
-
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
|
+
);
|
|
7369
7689
|
const image_data_url = this.canvas.toDataURL("image/jpeg");
|
|
7370
|
-
imageFile = await this.getFile(
|
|
7690
|
+
imageFile = await this.getFile(
|
|
7691
|
+
image_data_url,
|
|
7692
|
+
`${this.proctoringId}_${this.imageCount + 1}.jpg`,
|
|
7693
|
+
"image/jpeg"
|
|
7694
|
+
);
|
|
7371
7695
|
if (imageFile && this.upload && this.backendToken) {
|
|
7372
7696
|
this.upload.upload(
|
|
7373
7697
|
{
|
|
@@ -7459,16 +7783,24 @@ Setting: ${settings}`);
|
|
|
7459
7783
|
window.URL.revokeObjectURL(url);
|
|
7460
7784
|
}
|
|
7461
7785
|
async saveOnSession(session) {
|
|
7462
|
-
var _a2;
|
|
7786
|
+
var _a2, _b;
|
|
7787
|
+
if (this.blobs != null)
|
|
7788
|
+
trackers.registerSaveOnSession(
|
|
7789
|
+
this.proctoringId,
|
|
7790
|
+
`Blobs Length: ${this.blobs.length} Buffer Size: ${this.getBufferSize()} `
|
|
7791
|
+
);
|
|
7463
7792
|
const settings = this.cameraStream.getVideoTracks()[0].getSettings();
|
|
7464
7793
|
const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
|
|
7465
7794
|
if (this.options.proctoringType == "VIDEO" || this.options.proctoringType == "REALTIME" || this.options.proctoringType == "IMAGE" && ((_a2 = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _a2.saveVideo)) {
|
|
7466
7795
|
session.addRecording({
|
|
7467
7796
|
device: `Audio
|
|
7468
7797
|
Sample Rate: ${settingsAudio.sampleRate}
|
|
7469
|
-
Sample Size: ${settingsAudio.sampleSize}
|
|
7798
|
+
Sample Size: ${settingsAudio.sampleSize}
|
|
7799
|
+
|
|
7800
|
+
Video:
|
|
7801
|
+
${JSON.stringify(this.recorderOptions)}`,
|
|
7470
7802
|
file: new File(this.blobs, `EP_${session.id}_camera_0.webm`, {
|
|
7471
|
-
type: "video/webm"
|
|
7803
|
+
type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
|
|
7472
7804
|
}),
|
|
7473
7805
|
origin: "Camera" /* Camera */
|
|
7474
7806
|
});
|
|
@@ -7786,10 +8118,29 @@ var DeviceCheckerUI = class {
|
|
|
7786
8118
|
checkmark_AmbientVerify.appendChild(checkmark_kick_AmbientVerify);
|
|
7787
8119
|
alertDivAmbientVerify.appendChild(checkmark_AmbientVerify);
|
|
7788
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);
|
|
7789
8139
|
center.style.transform = "rotateY(180deg)";
|
|
7790
8140
|
center.appendChild(alertDivResolution);
|
|
7791
8141
|
center.appendChild(alertDivFacePosition);
|
|
7792
8142
|
center.appendChild(alertDivAmbientVerify);
|
|
8143
|
+
center.appendChild(alertDivSpyCam);
|
|
7793
8144
|
divCamera.appendChild(center);
|
|
7794
8145
|
videoDiv.appendChild(video);
|
|
7795
8146
|
divCamera.appendChild(videoDiv);
|
|
@@ -7968,10 +8319,13 @@ var DeviceCheckerUI = class {
|
|
|
7968
8319
|
fontWeight: "bold",
|
|
7969
8320
|
borderRadius: "10px",
|
|
7970
8321
|
paddingTop: "5px",
|
|
7971
|
-
paddingBottom: "5px"
|
|
7972
|
-
disabled: true
|
|
8322
|
+
paddingBottom: "5px"
|
|
7973
8323
|
};
|
|
7974
8324
|
this.applyStyles(button, buttonStyles);
|
|
8325
|
+
if (this.options.useSpyScan) {
|
|
8326
|
+
button.style.cursor = "not-allowed";
|
|
8327
|
+
button.setAttribute("disabled", "true");
|
|
8328
|
+
}
|
|
7975
8329
|
divBtn.appendChild(buttonCancel);
|
|
7976
8330
|
divBtn.appendChild(divider);
|
|
7977
8331
|
divBtn.appendChild(button);
|
|
@@ -8031,6 +8385,8 @@ var DeviceCheckerUI = class {
|
|
|
8031
8385
|
});
|
|
8032
8386
|
});
|
|
8033
8387
|
confirmBtn == null ? void 0 : confirmBtn.addEventListener("click", () => {
|
|
8388
|
+
if (confirmBtn.disabled)
|
|
8389
|
+
return;
|
|
8034
8390
|
closeCheckDevices();
|
|
8035
8391
|
this.closeModal();
|
|
8036
8392
|
resolve({
|
|
@@ -8081,6 +8437,68 @@ var DeviceCheckerUI = class {
|
|
|
8081
8437
|
}
|
|
8082
8438
|
}
|
|
8083
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
|
+
}
|
|
8084
8502
|
isUnderResolutionUI(allowedResolution) {
|
|
8085
8503
|
const error = document.getElementById("resolutionAlert");
|
|
8086
8504
|
const alertDivResolution = document.getElementById("alertDivResolution");
|
|
@@ -8217,7 +8635,12 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
|
|
|
8217
8635
|
// src/new-flow/checkers/DeviceCheckerService.ts
|
|
8218
8636
|
var _DeviceCheckerService = class {
|
|
8219
8637
|
constructor(context) {
|
|
8220
|
-
this.videoOptions = {
|
|
8638
|
+
this.videoOptions = {
|
|
8639
|
+
width: 1080,
|
|
8640
|
+
height: 720,
|
|
8641
|
+
minWidth: 0,
|
|
8642
|
+
minHeight: 0
|
|
8643
|
+
};
|
|
8221
8644
|
this.volumeMedia = 0;
|
|
8222
8645
|
this.volumeSum = 0;
|
|
8223
8646
|
this.volumeCounter = 0;
|
|
@@ -8226,8 +8649,16 @@ var _DeviceCheckerService = class {
|
|
|
8226
8649
|
this.allowedAmbient = true;
|
|
8227
8650
|
this.allowedPositionFace = true;
|
|
8228
8651
|
this.allowedMicrophone = false;
|
|
8652
|
+
this.allowedSpyScan = null;
|
|
8229
8653
|
this.noiseLimit = 0;
|
|
8230
|
-
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
|
+
);
|
|
8231
8662
|
this.context = context;
|
|
8232
8663
|
this.backend = new BackendService({
|
|
8233
8664
|
type: (context == null ? void 0 : context.type) || "prod",
|
|
@@ -8238,41 +8669,55 @@ var _DeviceCheckerService = class {
|
|
|
8238
8669
|
if (_DeviceCheckerService.isModalOpen) {
|
|
8239
8670
|
return Promise.reject("Modal j\xE1 est\xE1 aberto");
|
|
8240
8671
|
}
|
|
8672
|
+
this.options = {
|
|
8673
|
+
...getDefaultProctoringOptions,
|
|
8674
|
+
...options,
|
|
8675
|
+
captureScreen: false,
|
|
8676
|
+
allowMultipleMonitors: true,
|
|
8677
|
+
allowOnlyFirstMonitor: false
|
|
8678
|
+
};
|
|
8241
8679
|
_DeviceCheckerService.isModalOpen = true;
|
|
8242
8680
|
try {
|
|
8243
8681
|
await this.faceDetection.initializeDetector();
|
|
8244
|
-
const { cameraStream } = await this.startCheckDevices(
|
|
8682
|
+
const { cameraStream } = await this.startCheckDevices(
|
|
8683
|
+
options,
|
|
8684
|
+
_videoOptions
|
|
8685
|
+
);
|
|
8686
|
+
this.checkSpyScan();
|
|
8245
8687
|
const returnData = { cameraStream: this.cameraRecorder.cameraStream };
|
|
8246
8688
|
this.onUpdateCb = (e3) => onUpdate(e3);
|
|
8247
|
-
const resultPromise = new Promise(
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
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;
|
|
8260
8706
|
});
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8707
|
+
onModalCancel(() => {
|
|
8708
|
+
this.closeCheckDevices();
|
|
8709
|
+
resolve({
|
|
8710
|
+
result: false
|
|
8711
|
+
});
|
|
8712
|
+
_DeviceCheckerService.isModalOpen = false;
|
|
8267
8713
|
});
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
});
|
|
8714
|
+
}
|
|
8715
|
+
);
|
|
8271
8716
|
return { ...returnData, result: resultPromise };
|
|
8272
8717
|
} catch (error) {
|
|
8273
8718
|
this.closeCheckDevices();
|
|
8274
8719
|
_DeviceCheckerService.isModalOpen = false;
|
|
8275
|
-
|
|
8720
|
+
throw error;
|
|
8276
8721
|
}
|
|
8277
8722
|
}
|
|
8278
8723
|
onUpdateCallback() {
|
|
@@ -8282,11 +8727,12 @@ var _DeviceCheckerService = class {
|
|
|
8282
8727
|
allowedPositionFace: this.allowedPositionFace,
|
|
8283
8728
|
allowedAmbient: this.allowedAmbient,
|
|
8284
8729
|
allowedMicrophone: this.allowedMicrophone,
|
|
8730
|
+
allowedSpyScan: this.allowedSpyScan,
|
|
8285
8731
|
faceDetectionAlerts: this.faceDetectionAlerts
|
|
8286
8732
|
});
|
|
8287
8733
|
}
|
|
8288
8734
|
}
|
|
8289
|
-
async checkDevices(options = getDefaultProctoringOptions, _videoOptions) {
|
|
8735
|
+
async checkDevices(options = getDefaultProctoringOptions, _videoOptions = getDefaultProctoringVideoOptions) {
|
|
8290
8736
|
var _a2;
|
|
8291
8737
|
if (_DeviceCheckerService.isModalOpen) {
|
|
8292
8738
|
return Promise.reject();
|
|
@@ -8302,11 +8748,14 @@ var _DeviceCheckerService = class {
|
|
|
8302
8748
|
allowOnlyFirstMonitor: false
|
|
8303
8749
|
};
|
|
8304
8750
|
this.videoOptions = { ...this.videoOptions, ..._videoOptions };
|
|
8305
|
-
const paramsConfig = await this.backend.getParamsConfig(
|
|
8751
|
+
const paramsConfig = await this.backend.getParamsConfig(
|
|
8752
|
+
this.context
|
|
8753
|
+
);
|
|
8306
8754
|
this.noiseLimit = ((_a2 = paramsConfig.audioBehaviourParameters) == null ? void 0 : _a2.noiseLimit) || 40;
|
|
8307
8755
|
await this.faceDetection.initializeDetector();
|
|
8308
8756
|
this.DeviceCheckerUI.checkDevicesInterface();
|
|
8309
8757
|
this.startCheckDevices(options, _videoOptions);
|
|
8758
|
+
await this.checkSpyScan();
|
|
8310
8759
|
const { cameraId, microphoneId, result } = await this.DeviceCheckerUI.modalActions(() => this.closeCheckDevices());
|
|
8311
8760
|
return new Promise((resolve) => {
|
|
8312
8761
|
resolve({
|
|
@@ -8318,6 +8767,7 @@ var _DeviceCheckerService = class {
|
|
|
8318
8767
|
allowedPositionFace: this.allowedPositionFace,
|
|
8319
8768
|
allowedAmbient: this.allowedAmbient,
|
|
8320
8769
|
allowedMicrophone: this.allowedMicrophone,
|
|
8770
|
+
allowedSpyScan: this.allowedSpyScan,
|
|
8321
8771
|
faceDetectionAlerts: this.faceDetectionAlerts
|
|
8322
8772
|
});
|
|
8323
8773
|
});
|
|
@@ -8384,10 +8834,7 @@ var _DeviceCheckerService = class {
|
|
|
8384
8834
|
this.DeviceCheckerUI && this.DeviceCheckerUI.audioDeviceInterfaceUIErrorExec();
|
|
8385
8835
|
});
|
|
8386
8836
|
}
|
|
8387
|
-
async changeSelectedDevice({
|
|
8388
|
-
cameraId,
|
|
8389
|
-
microphoneId
|
|
8390
|
-
}) {
|
|
8837
|
+
async changeSelectedDevice({ cameraId, microphoneId }) {
|
|
8391
8838
|
var _a2;
|
|
8392
8839
|
this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
|
|
8393
8840
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
@@ -8413,7 +8860,10 @@ var _DeviceCheckerService = class {
|
|
|
8413
8860
|
};
|
|
8414
8861
|
}
|
|
8415
8862
|
async startCheckDevices(options = getDefaultProctoringOptions, _videoOptions) {
|
|
8416
|
-
this.DeviceCheckerUI && this.DeviceCheckerUI.setSelectOption(
|
|
8863
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.setSelectOption(
|
|
8864
|
+
options,
|
|
8865
|
+
(e3) => this.changeSelectedDevice(e3)
|
|
8866
|
+
);
|
|
8417
8867
|
this.videoOptions = validatePartialVideoOptions(_videoOptions);
|
|
8418
8868
|
await checkPermissions();
|
|
8419
8869
|
this.cameraRecorder = new CameraRecorder(
|
|
@@ -8434,7 +8884,7 @@ var _DeviceCheckerService = class {
|
|
|
8434
8884
|
this.audioDeviceInterface(this.cameraRecorder.cameraStream);
|
|
8435
8885
|
if (this.DeviceCheckerUI) {
|
|
8436
8886
|
const button = document.querySelector("#confirmBtn");
|
|
8437
|
-
button.disabled = false;
|
|
8887
|
+
!this.options.useSpyScan && (button.disabled = false);
|
|
8438
8888
|
}
|
|
8439
8889
|
return {
|
|
8440
8890
|
cameraStream: this.cameraRecorder.cameraStream
|
|
@@ -8450,6 +8900,39 @@ var _DeviceCheckerService = class {
|
|
|
8450
8900
|
this.DeviceCheckerUI = void 0;
|
|
8451
8901
|
this.onUpdateCb = void 0;
|
|
8452
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
|
+
}
|
|
8453
8936
|
};
|
|
8454
8937
|
var DeviceCheckerService = _DeviceCheckerService;
|
|
8455
8938
|
DeviceCheckerService.isModalOpen = false;
|
|
@@ -8811,9 +9294,9 @@ var Extension = class {
|
|
|
8811
9294
|
|
|
8812
9295
|
// src/modules/onChangeDevices.ts
|
|
8813
9296
|
var onChangeDevices = class {
|
|
8814
|
-
constructor(repositoryDevices,
|
|
9297
|
+
constructor(repositoryDevices, proctoringId2) {
|
|
8815
9298
|
this.repositoryDevices = repositoryDevices;
|
|
8816
|
-
this.proctoringId =
|
|
9299
|
+
this.proctoringId = proctoringId2;
|
|
8817
9300
|
}
|
|
8818
9301
|
startRecording(options) {
|
|
8819
9302
|
navigator.mediaDevices.ondevicechange = () => {
|
|
@@ -8844,7 +9327,7 @@ var onChangeDevices = class {
|
|
|
8844
9327
|
};
|
|
8845
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" });
|
|
8846
9329
|
if (options.status && (devicesChanged.cameras.length != 0 || devicesChanged.microphones.length != 0)) {
|
|
8847
|
-
trackers.registerChangeDevice(this.proctoringId, devicesChanged.status, devicesChanged);
|
|
9330
|
+
trackers.registerChangeDevice(this.proctoringId, devicesChanged.status, JSON.stringify(devicesChanged, null, 2));
|
|
8848
9331
|
options.status(devicesChanged);
|
|
8849
9332
|
}
|
|
8850
9333
|
}
|
|
@@ -8853,18 +9336,26 @@ var onChangeDevices = class {
|
|
|
8853
9336
|
// src/new-flow/download/downloadService.ts
|
|
8854
9337
|
var import_file_saver = __toESM(require_FileSaver_min());
|
|
8855
9338
|
var DownloadService = class {
|
|
8856
|
-
constructor(
|
|
9339
|
+
constructor(proctoringId2) {
|
|
8857
9340
|
this.loadingBoolean = true;
|
|
8858
|
-
this.proctoringId =
|
|
9341
|
+
this.proctoringId = proctoringId2;
|
|
8859
9342
|
}
|
|
8860
9343
|
async upload(data, token) {
|
|
9344
|
+
const { file, onProgress } = data;
|
|
8861
9345
|
try {
|
|
8862
|
-
|
|
9346
|
+
trackers.registerDownloadFile(this.proctoringId, `File to download
|
|
9347
|
+
File name: ${file.name}
|
|
9348
|
+
File type: ${file.type}
|
|
9349
|
+
File size: ${file.size}}`);
|
|
8863
9350
|
(0, import_file_saver.saveAs)(file);
|
|
8864
9351
|
this.loadingBoolean = false;
|
|
8865
9352
|
clearInterval(this.loadingInterval);
|
|
8866
9353
|
onProgress && onProgress(Math.round(100));
|
|
8867
9354
|
} catch (err) {
|
|
9355
|
+
file && this.proctoringId && trackers.registerError(this.proctoringId, `Failed on machine download
|
|
9356
|
+
File name: ${file.name}
|
|
9357
|
+
File type: ${file.type}
|
|
9358
|
+
File size: ${file.size}`);
|
|
8868
9359
|
throw new Error(`Error on machine download`);
|
|
8869
9360
|
}
|
|
8870
9361
|
}
|
|
@@ -8879,7 +9370,7 @@ var ProctoringRecorder = class {
|
|
|
8879
9370
|
async startAll() {
|
|
8880
9371
|
this.session.start();
|
|
8881
9372
|
for (const rec of this.recorders) {
|
|
8882
|
-
await rec.startRecording();
|
|
9373
|
+
await rec.startRecording({ retry: false });
|
|
8883
9374
|
}
|
|
8884
9375
|
}
|
|
8885
9376
|
async pauseAll() {
|
|
@@ -8909,9 +9400,9 @@ var ProctoringRecorder = class {
|
|
|
8909
9400
|
|
|
8910
9401
|
// src/new-flow/proctoring/ProctoringUploader.ts
|
|
8911
9402
|
var ProctoringUploader = class {
|
|
8912
|
-
constructor(session,
|
|
9403
|
+
constructor(session, proctoringId2, uploadServices) {
|
|
8913
9404
|
this.session = session;
|
|
8914
|
-
this.proctoringId =
|
|
9405
|
+
this.proctoringId = proctoringId2;
|
|
8915
9406
|
this.uploadServices = uploadServices;
|
|
8916
9407
|
}
|
|
8917
9408
|
async upload(token, progress) {
|
|
@@ -9033,7 +9524,8 @@ var AlertRecorder = class {
|
|
|
9033
9524
|
this.alerts.push({
|
|
9034
9525
|
begin: Date.now() - this.startTime.getTime(),
|
|
9035
9526
|
end: 0,
|
|
9036
|
-
alert: 25 /* LostFocus
|
|
9527
|
+
alert: 25 /* LostFocus */,
|
|
9528
|
+
type: 3 /* Screen */
|
|
9037
9529
|
});
|
|
9038
9530
|
}
|
|
9039
9531
|
}
|
|
@@ -9065,7 +9557,7 @@ var AudioRecorder = class {
|
|
|
9065
9557
|
audio: { deviceId: this.options.microphoneId || "default" }
|
|
9066
9558
|
};
|
|
9067
9559
|
this.audioStream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
9068
|
-
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);
|
|
9069
9561
|
this.recordingStart = startRecording;
|
|
9070
9562
|
this.recordingStop = stopRecording;
|
|
9071
9563
|
this.recordingPause = pauseRecording;
|
|
@@ -11380,8 +11872,8 @@ var NoiseRecorder = class {
|
|
|
11380
11872
|
this.backend = backend;
|
|
11381
11873
|
this.backendToken = backendToken;
|
|
11382
11874
|
}
|
|
11383
|
-
setProctoringId(
|
|
11384
|
-
this.proctoringId =
|
|
11875
|
+
setProctoringId(proctoringId2) {
|
|
11876
|
+
this.proctoringId = proctoringId2;
|
|
11385
11877
|
this.proctoringId && this.backend && (this.upload = new UploadService(this.proctoringId, this.backend));
|
|
11386
11878
|
}
|
|
11387
11879
|
async startRecording() {
|
|
@@ -11592,8 +12084,9 @@ var ScreenRecorder = class {
|
|
|
11592
12084
|
this.blobsFinal = [];
|
|
11593
12085
|
this.options = options;
|
|
11594
12086
|
}
|
|
11595
|
-
setProctoringId(
|
|
11596
|
-
this.proctoringId =
|
|
12087
|
+
setProctoringId(proctoringId2) {
|
|
12088
|
+
this.proctoringId = proctoringId2;
|
|
12089
|
+
setRecorderProctoringId(proctoringId2);
|
|
11597
12090
|
}
|
|
11598
12091
|
async startRecording() {
|
|
11599
12092
|
this.startTime = new Date(Date.now());
|
|
@@ -11641,7 +12134,7 @@ var ScreenRecorder = class {
|
|
|
11641
12134
|
});
|
|
11642
12135
|
throw NOT_SHARED_SCREEN;
|
|
11643
12136
|
}
|
|
11644
|
-
const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs, this.
|
|
12137
|
+
const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs, this.options.onBufferSizeError, onBufferSizeErrorCallback);
|
|
11645
12138
|
this.recordingStart = startRecording;
|
|
11646
12139
|
this.recordingStop = stopRecording;
|
|
11647
12140
|
this.recordingStart();
|
|
@@ -11898,7 +12391,7 @@ var Proctoring = class {
|
|
|
11898
12391
|
this.onRealtimeAlertsCallback = (response) => {
|
|
11899
12392
|
return;
|
|
11900
12393
|
};
|
|
11901
|
-
this.onBufferSizeErrorCallback = () => {
|
|
12394
|
+
this.onBufferSizeErrorCallback = (cameraStream) => {
|
|
11902
12395
|
return;
|
|
11903
12396
|
};
|
|
11904
12397
|
var _a2;
|
|
@@ -11940,7 +12433,7 @@ var Proctoring = class {
|
|
|
11940
12433
|
this.onRealtimeAlertsCallback = (response) => options.data && options.data(response);
|
|
11941
12434
|
}
|
|
11942
12435
|
setOnBufferSizeErrorCallback(cb) {
|
|
11943
|
-
this.onBufferSizeErrorCallback = () => cb();
|
|
12436
|
+
this.onBufferSizeErrorCallback = (cameraStream) => cb(cameraStream);
|
|
11944
12437
|
}
|
|
11945
12438
|
createRecorders(options = getDefaultProctoringOptions) {
|
|
11946
12439
|
var _a2, _b;
|
|
@@ -11950,7 +12443,7 @@ var Proctoring = class {
|
|
|
11950
12443
|
cameraId: this.sessionOptions.cameraId,
|
|
11951
12444
|
microphoneId: this.sessionOptions.microphoneId,
|
|
11952
12445
|
onBufferSizeError: this.sessionOptions.onBufferSizeError,
|
|
11953
|
-
onBufferSizeErrorCallback: () => this.onBufferSizeErrorCallback(),
|
|
12446
|
+
onBufferSizeErrorCallback: (cameraStream) => this.onBufferSizeErrorCallback(cameraStream),
|
|
11954
12447
|
proctoringType: this.sessionOptions.proctoringType,
|
|
11955
12448
|
onChangeDevicesCallback: (devices) => this.onChangeDevicesCallback(devices),
|
|
11956
12449
|
onRealtimeAlertsCallback: (response) => this.onRealtimeAlertsCallback(response)
|
|
@@ -12004,6 +12497,7 @@ var Proctoring = class {
|
|
|
12004
12497
|
this.context.token = await this.auth.login();
|
|
12005
12498
|
}
|
|
12006
12499
|
async start(options = getDefaultProctoringOptions, _videoOptions = {}) {
|
|
12500
|
+
var _a2;
|
|
12007
12501
|
try {
|
|
12008
12502
|
if (this.context.token === void 0) {
|
|
12009
12503
|
throw TOKEN_MISSING;
|
|
@@ -12018,6 +12512,13 @@ var Proctoring = class {
|
|
|
12018
12512
|
await this.initConfig(options.useGeolocation);
|
|
12019
12513
|
await this.verifyBrowser();
|
|
12020
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
|
+
}
|
|
12021
12522
|
if (this.state != "Stop" /* Stop */) {
|
|
12022
12523
|
throw PROCTORING_ALREADY_STARTED;
|
|
12023
12524
|
}
|
|
@@ -12042,6 +12543,12 @@ var Proctoring = class {
|
|
|
12042
12543
|
this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
|
|
12043
12544
|
this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
|
|
12044
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
|
+
}
|
|
12045
12552
|
await this.repository.save(this.proctoringSession);
|
|
12046
12553
|
const _navigator = {};
|
|
12047
12554
|
for (const i3 in navigator)
|
|
@@ -12075,6 +12582,7 @@ Error: ${error}`
|
|
|
12075
12582
|
async cancel() {
|
|
12076
12583
|
if (this.state === "Recording" /* Recording */ || this.state === "Starting" /* Starting */) {
|
|
12077
12584
|
await this.recorder.stopAll();
|
|
12585
|
+
this.spyCam && await this.spyCam.stopCheckSpyCam();
|
|
12078
12586
|
}
|
|
12079
12587
|
this.state = "Stop" /* Stop */;
|
|
12080
12588
|
}
|
|
@@ -12085,6 +12593,7 @@ Error: ${error}`
|
|
|
12085
12593
|
throw PROCTORING_NOT_STARTED;
|
|
12086
12594
|
}
|
|
12087
12595
|
await this.recorder.stopAll();
|
|
12596
|
+
this.spyCam && this.spyCam.stopCheckSpyCam();
|
|
12088
12597
|
await this.recorder.saveAllOnSession();
|
|
12089
12598
|
await this.repository.save(this.proctoringSession);
|
|
12090
12599
|
let uploader;
|
|
@@ -12162,13 +12671,15 @@ Upload Services: ${uploaderServices}`,
|
|
|
12162
12671
|
this.serviceType
|
|
12163
12672
|
);
|
|
12164
12673
|
}
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
12171
|
-
|
|
12674
|
+
if (this.proctoringSession.alerts.length > 0) {
|
|
12675
|
+
await this.backend.saveAlerts(this.context, this.proctoringSession).catch((err) => {
|
|
12676
|
+
trackers.registerFinish(
|
|
12677
|
+
this.proctoringSession.id,
|
|
12678
|
+
false,
|
|
12679
|
+
"save-screen error: " + err
|
|
12680
|
+
);
|
|
12681
|
+
});
|
|
12682
|
+
}
|
|
12172
12683
|
await this.backend.finishAndSendUrls(this.context, this.proctoringSession).then(() => {
|
|
12173
12684
|
trackers.registerFinish(this.proctoringSession.id, true, "");
|
|
12174
12685
|
}).catch((error) => {
|
|
@@ -12215,6 +12726,7 @@ Error: ` + error
|
|
|
12215
12726
|
}
|
|
12216
12727
|
}
|
|
12217
12728
|
async initConfig(useGeolocation) {
|
|
12729
|
+
var _a2;
|
|
12218
12730
|
try {
|
|
12219
12731
|
const paramsConfig = await this.backend.getParamsConfig(
|
|
12220
12732
|
this.context
|
|
@@ -12241,6 +12753,11 @@ Error: ` + error
|
|
|
12241
12753
|
});
|
|
12242
12754
|
}
|
|
12243
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
|
+
}
|
|
12244
12761
|
} catch (err) {
|
|
12245
12762
|
this.proctoringId && trackers.registerError(this.proctoringId, "Erro no initConfig!");
|
|
12246
12763
|
await this.cancel();
|
|
@@ -12286,6 +12803,200 @@ Error: ` + error
|
|
|
12286
12803
|
}
|
|
12287
12804
|
};
|
|
12288
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
|
+
|
|
12289
13000
|
// src/proctoring/useProctoring.ts
|
|
12290
13001
|
function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
12291
13002
|
if (!proctoringOptions.showConsole) {
|
|
@@ -12296,22 +13007,17 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
12296
13007
|
console.error = () => {
|
|
12297
13008
|
};
|
|
12298
13009
|
}
|
|
12299
|
-
const
|
|
12300
|
-
type: enviromentConfig,
|
|
12301
|
-
clientId: proctoringOptions.clientId,
|
|
12302
|
-
examId: proctoringOptions.examId,
|
|
12303
|
-
token: proctoringOptions.token,
|
|
12304
|
-
credentials: proctoringOptions.credentials,
|
|
12305
|
-
showConsole: proctoringOptions.showConsole
|
|
12306
|
-
});
|
|
12307
|
-
const checker = new DeviceCheckerService({
|
|
13010
|
+
const parameters = {
|
|
12308
13011
|
type: enviromentConfig,
|
|
12309
13012
|
clientId: proctoringOptions.clientId,
|
|
12310
13013
|
examId: proctoringOptions.examId,
|
|
12311
13014
|
token: proctoringOptions.token,
|
|
12312
13015
|
credentials: proctoringOptions.credentials,
|
|
12313
13016
|
showConsole: proctoringOptions.showConsole
|
|
12314
|
-
}
|
|
13017
|
+
};
|
|
13018
|
+
const proctoring = new Proctoring(parameters);
|
|
13019
|
+
const checker = new DeviceCheckerService(parameters);
|
|
13020
|
+
const signTerm = new SignTerm(parameters);
|
|
12315
13021
|
const photo = new CapturePhoto();
|
|
12316
13022
|
const login = proctoring.login.bind(proctoring);
|
|
12317
13023
|
const start = proctoring.start.bind(proctoring);
|
|
@@ -12324,6 +13030,7 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
12324
13030
|
const onBufferSizeError = proctoring.setOnBufferSizeErrorCallback.bind(proctoring);
|
|
12325
13031
|
const onStopSharingScreen = proctoring.setOnStopSharingScreenCallback.bind(proctoring);
|
|
12326
13032
|
const onRealtimeAlerts = proctoring.onRealtimeAlerts.bind(proctoring);
|
|
13033
|
+
const signInTerms = signTerm.signInTerms.bind(signTerm);
|
|
12327
13034
|
const checkDevices = checker.checkDevices.bind(checker);
|
|
12328
13035
|
const runCheckDevicesFlow = checker.runCheckDevicesFlow.bind(checker);
|
|
12329
13036
|
const changeSelectedDevice = checker.changeSelectedDevice.bind(checker);
|
|
@@ -12344,7 +13051,8 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
12344
13051
|
enumarateDevices,
|
|
12345
13052
|
checkPermissions,
|
|
12346
13053
|
checkIfhasMultipleMonitors,
|
|
12347
|
-
onStopSharingScreen
|
|
13054
|
+
onStopSharingScreen,
|
|
13055
|
+
signInTerms
|
|
12348
13056
|
};
|
|
12349
13057
|
}
|
|
12350
13058
|
|