easyproctor 0.0.72 → 0.0.74
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 +4 -0
- package/esm/index.js +35 -30
- package/index.d.ts +1 -0
- package/index.js +35 -30
- package/package.json +2 -3
- package/unpkg/easyproctor.min.js +21 -23
package/README.md
CHANGED
package/esm/index.js
CHANGED
|
@@ -28561,8 +28561,6 @@ var containerName = "";
|
|
|
28561
28561
|
var sas = "";
|
|
28562
28562
|
var blobServiceClient;
|
|
28563
28563
|
var message = "";
|
|
28564
|
-
var loadingInterval;
|
|
28565
|
-
var loadingBoolean = true;
|
|
28566
28564
|
async function setConfiguration(_account, _cointainerName, _sas) {
|
|
28567
28565
|
account = _account;
|
|
28568
28566
|
containerName = _cointainerName;
|
|
@@ -28650,32 +28648,6 @@ async function uploadBackup(data, config2, proctoringToken) {
|
|
|
28650
28648
|
} catch (err) {
|
|
28651
28649
|
message += "\n\u2022 Error on AWS upload\n ";
|
|
28652
28650
|
message += err;
|
|
28653
|
-
try {
|
|
28654
|
-
download(data);
|
|
28655
|
-
} catch (err2) {
|
|
28656
|
-
throw err2;
|
|
28657
|
-
}
|
|
28658
|
-
throw err;
|
|
28659
|
-
}
|
|
28660
|
-
}
|
|
28661
|
-
function download(data) {
|
|
28662
|
-
try {
|
|
28663
|
-
const { file, onProgress } = data;
|
|
28664
|
-
const url = URL.createObjectURL(file);
|
|
28665
|
-
const a = document.createElement("a");
|
|
28666
|
-
document.body.appendChild(a);
|
|
28667
|
-
a.style.display = "none";
|
|
28668
|
-
a.href = url;
|
|
28669
|
-
a.download = file.name;
|
|
28670
|
-
a.click();
|
|
28671
|
-
window.URL.revokeObjectURL(url);
|
|
28672
|
-
loadingBoolean = false;
|
|
28673
|
-
clearInterval(loadingInterval);
|
|
28674
|
-
onProgress && onProgress(Math.round(100));
|
|
28675
|
-
} catch (err) {
|
|
28676
|
-
message += `
|
|
28677
|
-
\u2022 Error on machine download -> ${data.file.name}
|
|
28678
|
-
`;
|
|
28679
28651
|
throw err;
|
|
28680
28652
|
}
|
|
28681
28653
|
}
|
|
@@ -28786,7 +28758,8 @@ var defaultProctoringOptions = {
|
|
|
28786
28758
|
allowOnlyFirstMonitor: true,
|
|
28787
28759
|
captureScreen: true,
|
|
28788
28760
|
proctoringType: "IMAGE",
|
|
28789
|
-
insights: ""
|
|
28761
|
+
insights: "",
|
|
28762
|
+
previousDownload: false
|
|
28790
28763
|
};
|
|
28791
28764
|
var azureBlobUrl = "";
|
|
28792
28765
|
var _captureScreen = true;
|
|
@@ -28801,7 +28774,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
28801
28774
|
if (!navigator.mediaDevices.getDisplayMedia || !window.indexedDB) {
|
|
28802
28775
|
throw INCOMPATIBLE_NAVIGATOR;
|
|
28803
28776
|
}
|
|
28804
|
-
function
|
|
28777
|
+
function download(file) {
|
|
28805
28778
|
const url = URL.createObjectURL(file);
|
|
28806
28779
|
const a = document.createElement("a");
|
|
28807
28780
|
document.body.appendChild(a);
|
|
@@ -28818,11 +28791,13 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
28818
28791
|
let startDate;
|
|
28819
28792
|
let alerts = [];
|
|
28820
28793
|
let onLostFocusCallback;
|
|
28794
|
+
let onChangeDevicesCallback;
|
|
28821
28795
|
let onFocusCallback;
|
|
28822
28796
|
let onStopSharingScreenCallback = void 0;
|
|
28823
28797
|
let cancelCallback = null;
|
|
28824
28798
|
let lastClick = 0;
|
|
28825
28799
|
const delay = 20;
|
|
28800
|
+
let previousDownload;
|
|
28826
28801
|
function _clear() {
|
|
28827
28802
|
cameraBuffer = [];
|
|
28828
28803
|
screenBuffer = [];
|
|
@@ -28888,6 +28863,19 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
28888
28863
|
});
|
|
28889
28864
|
}
|
|
28890
28865
|
};
|
|
28866
|
+
const _onChangeDevices = () => {
|
|
28867
|
+
console.log("Hereeeee");
|
|
28868
|
+
navigator.mediaDevices.ondevicechange = (event) => {
|
|
28869
|
+
onChangeDevicesCallback && onChangeDevicesCallback();
|
|
28870
|
+
console.log("here");
|
|
28871
|
+
console.log(event);
|
|
28872
|
+
alerts.push({
|
|
28873
|
+
begin: Date.now() - startTime,
|
|
28874
|
+
alert: 25,
|
|
28875
|
+
end: 0
|
|
28876
|
+
});
|
|
28877
|
+
};
|
|
28878
|
+
};
|
|
28891
28879
|
const _onReturnFocus = () => {
|
|
28892
28880
|
const lastAlert = alerts[alerts.length - 1];
|
|
28893
28881
|
if (lastAlert) {
|
|
@@ -28898,6 +28886,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
28898
28886
|
const _addListeners = () => {
|
|
28899
28887
|
window.addEventListener("blur", _onLostFocus);
|
|
28900
28888
|
window.addEventListener("focus", _onReturnFocus);
|
|
28889
|
+
navigator.mediaDevices.ondevicechange = _onChangeDevices;
|
|
28901
28890
|
};
|
|
28902
28891
|
const _removeListeners = () => {
|
|
28903
28892
|
window.removeEventListener("blur", _onLostFocus);
|
|
@@ -28943,6 +28932,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
28943
28932
|
throw PROCTORING_ALREADY_STARTED;
|
|
28944
28933
|
lastClick = Date.now();
|
|
28945
28934
|
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
|
|
28935
|
+
previousDownload = !options.previousDownload;
|
|
28946
28936
|
try {
|
|
28947
28937
|
await initConfig();
|
|
28948
28938
|
} catch (err) {
|
|
@@ -29219,6 +29209,18 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
29219
29209
|
} catch (error) {
|
|
29220
29210
|
trackers.registerFinish(proctoringId, false, "finish error: " + error);
|
|
29221
29211
|
}
|
|
29212
|
+
if (previousDownload) {
|
|
29213
|
+
try {
|
|
29214
|
+
trackers.registerUploadVideo(proctoringId, true, "Starting download");
|
|
29215
|
+
allFiles.map((c) => {
|
|
29216
|
+
download(c);
|
|
29217
|
+
});
|
|
29218
|
+
trackers.registerUploadVideo(proctoringId, true, "Finish download");
|
|
29219
|
+
} catch (error) {
|
|
29220
|
+
console.log("Enviando tracker de error");
|
|
29221
|
+
trackers.registerUploadVideo(proctoringId, false, "erro no download " + error);
|
|
29222
|
+
}
|
|
29223
|
+
}
|
|
29222
29224
|
try {
|
|
29223
29225
|
trackers.registerUploadVideo(proctoringId, true, "Starting upload");
|
|
29224
29226
|
const timeBefore = performance.now();
|
|
@@ -29255,6 +29257,9 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
29255
29257
|
function onLostFocus(cb) {
|
|
29256
29258
|
onLostFocusCallback = cb;
|
|
29257
29259
|
}
|
|
29260
|
+
function onChangeDevices(cb) {
|
|
29261
|
+
onChangeDevicesCallback = cb;
|
|
29262
|
+
}
|
|
29258
29263
|
return { start, startAudio, checkDevices, finish, finishAudio, closeCheckDevices, pause, resume, onFocus, onLostFocus, enumarateDevices, checkPermissions, checkIfhasMultipleMonitors, onStopSharingScreen };
|
|
29259
29264
|
}
|
|
29260
29265
|
if (typeof window !== "undefined") {
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -40082,8 +40082,6 @@ var containerName = "";
|
|
|
40082
40082
|
var sas = "";
|
|
40083
40083
|
var blobServiceClient;
|
|
40084
40084
|
var message = "";
|
|
40085
|
-
var loadingInterval;
|
|
40086
|
-
var loadingBoolean = true;
|
|
40087
40085
|
async function setConfiguration(_account, _cointainerName, _sas) {
|
|
40088
40086
|
account = _account;
|
|
40089
40087
|
containerName = _cointainerName;
|
|
@@ -40171,32 +40169,6 @@ async function uploadBackup(data, config2, proctoringToken) {
|
|
|
40171
40169
|
} catch (err) {
|
|
40172
40170
|
message += "\n\u2022 Error on AWS upload\n ";
|
|
40173
40171
|
message += err;
|
|
40174
|
-
try {
|
|
40175
|
-
download(data);
|
|
40176
|
-
} catch (err2) {
|
|
40177
|
-
throw err2;
|
|
40178
|
-
}
|
|
40179
|
-
throw err;
|
|
40180
|
-
}
|
|
40181
|
-
}
|
|
40182
|
-
function download(data) {
|
|
40183
|
-
try {
|
|
40184
|
-
const { file, onProgress } = data;
|
|
40185
|
-
const url2 = URL.createObjectURL(file);
|
|
40186
|
-
const a = document.createElement("a");
|
|
40187
|
-
document.body.appendChild(a);
|
|
40188
|
-
a.style.display = "none";
|
|
40189
|
-
a.href = url2;
|
|
40190
|
-
a.download = file.name;
|
|
40191
|
-
a.click();
|
|
40192
|
-
window.URL.revokeObjectURL(url2);
|
|
40193
|
-
loadingBoolean = false;
|
|
40194
|
-
clearInterval(loadingInterval);
|
|
40195
|
-
onProgress && onProgress(Math.round(100));
|
|
40196
|
-
} catch (err) {
|
|
40197
|
-
message += `
|
|
40198
|
-
\u2022 Error on machine download -> ${data.file.name}
|
|
40199
|
-
`;
|
|
40200
40172
|
throw err;
|
|
40201
40173
|
}
|
|
40202
40174
|
}
|
|
@@ -40307,7 +40279,8 @@ var defaultProctoringOptions = {
|
|
|
40307
40279
|
allowOnlyFirstMonitor: true,
|
|
40308
40280
|
captureScreen: true,
|
|
40309
40281
|
proctoringType: "IMAGE",
|
|
40310
|
-
insights: ""
|
|
40282
|
+
insights: "",
|
|
40283
|
+
previousDownload: false
|
|
40311
40284
|
};
|
|
40312
40285
|
var azureBlobUrl = "";
|
|
40313
40286
|
var _captureScreen = true;
|
|
@@ -40322,7 +40295,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
40322
40295
|
if (!navigator.mediaDevices.getDisplayMedia || !window.indexedDB) {
|
|
40323
40296
|
throw INCOMPATIBLE_NAVIGATOR;
|
|
40324
40297
|
}
|
|
40325
|
-
function
|
|
40298
|
+
function download(file) {
|
|
40326
40299
|
const url2 = URL.createObjectURL(file);
|
|
40327
40300
|
const a = document.createElement("a");
|
|
40328
40301
|
document.body.appendChild(a);
|
|
@@ -40339,11 +40312,13 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
40339
40312
|
let startDate;
|
|
40340
40313
|
let alerts = [];
|
|
40341
40314
|
let onLostFocusCallback;
|
|
40315
|
+
let onChangeDevicesCallback;
|
|
40342
40316
|
let onFocusCallback;
|
|
40343
40317
|
let onStopSharingScreenCallback = void 0;
|
|
40344
40318
|
let cancelCallback = null;
|
|
40345
40319
|
let lastClick = 0;
|
|
40346
40320
|
const delay = 20;
|
|
40321
|
+
let previousDownload;
|
|
40347
40322
|
function _clear() {
|
|
40348
40323
|
cameraBuffer = [];
|
|
40349
40324
|
screenBuffer = [];
|
|
@@ -40409,6 +40384,19 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
40409
40384
|
});
|
|
40410
40385
|
}
|
|
40411
40386
|
};
|
|
40387
|
+
const _onChangeDevices = () => {
|
|
40388
|
+
console.log("Hereeeee");
|
|
40389
|
+
navigator.mediaDevices.ondevicechange = (event) => {
|
|
40390
|
+
onChangeDevicesCallback && onChangeDevicesCallback();
|
|
40391
|
+
console.log("here");
|
|
40392
|
+
console.log(event);
|
|
40393
|
+
alerts.push({
|
|
40394
|
+
begin: Date.now() - startTime,
|
|
40395
|
+
alert: 25,
|
|
40396
|
+
end: 0
|
|
40397
|
+
});
|
|
40398
|
+
};
|
|
40399
|
+
};
|
|
40412
40400
|
const _onReturnFocus = () => {
|
|
40413
40401
|
const lastAlert = alerts[alerts.length - 1];
|
|
40414
40402
|
if (lastAlert) {
|
|
@@ -40419,6 +40407,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
40419
40407
|
const _addListeners = () => {
|
|
40420
40408
|
window.addEventListener("blur", _onLostFocus);
|
|
40421
40409
|
window.addEventListener("focus", _onReturnFocus);
|
|
40410
|
+
navigator.mediaDevices.ondevicechange = _onChangeDevices;
|
|
40422
40411
|
};
|
|
40423
40412
|
const _removeListeners = () => {
|
|
40424
40413
|
window.removeEventListener("blur", _onLostFocus);
|
|
@@ -40464,6 +40453,7 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
40464
40453
|
throw PROCTORING_ALREADY_STARTED;
|
|
40465
40454
|
lastClick = Date.now();
|
|
40466
40455
|
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
|
|
40456
|
+
previousDownload = !options.previousDownload;
|
|
40467
40457
|
try {
|
|
40468
40458
|
await initConfig();
|
|
40469
40459
|
} catch (err) {
|
|
@@ -40740,6 +40730,18 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
40740
40730
|
} catch (error) {
|
|
40741
40731
|
trackers.registerFinish(proctoringId, false, "finish error: " + error);
|
|
40742
40732
|
}
|
|
40733
|
+
if (previousDownload) {
|
|
40734
|
+
try {
|
|
40735
|
+
trackers.registerUploadVideo(proctoringId, true, "Starting download");
|
|
40736
|
+
allFiles.map((c) => {
|
|
40737
|
+
download(c);
|
|
40738
|
+
});
|
|
40739
|
+
trackers.registerUploadVideo(proctoringId, true, "Finish download");
|
|
40740
|
+
} catch (error) {
|
|
40741
|
+
console.log("Enviando tracker de error");
|
|
40742
|
+
trackers.registerUploadVideo(proctoringId, false, "erro no download " + error);
|
|
40743
|
+
}
|
|
40744
|
+
}
|
|
40743
40745
|
try {
|
|
40744
40746
|
trackers.registerUploadVideo(proctoringId, true, "Starting upload");
|
|
40745
40747
|
const timeBefore = performance.now();
|
|
@@ -40776,6 +40778,9 @@ function useProctoring(proctoringOptions, homolConfig = false) {
|
|
|
40776
40778
|
function onLostFocus(cb) {
|
|
40777
40779
|
onLostFocusCallback = cb;
|
|
40778
40780
|
}
|
|
40781
|
+
function onChangeDevices(cb) {
|
|
40782
|
+
onChangeDevicesCallback = cb;
|
|
40783
|
+
}
|
|
40779
40784
|
return { start, startAudio, checkDevices, finish, finishAudio, closeCheckDevices, pause, resume, onFocus, onLostFocus, enumarateDevices, checkPermissions, checkIfhasMultipleMonitors, onStopSharingScreen };
|
|
40780
40785
|
}
|
|
40781
40786
|
if (typeof window !== "undefined") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easyproctor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
4
4
|
"description": "Modulo web de gravação do EasyProctor",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@types/crypto-js": "^4.1.1",
|
|
26
26
|
"@types/dom-mediacapture-record": "^1.0.11",
|
|
27
27
|
"@types/ebml": "^3.0.2",
|
|
28
|
+
"@types/node": "^18.11.9",
|
|
28
29
|
"@types/recordrtc": "^5.6.8",
|
|
29
30
|
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
|
30
31
|
"@typescript-eslint/parser": "^5.8.0",
|
|
@@ -48,9 +49,7 @@
|
|
|
48
49
|
"crypto-browserify": "^3.12.0",
|
|
49
50
|
"crypto-js": "^4.1.1",
|
|
50
51
|
"ebml": "^3.0.0",
|
|
51
|
-
"fs": "^0.0.1-security",
|
|
52
52
|
"jshashes": "^1.0.8",
|
|
53
|
-
"os": "^0.1.2",
|
|
54
53
|
"recordrtc": "^5.6.2",
|
|
55
54
|
"ts-ebml": "^2.0.2"
|
|
56
55
|
}
|