easyproctor 1.0.3 → 1.0.4
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 +2 -6
- package/esm/index.js +310 -207
- package/index.js +16686 -16583
- package/new-flow/recorders/VolumeMeter.d.ts +4 -1
- package/package.json +1 -1
- package/proctoring/DeviceChecker.d.ts +3 -4
- package/unpkg/easyproctor.min.js +20 -20
package/README.md
CHANGED
|
@@ -219,13 +219,9 @@ const {
|
|
|
219
219
|
});
|
|
220
220
|
```
|
|
221
221
|
|
|
222
|
-
## Release Note V 1.0.
|
|
223
|
-
|
|
224
|
-
- Correção na função checkDevices
|
|
225
|
-
- Adicionado callback onNoiseDetected
|
|
226
|
-
- Correção de erro relacionado ao link do blob no download e na extensão
|
|
227
|
-
- Correção send percentage on finish with extension
|
|
222
|
+
## Release Note V 1.0.4
|
|
228
223
|
|
|
224
|
+
- Atualização do modal do checkDevices
|
|
229
225
|
|
|
230
226
|
## License
|
|
231
227
|
|
package/esm/index.js
CHANGED
|
@@ -18,6 +18,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
20
|
|
|
21
|
+
// node_modules/form-data/lib/browser.js
|
|
22
|
+
var require_browser = __commonJS({
|
|
23
|
+
"node_modules/form-data/lib/browser.js"(exports, module) {
|
|
24
|
+
module.exports = typeof self == "object" ? self.FormData : window.FormData;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
21
28
|
// src/plugins/mp3.js
|
|
22
29
|
var require_mp3 = __commonJS({
|
|
23
30
|
"src/plugins/mp3.js"(exports, module) {
|
|
@@ -14301,13 +14308,6 @@ var require_mp3 = __commonJS({
|
|
|
14301
14308
|
}
|
|
14302
14309
|
});
|
|
14303
14310
|
|
|
14304
|
-
// node_modules/form-data/lib/browser.js
|
|
14305
|
-
var require_browser = __commonJS({
|
|
14306
|
-
"node_modules/form-data/lib/browser.js"(exports, module) {
|
|
14307
|
-
module.exports = typeof self == "object" ? self.FormData : window.FormData;
|
|
14308
|
-
}
|
|
14309
|
-
});
|
|
14310
|
-
|
|
14311
14311
|
// src/modules/checkPermissions.ts
|
|
14312
14312
|
async function checkPermissions() {
|
|
14313
14313
|
try {
|
|
@@ -14356,12 +14356,6 @@ async function enumarateDevices() {
|
|
|
14356
14356
|
return devices;
|
|
14357
14357
|
}
|
|
14358
14358
|
|
|
14359
|
-
// src/plugins/MicRecorder2.ts
|
|
14360
|
-
var MicRecorder = require_mp3();
|
|
14361
|
-
function createMicRecorder(config) {
|
|
14362
|
-
return new MicRecorder(config);
|
|
14363
|
-
}
|
|
14364
|
-
|
|
14365
14359
|
// src/new-flow/proctoring/ProctoringSession.ts
|
|
14366
14360
|
var ProctoringSession = class {
|
|
14367
14361
|
constructor(id) {
|
|
@@ -14411,47 +14405,6 @@ var ProctoringSession = class {
|
|
|
14411
14405
|
}
|
|
14412
14406
|
};
|
|
14413
14407
|
|
|
14414
|
-
// src/new-flow/recorders/AudioRecorder.ts
|
|
14415
|
-
var AudioRecorder = class {
|
|
14416
|
-
constructor() {
|
|
14417
|
-
this.blobs = [];
|
|
14418
|
-
}
|
|
14419
|
-
async startRecording() {
|
|
14420
|
-
this.recorder = createMicRecorder({
|
|
14421
|
-
bitRate: 128
|
|
14422
|
-
});
|
|
14423
|
-
this.recorder.start().catch((e) => {
|
|
14424
|
-
throw new Error("Error on Audio to Start Recording");
|
|
14425
|
-
});
|
|
14426
|
-
}
|
|
14427
|
-
async pauseRecording() {
|
|
14428
|
-
}
|
|
14429
|
-
async resumeRecording() {
|
|
14430
|
-
}
|
|
14431
|
-
async stopRecording() {
|
|
14432
|
-
if (!this.recorder)
|
|
14433
|
-
return;
|
|
14434
|
-
const response = await this.recorder.stop().getMp3().then(async ([buffer, blob]) => {
|
|
14435
|
-
return { buffer, blob };
|
|
14436
|
-
}).catch((e) => {
|
|
14437
|
-
alert("We could not retrieve your message");
|
|
14438
|
-
return void 0;
|
|
14439
|
-
});
|
|
14440
|
-
if (response) {
|
|
14441
|
-
this.blobs.push(response.blob);
|
|
14442
|
-
}
|
|
14443
|
-
}
|
|
14444
|
-
async saveOnSession(session) {
|
|
14445
|
-
session.addRecording({
|
|
14446
|
-
device: "",
|
|
14447
|
-
file: new File(this.blobs, `EP_${session.id}_audio_0.mp3`, {
|
|
14448
|
-
type: "audio/mp3"
|
|
14449
|
-
}),
|
|
14450
|
-
origin: "Mic" /* Mic */
|
|
14451
|
-
});
|
|
14452
|
-
}
|
|
14453
|
-
};
|
|
14454
|
-
|
|
14455
14408
|
// src/plugins/recorder.ts
|
|
14456
14409
|
function recorder(stream, buffer, audio = false) {
|
|
14457
14410
|
let resolvePromise;
|
|
@@ -14577,67 +14530,47 @@ var CameraRecorder = class {
|
|
|
14577
14530
|
}
|
|
14578
14531
|
};
|
|
14579
14532
|
|
|
14580
|
-
// src/
|
|
14581
|
-
var
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
var PROCTORING_NOT_STARTED = "proctoring_not_started";
|
|
14585
|
-
|
|
14586
|
-
// src/new-flow/recorders/ScreenRecorder.ts
|
|
14587
|
-
var ScreenRecorder = class {
|
|
14588
|
-
constructor(options) {
|
|
14589
|
-
this.blobs = [];
|
|
14590
|
-
this.blobsFinal = [];
|
|
14591
|
-
this.options = options;
|
|
14533
|
+
// src/new-flow/recorders/VolumeMeter.ts
|
|
14534
|
+
var VolumeMeter = class {
|
|
14535
|
+
constructor(stream) {
|
|
14536
|
+
this.stream = stream;
|
|
14592
14537
|
}
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
|
|
14597
|
-
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14538
|
+
start(options = {}) {
|
|
14539
|
+
return new Promise((resolve, reject) => {
|
|
14540
|
+
try {
|
|
14541
|
+
const audioContext = new AudioContext();
|
|
14542
|
+
const analyser = audioContext.createAnalyser();
|
|
14543
|
+
const microphone = audioContext.createMediaStreamSource(this.stream);
|
|
14544
|
+
this.scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
|
|
14545
|
+
analyser.smoothingTimeConstant = 0.8;
|
|
14546
|
+
analyser.fftSize = 1024;
|
|
14547
|
+
microphone.connect(analyser);
|
|
14548
|
+
analyser.connect(this.scriptProcessor);
|
|
14549
|
+
this.scriptProcessor.connect(audioContext.destination);
|
|
14550
|
+
const that = this;
|
|
14551
|
+
this.scriptProcessor.onaudioprocess = function() {
|
|
14552
|
+
const array = new Uint8Array(analyser.frequencyBinCount);
|
|
14553
|
+
analyser.getByteFrequencyData(array);
|
|
14554
|
+
const arraySum = array.reduce((a, value) => a + value, 0);
|
|
14555
|
+
const average = arraySum / array.length;
|
|
14556
|
+
that.setVolume(average);
|
|
14557
|
+
options.setVolume && options.setVolume(average);
|
|
14558
|
+
};
|
|
14559
|
+
resolve(true);
|
|
14560
|
+
} catch (error) {
|
|
14561
|
+
this.stop();
|
|
14562
|
+
reject(`Error: ${error}`);
|
|
14610
14563
|
}
|
|
14611
|
-
}
|
|
14612
|
-
const sharedFirstScreen = tracks.find((el) => {
|
|
14613
|
-
return ["screen:0:0", "Primary Monitor"].includes(el.label);
|
|
14614
|
-
}) != null;
|
|
14615
|
-
if (!sharedFirstScreen && allowOnlyFirstMonitor) {
|
|
14616
|
-
tracks.forEach((el) => {
|
|
14617
|
-
el.stop();
|
|
14618
|
-
});
|
|
14619
|
-
throw NOT_SHARED_FIRST_SCREEN;
|
|
14620
|
-
}
|
|
14621
|
-
const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs);
|
|
14622
|
-
this.recordingStart = startRecording;
|
|
14623
|
-
this.recordingStop = stopRecording;
|
|
14624
|
-
this.recordingStart();
|
|
14625
|
-
}
|
|
14626
|
-
async pauseRecording() {
|
|
14564
|
+
});
|
|
14627
14565
|
}
|
|
14628
|
-
|
|
14566
|
+
stop() {
|
|
14567
|
+
this.scriptProcessor && this.scriptProcessor.disconnect();
|
|
14629
14568
|
}
|
|
14630
|
-
|
|
14631
|
-
|
|
14569
|
+
getVolume() {
|
|
14570
|
+
return this.volume;
|
|
14632
14571
|
}
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
device: "",
|
|
14636
|
-
file: new File(this.blobs, `EP_${session.id}_screen_0.webm`, {
|
|
14637
|
-
type: "video/webm"
|
|
14638
|
-
}),
|
|
14639
|
-
origin: "Screen" /* Screen */
|
|
14640
|
-
});
|
|
14572
|
+
setVolume(value) {
|
|
14573
|
+
this.volume = value;
|
|
14641
14574
|
}
|
|
14642
14575
|
};
|
|
14643
14576
|
|
|
@@ -14697,55 +14630,118 @@ var DeviceChecker = class {
|
|
|
14697
14630
|
const modal = document.createElement("div");
|
|
14698
14631
|
modal.style.backgroundColor = "#fff";
|
|
14699
14632
|
modal.style.zIndex = "1001";
|
|
14700
|
-
modal.style.width = "
|
|
14633
|
+
modal.style.width = "600px";
|
|
14701
14634
|
modal.style.borderRadius = "10px";
|
|
14702
|
-
modal.style.padding = "20px 10px";
|
|
14703
14635
|
modal.style.display = "flex";
|
|
14704
14636
|
modal.style.flexDirection = "column";
|
|
14705
14637
|
modal.style.alignItems = "center";
|
|
14706
14638
|
const h3 = document.createElement("h3");
|
|
14707
|
-
h3.innerText = "
|
|
14708
|
-
h3.style.color = "
|
|
14639
|
+
h3.innerText = "Para iniciar configure a c\xE2mera e o microfone";
|
|
14640
|
+
h3.style.color = "rgba(0, 0, 0, .7)";
|
|
14709
14641
|
h3.style.fontWeight = "bold";
|
|
14710
|
-
h3.style.fontSize = "
|
|
14642
|
+
h3.style.fontSize = "20px";
|
|
14711
14643
|
h3.style.marginBottom = "15px";
|
|
14644
|
+
h3.style.padding = "20px 0px";
|
|
14645
|
+
h3.style.borderBottom = "2px solid rgba(0, 0, 0, .1)";
|
|
14646
|
+
h3.style.width = "100%";
|
|
14647
|
+
h3.style.textAlign = "center";
|
|
14712
14648
|
modal.appendChild(h3);
|
|
14649
|
+
const divCameraHeader = document.createElement("div");
|
|
14650
|
+
const h3Camera = document.createElement("h3");
|
|
14651
|
+
const selectCamera = document.createElement("select");
|
|
14652
|
+
selectCamera.setAttribute("id", "cameraSelect");
|
|
14653
|
+
divCameraHeader.style.padding = "0 20px";
|
|
14654
|
+
divCameraHeader.style.width = "100%";
|
|
14655
|
+
divCameraHeader.style.display = "flex";
|
|
14656
|
+
divCameraHeader.style.justifyContent = "space-between";
|
|
14657
|
+
divCameraHeader.style.marginBottom = "15px";
|
|
14658
|
+
h3Camera.innerText = "C\xE2mera";
|
|
14659
|
+
h3Camera.style.color = "rgba(0, 0, 0, .75)";
|
|
14660
|
+
h3Camera.style.fontWeight = "bold";
|
|
14661
|
+
h3Camera.style.fontSize = "16px";
|
|
14662
|
+
selectCamera.style.maxWidth = "400px";
|
|
14663
|
+
divCameraHeader.appendChild(h3Camera);
|
|
14664
|
+
divCameraHeader.appendChild(selectCamera);
|
|
14665
|
+
modal.appendChild(divCameraHeader);
|
|
14666
|
+
const divCamera = document.createElement("div");
|
|
14713
14667
|
const video = document.createElement("video");
|
|
14714
14668
|
video.setAttribute("id", "cameraStream");
|
|
14669
|
+
video.muted = true;
|
|
14670
|
+
divCamera.style.width = "calc(100% - 40px)";
|
|
14671
|
+
divCamera.style.display = "flex";
|
|
14672
|
+
divCamera.style.justifyContent = "space-between";
|
|
14673
|
+
divCamera.style.borderBottom = "2px solid rgba(0, 0, 0, .1)";
|
|
14674
|
+
divCamera.style.paddingBottom = "15px";
|
|
14715
14675
|
video.style.width = "20rem";
|
|
14716
14676
|
video.style.backgroundColor = "#000";
|
|
14717
14677
|
video.style.borderRadius = "10px";
|
|
14718
14678
|
video.style.marginBottom = "15px";
|
|
14719
|
-
|
|
14720
|
-
|
|
14721
|
-
|
|
14722
|
-
|
|
14723
|
-
|
|
14724
|
-
|
|
14725
|
-
|
|
14726
|
-
|
|
14727
|
-
|
|
14679
|
+
divCamera.appendChild(video);
|
|
14680
|
+
modal.appendChild(divCamera);
|
|
14681
|
+
const divMicHeader = document.createElement("div");
|
|
14682
|
+
const h3Mic = document.createElement("h3");
|
|
14683
|
+
const selectMic = document.createElement("select");
|
|
14684
|
+
selectMic.setAttribute("id", "micSelect");
|
|
14685
|
+
divMicHeader.style.padding = "0 20px";
|
|
14686
|
+
divMicHeader.style.width = "100%";
|
|
14687
|
+
divMicHeader.style.display = "flex";
|
|
14688
|
+
divMicHeader.style.justifyContent = "space-between";
|
|
14689
|
+
divMicHeader.style.margin = "15px 0";
|
|
14690
|
+
h3Mic.innerText = "C\xE2mera";
|
|
14691
|
+
h3Mic.style.color = "rgba(0, 0, 0, .7)";
|
|
14692
|
+
h3Mic.style.fontWeight = "bold";
|
|
14693
|
+
h3Mic.style.fontSize = "16px";
|
|
14694
|
+
selectMic.style.maxWidth = "400px";
|
|
14695
|
+
divMicHeader.appendChild(h3Mic);
|
|
14696
|
+
divMicHeader.appendChild(selectMic);
|
|
14697
|
+
modal.appendChild(divMicHeader);
|
|
14698
|
+
const divMic = document.createElement("div");
|
|
14699
|
+
divMic.style.width = "calc(100% - 40px)";
|
|
14700
|
+
divMic.style.display = "flex";
|
|
14701
|
+
divMic.style.justifyContent = "space-between";
|
|
14702
|
+
divMic.style.paddingBottom = "15px";
|
|
14703
|
+
const divMeter = document.createElement("div");
|
|
14704
|
+
divMeter.setAttribute("id", "audioStream");
|
|
14705
|
+
divMeter.style.display = "flex";
|
|
14706
|
+
divMeter.style.marginBottom = "15px";
|
|
14707
|
+
for (let i = 0; i < 25; i++) {
|
|
14708
|
+
const pill = document.createElement("div");
|
|
14709
|
+
pill.style.height = "16px";
|
|
14710
|
+
pill.style.width = "5px";
|
|
14711
|
+
pill.style.marginRight = "5px";
|
|
14712
|
+
pill.style.borderRadius = "10px";
|
|
14713
|
+
pill.style.backgroundColor = "rgba(0, 0, 0, .3)";
|
|
14714
|
+
divMeter.appendChild(pill);
|
|
14715
|
+
}
|
|
14716
|
+
divMic.appendChild(divMeter);
|
|
14717
|
+
modal.appendChild(divMic);
|
|
14728
14718
|
const button = document.createElement("button");
|
|
14719
|
+
const divBtn = document.createElement("div");
|
|
14729
14720
|
button.setAttribute("id", "confirmBtn");
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
|
-
|
|
14733
|
-
|
|
14734
|
-
|
|
14721
|
+
divBtn.style.width = "100%";
|
|
14722
|
+
divBtn.style.display = "flex";
|
|
14723
|
+
divBtn.style.alignItems = "center";
|
|
14724
|
+
divBtn.style.justifyContent = "center";
|
|
14725
|
+
divBtn.style.borderTop = "2px solid rgba(0, 0, 0, .1)";
|
|
14726
|
+
button.innerText = "Continuar";
|
|
14727
|
+
button.style.width = "100%";
|
|
14728
|
+
button.style.height = "70px";
|
|
14729
|
+
button.style.color = "rgba(0, 0, 0, .7)";
|
|
14730
|
+
button.style.fontWeight = "bold";
|
|
14735
14731
|
button.style.borderRadius = "10px";
|
|
14732
|
+
button.style.paddingTop = "5px";
|
|
14733
|
+
button.style.paddingBottom = "5px";
|
|
14736
14734
|
button.addEventListener("click", () => {
|
|
14737
14735
|
this.closeCheckDevices();
|
|
14738
14736
|
resolve("Complete");
|
|
14739
14737
|
});
|
|
14740
|
-
|
|
14738
|
+
divBtn.appendChild(button);
|
|
14739
|
+
modal.appendChild(divBtn);
|
|
14741
14740
|
fullBg.appendChild(modal);
|
|
14742
14741
|
document.body.appendChild(fullBg);
|
|
14743
14742
|
this.startCheckDevices(this.options, this.videoOptions);
|
|
14744
14743
|
});
|
|
14745
14744
|
}
|
|
14746
|
-
async startDevice() {
|
|
14747
|
-
const { cameraStream, _screenStream } = await this.startCheckDevices(this.options, this.videoOptions);
|
|
14748
|
-
}
|
|
14749
14745
|
videoDeviceInterface(stream) {
|
|
14750
14746
|
const cameraStream = document.querySelector("#cameraStream");
|
|
14751
14747
|
if (cameraStream) {
|
|
@@ -14755,24 +14751,78 @@ var DeviceChecker = class {
|
|
|
14755
14751
|
}
|
|
14756
14752
|
audioDeviceInterface(stream) {
|
|
14757
14753
|
const audioStream = document.querySelector("#audioStream");
|
|
14758
|
-
const
|
|
14759
|
-
|
|
14760
|
-
|
|
14761
|
-
|
|
14762
|
-
|
|
14763
|
-
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
|
|
14767
|
-
|
|
14768
|
-
|
|
14769
|
-
|
|
14770
|
-
|
|
14754
|
+
const pillList = audioStream == null ? void 0 : audioStream.querySelectorAll("div");
|
|
14755
|
+
this.volumeMeter = new VolumeMeter(this.cameraRecorder.cameraStream);
|
|
14756
|
+
this.volumeMeter.start({
|
|
14757
|
+
setVolume: (value) => {
|
|
14758
|
+
const pillValue = value / 4;
|
|
14759
|
+
pillList == null ? void 0 : pillList.forEach((item, index) => {
|
|
14760
|
+
index < Math.ceil(pillValue) ? item.style.backgroundColor = "rgb(22, 163, 74)" : item.style.backgroundColor = "rgba(0, 0, 0, .3)";
|
|
14761
|
+
});
|
|
14762
|
+
}
|
|
14763
|
+
}).catch((e) => {
|
|
14764
|
+
console.log(e);
|
|
14765
|
+
this.volumeMeter = void 0;
|
|
14766
|
+
});
|
|
14767
|
+
}
|
|
14768
|
+
async setSelectOption(options) {
|
|
14769
|
+
const cameras = document.querySelector("#cameraSelect");
|
|
14770
|
+
const microphones = document.querySelector("#micSelect");
|
|
14771
|
+
const devices = await enumarateDevices();
|
|
14772
|
+
cameras && (cameras.value = options.cameraId || "default");
|
|
14773
|
+
microphones && (microphones.value = options.microphoneId || "default");
|
|
14774
|
+
const generateOption = (text, value) => {
|
|
14775
|
+
const el = document.createElement("option");
|
|
14776
|
+
el.setAttribute("value", value);
|
|
14777
|
+
el.innerHTML = text;
|
|
14778
|
+
return el;
|
|
14771
14779
|
};
|
|
14772
|
-
|
|
14780
|
+
devices.cameras.forEach((camera) => {
|
|
14781
|
+
const option = generateOption(camera.label, camera.id);
|
|
14782
|
+
cameras == null ? void 0 : cameras.appendChild(option);
|
|
14783
|
+
});
|
|
14784
|
+
devices.microphones.forEach((microphone) => {
|
|
14785
|
+
const option = generateOption(microphone.label, microphone.id);
|
|
14786
|
+
microphones == null ? void 0 : microphones.appendChild(option);
|
|
14787
|
+
});
|
|
14788
|
+
this.onSelectOptionChange();
|
|
14789
|
+
}
|
|
14790
|
+
async onSelectOptionChange() {
|
|
14791
|
+
const cameras = document.querySelector("#cameraSelect");
|
|
14792
|
+
const microphones = document.querySelector("#micSelect");
|
|
14793
|
+
cameras == null ? void 0 : cameras.addEventListener("change", async () => {
|
|
14794
|
+
var _a2;
|
|
14795
|
+
await this.cameraRecorder.stopRecording();
|
|
14796
|
+
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
14797
|
+
this.cameraRecorder = new CameraRecorder({
|
|
14798
|
+
cameraId: cameras == null ? void 0 : cameras.value,
|
|
14799
|
+
microphoneId: microphones == null ? void 0 : microphones.value
|
|
14800
|
+
}, {
|
|
14801
|
+
width: this.videoOptions.width,
|
|
14802
|
+
height: this.videoOptions.height
|
|
14803
|
+
});
|
|
14804
|
+
await this.cameraRecorder.startRecording();
|
|
14805
|
+
this.videoDeviceInterface(this.cameraRecorder.cameraStream);
|
|
14806
|
+
this.audioDeviceInterface(this.cameraRecorder.cameraStream);
|
|
14807
|
+
});
|
|
14808
|
+
microphones == null ? void 0 : microphones.addEventListener("change", async () => {
|
|
14809
|
+
var _a2;
|
|
14810
|
+
await this.cameraRecorder.stopRecording();
|
|
14811
|
+
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
14812
|
+
this.cameraRecorder = new CameraRecorder({
|
|
14813
|
+
cameraId: cameras == null ? void 0 : cameras.value,
|
|
14814
|
+
microphoneId: microphones == null ? void 0 : microphones.value
|
|
14815
|
+
}, {
|
|
14816
|
+
width: this.videoOptions.width,
|
|
14817
|
+
height: this.videoOptions.height
|
|
14818
|
+
});
|
|
14819
|
+
await this.cameraRecorder.startRecording();
|
|
14820
|
+
this.videoDeviceInterface(this.cameraRecorder.cameraStream);
|
|
14821
|
+
this.audioDeviceInterface(this.cameraRecorder.cameraStream);
|
|
14822
|
+
});
|
|
14773
14823
|
}
|
|
14774
14824
|
async startCheckDevices(options = getDefaultProctoringOptions, _videoOptions) {
|
|
14775
|
-
|
|
14825
|
+
this.setSelectOption(options);
|
|
14776
14826
|
this.videoOptions = validatePartialVideoOptions(_videoOptions);
|
|
14777
14827
|
await checkPermissions();
|
|
14778
14828
|
this.cameraRecorder = new CameraRecorder({
|
|
@@ -14782,35 +14832,26 @@ var DeviceChecker = class {
|
|
|
14782
14832
|
width: this.videoOptions.width,
|
|
14783
14833
|
height: this.videoOptions.height
|
|
14784
14834
|
});
|
|
14785
|
-
this.audioRecorder = new AudioRecorder();
|
|
14786
|
-
this.screenRecorder = options.captureScreen ? new ScreenRecorder({
|
|
14787
|
-
allowOnlyFirstMonitor: options.allowOnlyFirstMonitor || options.allowOnlyFirstMonitor == void 0 ? true : false,
|
|
14788
|
-
onStopSharingScreenCallback: () => {
|
|
14789
|
-
}
|
|
14790
|
-
}) : void 0;
|
|
14791
14835
|
await this.cameraRecorder.startRecording();
|
|
14792
|
-
await this.audioRecorder.startRecording();
|
|
14793
|
-
if (this.screenRecorder) {
|
|
14794
|
-
await this.screenRecorder.startRecording();
|
|
14795
|
-
}
|
|
14796
14836
|
this.videoDeviceInterface(this.cameraRecorder.cameraStream);
|
|
14797
14837
|
this.audioDeviceInterface(this.cameraRecorder.cameraStream);
|
|
14798
14838
|
return {
|
|
14799
|
-
cameraStream: this.cameraRecorder.cameraStream
|
|
14800
|
-
_screenStream: (_a2 = this.screenRecorder) == null ? void 0 : _a2.screenStream
|
|
14839
|
+
cameraStream: this.cameraRecorder.cameraStream
|
|
14801
14840
|
};
|
|
14802
14841
|
}
|
|
14803
14842
|
async closeCheckDevices() {
|
|
14804
14843
|
const checkDevices = document.querySelector("#checkDevices");
|
|
14805
14844
|
checkDevices == null ? void 0 : checkDevices.remove();
|
|
14806
14845
|
await this.cameraRecorder.stopRecording();
|
|
14807
|
-
await this.audioRecorder.stopRecording();
|
|
14808
|
-
if (this.screenRecorder) {
|
|
14809
|
-
await this.screenRecorder.stopRecording();
|
|
14810
|
-
}
|
|
14811
14846
|
}
|
|
14812
14847
|
};
|
|
14813
14848
|
|
|
14849
|
+
// src/errors/errors.ts
|
|
14850
|
+
var NOT_SHARED_FIRST_SCREEN = "not_shared_first_screen";
|
|
14851
|
+
var MULTIPLE_MONITORS_DETECTED = "multiple_monitors_detected";
|
|
14852
|
+
var PROCTORING_ALREADY_STARTED = "proctoring_already_started";
|
|
14853
|
+
var PROCTORING_NOT_STARTED = "proctoring_not_started";
|
|
14854
|
+
|
|
14814
14855
|
// src/extension/extension.ts
|
|
14815
14856
|
var Extension = class {
|
|
14816
14857
|
constructor() {
|
|
@@ -25056,49 +25097,6 @@ var ProctoringUploader = class {
|
|
|
25056
25097
|
}
|
|
25057
25098
|
};
|
|
25058
25099
|
|
|
25059
|
-
// src/new-flow/recorders/VolumeMeter.ts
|
|
25060
|
-
var VolumeMeter = class {
|
|
25061
|
-
constructor(stream) {
|
|
25062
|
-
this.stream = stream;
|
|
25063
|
-
}
|
|
25064
|
-
start() {
|
|
25065
|
-
return new Promise((resolve, reject) => {
|
|
25066
|
-
try {
|
|
25067
|
-
const audioContext = new AudioContext();
|
|
25068
|
-
const analyser = audioContext.createAnalyser();
|
|
25069
|
-
const microphone = audioContext.createMediaStreamSource(this.stream);
|
|
25070
|
-
this.scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
|
|
25071
|
-
analyser.smoothingTimeConstant = 0.8;
|
|
25072
|
-
analyser.fftSize = 1024;
|
|
25073
|
-
microphone.connect(analyser);
|
|
25074
|
-
analyser.connect(this.scriptProcessor);
|
|
25075
|
-
this.scriptProcessor.connect(audioContext.destination);
|
|
25076
|
-
const that = this;
|
|
25077
|
-
this.scriptProcessor.onaudioprocess = function() {
|
|
25078
|
-
const array = new Uint8Array(analyser.frequencyBinCount);
|
|
25079
|
-
analyser.getByteFrequencyData(array);
|
|
25080
|
-
const arraySum = array.reduce((a, value) => a + value, 0);
|
|
25081
|
-
const average = arraySum / array.length;
|
|
25082
|
-
that.setVolume(average);
|
|
25083
|
-
};
|
|
25084
|
-
resolve(true);
|
|
25085
|
-
} catch (error) {
|
|
25086
|
-
this.stop();
|
|
25087
|
-
reject(`Error: ${error}`);
|
|
25088
|
-
}
|
|
25089
|
-
});
|
|
25090
|
-
}
|
|
25091
|
-
stop() {
|
|
25092
|
-
this.scriptProcessor && this.scriptProcessor.disconnect();
|
|
25093
|
-
}
|
|
25094
|
-
getVolume() {
|
|
25095
|
-
return this.volume;
|
|
25096
|
-
}
|
|
25097
|
-
setVolume(value) {
|
|
25098
|
-
this.volume = value;
|
|
25099
|
-
}
|
|
25100
|
-
};
|
|
25101
|
-
|
|
25102
25100
|
// src/new-flow/recorders/AlertRecorder.ts
|
|
25103
25101
|
var AlertRecorder = class {
|
|
25104
25102
|
constructor(options, optionsProctoring, cameraRecorder) {
|
|
@@ -25178,6 +25176,111 @@ var AlertRecorder = class {
|
|
|
25178
25176
|
}
|
|
25179
25177
|
};
|
|
25180
25178
|
|
|
25179
|
+
// src/plugins/MicRecorder2.ts
|
|
25180
|
+
var MicRecorder = require_mp3();
|
|
25181
|
+
function createMicRecorder(config) {
|
|
25182
|
+
return new MicRecorder(config);
|
|
25183
|
+
}
|
|
25184
|
+
|
|
25185
|
+
// src/new-flow/recorders/AudioRecorder.ts
|
|
25186
|
+
var AudioRecorder = class {
|
|
25187
|
+
constructor() {
|
|
25188
|
+
this.blobs = [];
|
|
25189
|
+
}
|
|
25190
|
+
async startRecording() {
|
|
25191
|
+
this.recorder = createMicRecorder({
|
|
25192
|
+
bitRate: 128
|
|
25193
|
+
});
|
|
25194
|
+
this.recorder.start().catch((e) => {
|
|
25195
|
+
throw new Error("Error on Audio to Start Recording");
|
|
25196
|
+
});
|
|
25197
|
+
}
|
|
25198
|
+
async pauseRecording() {
|
|
25199
|
+
}
|
|
25200
|
+
async resumeRecording() {
|
|
25201
|
+
}
|
|
25202
|
+
async stopRecording() {
|
|
25203
|
+
if (!this.recorder)
|
|
25204
|
+
return;
|
|
25205
|
+
const response = await this.recorder.stop().getMp3().then(async ([buffer, blob]) => {
|
|
25206
|
+
return { buffer, blob };
|
|
25207
|
+
}).catch((e) => {
|
|
25208
|
+
alert("We could not retrieve your message");
|
|
25209
|
+
return void 0;
|
|
25210
|
+
});
|
|
25211
|
+
if (response) {
|
|
25212
|
+
this.blobs.push(response.blob);
|
|
25213
|
+
}
|
|
25214
|
+
}
|
|
25215
|
+
async saveOnSession(session) {
|
|
25216
|
+
session.addRecording({
|
|
25217
|
+
device: "",
|
|
25218
|
+
file: new File(this.blobs, `EP_${session.id}_audio_0.mp3`, {
|
|
25219
|
+
type: "audio/mp3"
|
|
25220
|
+
}),
|
|
25221
|
+
origin: "Mic" /* Mic */
|
|
25222
|
+
});
|
|
25223
|
+
}
|
|
25224
|
+
};
|
|
25225
|
+
|
|
25226
|
+
// src/new-flow/recorders/ScreenRecorder.ts
|
|
25227
|
+
var ScreenRecorder = class {
|
|
25228
|
+
constructor(options) {
|
|
25229
|
+
this.blobs = [];
|
|
25230
|
+
this.blobsFinal = [];
|
|
25231
|
+
this.options = options;
|
|
25232
|
+
}
|
|
25233
|
+
async startRecording() {
|
|
25234
|
+
this.startTime = new Date(Date.now());
|
|
25235
|
+
const { allowOnlyFirstMonitor, onStopSharingScreenCallback } = this.options;
|
|
25236
|
+
const displayMediaStreamConstraints = {
|
|
25237
|
+
video: {
|
|
25238
|
+
cursor: "always"
|
|
25239
|
+
},
|
|
25240
|
+
audio: false
|
|
25241
|
+
};
|
|
25242
|
+
this.screenStream = await navigator.mediaDevices.getDisplayMedia(displayMediaStreamConstraints);
|
|
25243
|
+
const tracks = this.screenStream.getVideoTracks();
|
|
25244
|
+
tracks[0].onended = onStopSharingScreenCallback;
|
|
25245
|
+
const isFirefox = navigator.userAgent.indexOf("Firefox") > -1;
|
|
25246
|
+
if (isFirefox) {
|
|
25247
|
+
const hasMultipleMonitors = !tracks.find((el) => el.label == "Primary Monitor");
|
|
25248
|
+
if (hasMultipleMonitors && allowOnlyFirstMonitor) {
|
|
25249
|
+
throw MULTIPLE_MONITORS_DETECTED;
|
|
25250
|
+
}
|
|
25251
|
+
}
|
|
25252
|
+
const sharedFirstScreen = tracks.find((el) => {
|
|
25253
|
+
return ["screen:0:0", "Primary Monitor"].includes(el.label);
|
|
25254
|
+
}) != null;
|
|
25255
|
+
if (!sharedFirstScreen && allowOnlyFirstMonitor) {
|
|
25256
|
+
tracks.forEach((el) => {
|
|
25257
|
+
el.stop();
|
|
25258
|
+
});
|
|
25259
|
+
throw NOT_SHARED_FIRST_SCREEN;
|
|
25260
|
+
}
|
|
25261
|
+
const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs);
|
|
25262
|
+
this.recordingStart = startRecording;
|
|
25263
|
+
this.recordingStop = stopRecording;
|
|
25264
|
+
this.recordingStart();
|
|
25265
|
+
}
|
|
25266
|
+
async pauseRecording() {
|
|
25267
|
+
}
|
|
25268
|
+
async resumeRecording() {
|
|
25269
|
+
}
|
|
25270
|
+
async stopRecording() {
|
|
25271
|
+
await this.recordingStop();
|
|
25272
|
+
}
|
|
25273
|
+
async saveOnSession(session) {
|
|
25274
|
+
session.addRecording({
|
|
25275
|
+
device: "",
|
|
25276
|
+
file: new File(this.blobs, `EP_${session.id}_screen_0.webm`, {
|
|
25277
|
+
type: "video/webm"
|
|
25278
|
+
}),
|
|
25279
|
+
origin: "Screen" /* Screen */
|
|
25280
|
+
});
|
|
25281
|
+
}
|
|
25282
|
+
};
|
|
25283
|
+
|
|
25181
25284
|
// src/new-flow/repository/IndexDbSessionRepository.ts
|
|
25182
25285
|
var IndexDbSessionRepository = class {
|
|
25183
25286
|
constructor(dbName, storeName) {
|