easyproctor-hml 3.0.0 → 3.1.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/esm/index.js +29 -4
- package/index.js +29 -4
- package/new-flow/recorders/AlertRecorder.d.ts +2 -0
- package/package.json +1 -1
- package/unpkg/easyproctor.min.js +28 -28
package/esm/index.js
CHANGED
|
@@ -14541,7 +14541,12 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
14541
14541
|
});
|
|
14542
14542
|
let finalBlob = rawBlob;
|
|
14543
14543
|
if (typeof fixWebmDuration === "function") {
|
|
14544
|
-
|
|
14544
|
+
try {
|
|
14545
|
+
finalBlob = await fixWebmDuration(rawBlob, this.duration);
|
|
14546
|
+
} catch (e3) {
|
|
14547
|
+
console.warn("Erro ao corrigir a dura\xE7\xE3o do v\xEDdeo", e3);
|
|
14548
|
+
finalBlob = rawBlob;
|
|
14549
|
+
}
|
|
14545
14550
|
} else {
|
|
14546
14551
|
console.warn("fixWebmDuration n\xE3o dispon\xEDvel");
|
|
14547
14552
|
}
|
|
@@ -16756,8 +16761,9 @@ var AlertRecorder = class {
|
|
|
16756
16761
|
this.handleLostFocus();
|
|
16757
16762
|
}
|
|
16758
16763
|
};
|
|
16764
|
+
this.lastLostFocusTime = Date.now();
|
|
16759
16765
|
this.handleLostFocus = () => {
|
|
16760
|
-
if (this.getRelativeTime() > 1e4) {
|
|
16766
|
+
if (this.getRelativeTime() > 1e4 && Date.now() - this.lastLostFocusTime > 1e3) {
|
|
16761
16767
|
const alertPayload = {
|
|
16762
16768
|
begin: this.getRelativeTime(),
|
|
16763
16769
|
end: 0,
|
|
@@ -16766,9 +16772,13 @@ var AlertRecorder = class {
|
|
|
16766
16772
|
};
|
|
16767
16773
|
this.onLostFocusCallback(alertPayload);
|
|
16768
16774
|
this.alerts.push(alertPayload);
|
|
16775
|
+
this.lastLostFocusTime = Date.now();
|
|
16769
16776
|
}
|
|
16770
16777
|
};
|
|
16778
|
+
this.lastReturnFocusTime = Date.now();
|
|
16771
16779
|
this.handleReturnFocus = () => {
|
|
16780
|
+
const diffTime = Date.now() - this.lastReturnFocusTime;
|
|
16781
|
+
if (diffTime < 1e3) return;
|
|
16772
16782
|
const lastAlert = this.alerts[this.alerts.length - 1];
|
|
16773
16783
|
if (lastAlert) {
|
|
16774
16784
|
this.onFocusCallback({
|
|
@@ -16779,6 +16789,7 @@ var AlertRecorder = class {
|
|
|
16779
16789
|
});
|
|
16780
16790
|
lastAlert.end = this.getRelativeTime();
|
|
16781
16791
|
}
|
|
16792
|
+
this.lastReturnFocusTime = Date.now();
|
|
16782
16793
|
};
|
|
16783
16794
|
// 2. SPLIT SCREEN DETECTION
|
|
16784
16795
|
this.handleResize = () => {
|
|
@@ -16863,6 +16874,8 @@ var AlertRecorder = class {
|
|
|
16863
16874
|
attachListeners() {
|
|
16864
16875
|
if (this.optionsProctoring.captureScreen) {
|
|
16865
16876
|
window.addEventListener("visibilitychange", this.handleVisibilityChange);
|
|
16877
|
+
window.addEventListener("blur", this.handleLostFocus);
|
|
16878
|
+
window.addEventListener("focus", this.handleReturnFocus);
|
|
16866
16879
|
window.addEventListener("resize", this.handleResize);
|
|
16867
16880
|
window.document.addEventListener("copy", this.handleCopy);
|
|
16868
16881
|
window.document.addEventListener("cut", this.handleCut);
|
|
@@ -16871,6 +16884,8 @@ var AlertRecorder = class {
|
|
|
16871
16884
|
}
|
|
16872
16885
|
detachListeners() {
|
|
16873
16886
|
window.removeEventListener("visibilitychange", this.handleVisibilityChange);
|
|
16887
|
+
window.removeEventListener("blur", this.handleLostFocus);
|
|
16888
|
+
window.removeEventListener("focus", this.handleReturnFocus);
|
|
16874
16889
|
window.removeEventListener("resize", this.handleResize);
|
|
16875
16890
|
window.document.removeEventListener("copy", this.handleCopy);
|
|
16876
16891
|
window.document.removeEventListener("cut", this.handleCut);
|
|
@@ -19539,10 +19554,20 @@ var ScreenRecorder = class {
|
|
|
19539
19554
|
const rawBlob = new Blob(this.blobs, {
|
|
19540
19555
|
type: "video/webm"
|
|
19541
19556
|
});
|
|
19542
|
-
|
|
19557
|
+
let finalBlob = rawBlob;
|
|
19558
|
+
if (typeof fixWebmDuration2 === "function") {
|
|
19559
|
+
try {
|
|
19560
|
+
finalBlob = await fixWebmDuration2(rawBlob, this.duration);
|
|
19561
|
+
} catch (e3) {
|
|
19562
|
+
console.warn("Erro ao corrigir a dura\xE7\xE3o do v\xEDdeo", e3);
|
|
19563
|
+
finalBlob = rawBlob;
|
|
19564
|
+
}
|
|
19565
|
+
} else {
|
|
19566
|
+
console.warn("fixWebmDuration n\xE3o dispon\xEDvel");
|
|
19567
|
+
}
|
|
19543
19568
|
session.addRecording({
|
|
19544
19569
|
device: "",
|
|
19545
|
-
arrayBuffer: await
|
|
19570
|
+
arrayBuffer: await finalBlob.arrayBuffer(),
|
|
19546
19571
|
origin: "Screen" /* Screen */
|
|
19547
19572
|
});
|
|
19548
19573
|
}
|
package/index.js
CHANGED
|
@@ -32638,7 +32638,12 @@ Setting: ${JSON.stringify(settings, null, 2)}`
|
|
|
32638
32638
|
});
|
|
32639
32639
|
let finalBlob = rawBlob;
|
|
32640
32640
|
if (typeof fixWebmDuration === "function") {
|
|
32641
|
-
|
|
32641
|
+
try {
|
|
32642
|
+
finalBlob = await fixWebmDuration(rawBlob, this.duration);
|
|
32643
|
+
} catch (e3) {
|
|
32644
|
+
console.warn("Erro ao corrigir a dura\xE7\xE3o do v\xEDdeo", e3);
|
|
32645
|
+
finalBlob = rawBlob;
|
|
32646
|
+
}
|
|
32642
32647
|
} else {
|
|
32643
32648
|
console.warn("fixWebmDuration n\xE3o dispon\xEDvel");
|
|
32644
32649
|
}
|
|
@@ -34853,8 +34858,9 @@ var AlertRecorder = class {
|
|
|
34853
34858
|
this.handleLostFocus();
|
|
34854
34859
|
}
|
|
34855
34860
|
};
|
|
34861
|
+
this.lastLostFocusTime = Date.now();
|
|
34856
34862
|
this.handleLostFocus = () => {
|
|
34857
|
-
if (this.getRelativeTime() > 1e4) {
|
|
34863
|
+
if (this.getRelativeTime() > 1e4 && Date.now() - this.lastLostFocusTime > 1e3) {
|
|
34858
34864
|
const alertPayload = {
|
|
34859
34865
|
begin: this.getRelativeTime(),
|
|
34860
34866
|
end: 0,
|
|
@@ -34863,9 +34869,13 @@ var AlertRecorder = class {
|
|
|
34863
34869
|
};
|
|
34864
34870
|
this.onLostFocusCallback(alertPayload);
|
|
34865
34871
|
this.alerts.push(alertPayload);
|
|
34872
|
+
this.lastLostFocusTime = Date.now();
|
|
34866
34873
|
}
|
|
34867
34874
|
};
|
|
34875
|
+
this.lastReturnFocusTime = Date.now();
|
|
34868
34876
|
this.handleReturnFocus = () => {
|
|
34877
|
+
const diffTime = Date.now() - this.lastReturnFocusTime;
|
|
34878
|
+
if (diffTime < 1e3) return;
|
|
34869
34879
|
const lastAlert = this.alerts[this.alerts.length - 1];
|
|
34870
34880
|
if (lastAlert) {
|
|
34871
34881
|
this.onFocusCallback({
|
|
@@ -34876,6 +34886,7 @@ var AlertRecorder = class {
|
|
|
34876
34886
|
});
|
|
34877
34887
|
lastAlert.end = this.getRelativeTime();
|
|
34878
34888
|
}
|
|
34889
|
+
this.lastReturnFocusTime = Date.now();
|
|
34879
34890
|
};
|
|
34880
34891
|
// 2. SPLIT SCREEN DETECTION
|
|
34881
34892
|
this.handleResize = () => {
|
|
@@ -34960,6 +34971,8 @@ var AlertRecorder = class {
|
|
|
34960
34971
|
attachListeners() {
|
|
34961
34972
|
if (this.optionsProctoring.captureScreen) {
|
|
34962
34973
|
window.addEventListener("visibilitychange", this.handleVisibilityChange);
|
|
34974
|
+
window.addEventListener("blur", this.handleLostFocus);
|
|
34975
|
+
window.addEventListener("focus", this.handleReturnFocus);
|
|
34963
34976
|
window.addEventListener("resize", this.handleResize);
|
|
34964
34977
|
window.document.addEventListener("copy", this.handleCopy);
|
|
34965
34978
|
window.document.addEventListener("cut", this.handleCut);
|
|
@@ -34968,6 +34981,8 @@ var AlertRecorder = class {
|
|
|
34968
34981
|
}
|
|
34969
34982
|
detachListeners() {
|
|
34970
34983
|
window.removeEventListener("visibilitychange", this.handleVisibilityChange);
|
|
34984
|
+
window.removeEventListener("blur", this.handleLostFocus);
|
|
34985
|
+
window.removeEventListener("focus", this.handleReturnFocus);
|
|
34971
34986
|
window.removeEventListener("resize", this.handleResize);
|
|
34972
34987
|
window.document.removeEventListener("copy", this.handleCopy);
|
|
34973
34988
|
window.document.removeEventListener("cut", this.handleCut);
|
|
@@ -37636,10 +37651,20 @@ var ScreenRecorder = class {
|
|
|
37636
37651
|
const rawBlob = new Blob(this.blobs, {
|
|
37637
37652
|
type: "video/webm"
|
|
37638
37653
|
});
|
|
37639
|
-
|
|
37654
|
+
let finalBlob = rawBlob;
|
|
37655
|
+
if (typeof fixWebmDuration2 === "function") {
|
|
37656
|
+
try {
|
|
37657
|
+
finalBlob = await fixWebmDuration2(rawBlob, this.duration);
|
|
37658
|
+
} catch (e3) {
|
|
37659
|
+
console.warn("Erro ao corrigir a dura\xE7\xE3o do v\xEDdeo", e3);
|
|
37660
|
+
finalBlob = rawBlob;
|
|
37661
|
+
}
|
|
37662
|
+
} else {
|
|
37663
|
+
console.warn("fixWebmDuration n\xE3o dispon\xEDvel");
|
|
37664
|
+
}
|
|
37640
37665
|
session.addRecording({
|
|
37641
37666
|
device: "",
|
|
37642
|
-
arrayBuffer: await
|
|
37667
|
+
arrayBuffer: await finalBlob.arrayBuffer(),
|
|
37643
37668
|
origin: "Screen" /* Screen */
|
|
37644
37669
|
});
|
|
37645
37670
|
}
|
|
@@ -25,7 +25,9 @@ export declare class AlertRecorder implements IRecorder {
|
|
|
25
25
|
private attachListeners;
|
|
26
26
|
private detachListeners;
|
|
27
27
|
private handleVisibilityChange;
|
|
28
|
+
lastLostFocusTime: number;
|
|
28
29
|
private handleLostFocus;
|
|
30
|
+
lastReturnFocusTime: number;
|
|
29
31
|
private handleReturnFocus;
|
|
30
32
|
private handleResize;
|
|
31
33
|
private handleUserActivity;
|