easyproctor 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/esm/index.js +58 -16
- package/index.js +58 -16
- package/new-flow/recorders/AlertRecorder.d.ts +1 -5
- package/package.json +1 -1
- package/proctoring/proctoring.d.ts +1 -0
- package/unpkg/easyproctor.min.js +52 -15
package/README.md
CHANGED
|
@@ -263,6 +263,12 @@ const {
|
|
|
263
263
|
token: "...",
|
|
264
264
|
});
|
|
265
265
|
```
|
|
266
|
+
## Release Note V 2.0.3
|
|
267
|
+
- Otimização na gravação de áudio removendo necessidade de download de scripts
|
|
268
|
+
|
|
269
|
+
## Release Note V 2.0.2
|
|
270
|
+
- Tratamento para fechamento de streams
|
|
271
|
+
- console.log() configuravel
|
|
266
272
|
|
|
267
273
|
## Release Note V 2.0.1
|
|
268
274
|
- Tratamento para duplo clique no checkDevices
|
package/esm/index.js
CHANGED
|
@@ -8527,7 +8527,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
|
|
|
8527
8527
|
const microphones = document.querySelector("#micSelect");
|
|
8528
8528
|
cameras == null ? void 0 : cameras.addEventListener("change", async () => {
|
|
8529
8529
|
var _a2;
|
|
8530
|
-
await this.cameraRecorder.stopRecording();
|
|
8530
|
+
this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
|
|
8531
8531
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
8532
8532
|
this.cameraRecorder = new CameraRecorder(
|
|
8533
8533
|
{
|
|
@@ -8548,7 +8548,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
|
|
|
8548
8548
|
});
|
|
8549
8549
|
microphones == null ? void 0 : microphones.addEventListener("change", async () => {
|
|
8550
8550
|
var _a2;
|
|
8551
|
-
await this.cameraRecorder.stopRecording();
|
|
8551
|
+
this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
|
|
8552
8552
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
8553
8553
|
this.cameraRecorder = new CameraRecorder(
|
|
8554
8554
|
{
|
|
@@ -8602,7 +8602,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
|
|
|
8602
8602
|
this.faceDetection.stopDetection();
|
|
8603
8603
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
8604
8604
|
this.volumeMedia = Math.ceil(this.volumeSum / this.volumeCounter);
|
|
8605
|
-
await this.cameraRecorder.stopRecording();
|
|
8605
|
+
this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
|
|
8606
8606
|
}
|
|
8607
8607
|
applyStyles(element, styles) {
|
|
8608
8608
|
for (const [property, value] of Object.entries(styles)) {
|
|
@@ -8844,12 +8844,11 @@ var ProctoringUploader = class {
|
|
|
8844
8844
|
|
|
8845
8845
|
// src/new-flow/recorders/AlertRecorder.ts
|
|
8846
8846
|
var AlertRecorder = class {
|
|
8847
|
-
constructor(options, optionsProctoring
|
|
8847
|
+
constructor(options, optionsProctoring) {
|
|
8848
8848
|
this.alerts = [];
|
|
8849
8849
|
this.onLostFocusCallback = options.onLostFocusCallback;
|
|
8850
8850
|
this.onFocusCallback = options.onFocusCallback;
|
|
8851
8851
|
this.optionsProctoring = optionsProctoring;
|
|
8852
|
-
this.cameraRecorder = cameraRecorder;
|
|
8853
8852
|
}
|
|
8854
8853
|
async startRecording() {
|
|
8855
8854
|
this.startTime = new Date(Date.now());
|
|
@@ -8928,7 +8927,7 @@ var AudioRecorder = class {
|
|
|
8928
8927
|
async resumeRecording() {
|
|
8929
8928
|
}
|
|
8930
8929
|
async stopRecording() {
|
|
8931
|
-
await this.recordingStop();
|
|
8930
|
+
this.recordingStop && await this.recordingStop();
|
|
8932
8931
|
}
|
|
8933
8932
|
async saveOnSession(session, start, end) {
|
|
8934
8933
|
session.addRecording({
|
|
@@ -11305,7 +11304,7 @@ var NoiseRecorder = class {
|
|
|
11305
11304
|
}
|
|
11306
11305
|
}
|
|
11307
11306
|
async stopSoundRecord() {
|
|
11308
|
-
await this.audioRecorder.stopRecording();
|
|
11307
|
+
this.audioRecorder.stopRecording && await this.audioRecorder.stopRecording();
|
|
11309
11308
|
this.recordingEndTime = Date.now() - this.examStartTime;
|
|
11310
11309
|
if (this.optionsProctoring.proctoringType !== "REALTIME")
|
|
11311
11310
|
return;
|
|
@@ -11347,8 +11346,6 @@ var NoiseRecorder = class {
|
|
|
11347
11346
|
if (this.optionsProctoring.proctoringType !== "REALTIME") {
|
|
11348
11347
|
return nameIncludesSpeech;
|
|
11349
11348
|
}
|
|
11350
|
-
if (nameIncludesSpeech)
|
|
11351
|
-
console.log(parseFloat(result.score));
|
|
11352
11349
|
const scoreGreaterThanThreshold = parseFloat(result.score) > 0.22;
|
|
11353
11350
|
if (nameIncludesSpeech && scoreGreaterThanThreshold) {
|
|
11354
11351
|
return true;
|
|
@@ -11371,7 +11368,7 @@ var NoiseRecorder = class {
|
|
|
11371
11368
|
async streamingAudioClassification() {
|
|
11372
11369
|
this.context = new AudioContext({ sampleRate: 16e3 });
|
|
11373
11370
|
try {
|
|
11374
|
-
await this.context.audioWorklet.addModule("
|
|
11371
|
+
await this.context.audioWorklet.addModule(URL.createObjectURL(new Blob([audioProcessorContent], { type: "text/javascript" })));
|
|
11375
11372
|
} catch (error) {
|
|
11376
11373
|
throw new Error("\u274C Error loading audio worklet module");
|
|
11377
11374
|
}
|
|
@@ -11399,6 +11396,44 @@ var NoiseRecorder = class {
|
|
|
11399
11396
|
this.audioWorkletNode.connect(this.context.destination);
|
|
11400
11397
|
}
|
|
11401
11398
|
};
|
|
11399
|
+
var audioProcessorContent = `
|
|
11400
|
+
class AudioProcessor extends AudioWorkletProcessor {
|
|
11401
|
+
bufferSize;
|
|
11402
|
+
inputBuffer;
|
|
11403
|
+
bufferIndex;
|
|
11404
|
+
|
|
11405
|
+
constructor() {
|
|
11406
|
+
super();
|
|
11407
|
+
this.bufferSize = 16384;
|
|
11408
|
+
this.inputBuffer = new Float32Array(this.bufferSize);
|
|
11409
|
+
this.bufferIndex = 0;
|
|
11410
|
+
}
|
|
11411
|
+
|
|
11412
|
+
process(
|
|
11413
|
+
inputs,
|
|
11414
|
+
outputs,
|
|
11415
|
+
parameters
|
|
11416
|
+
) {
|
|
11417
|
+
const input = inputs[0];
|
|
11418
|
+
if (input.length > 0) {
|
|
11419
|
+
const inputData = input[0];
|
|
11420
|
+
|
|
11421
|
+
for (let i = 0; i < inputData.length; i++) {
|
|
11422
|
+
this.inputBuffer[this.bufferIndex++] = inputData[i];
|
|
11423
|
+
|
|
11424
|
+
if (this.bufferIndex === this.bufferSize) {
|
|
11425
|
+
this.port.postMessage(this.inputBuffer);
|
|
11426
|
+
this.bufferIndex = 0;
|
|
11427
|
+
}
|
|
11428
|
+
}
|
|
11429
|
+
}
|
|
11430
|
+
|
|
11431
|
+
return true;
|
|
11432
|
+
}
|
|
11433
|
+
}
|
|
11434
|
+
|
|
11435
|
+
registerProcessor("audio-processor", AudioProcessor);
|
|
11436
|
+
`;
|
|
11402
11437
|
|
|
11403
11438
|
// src/new-flow/recorders/ScreenRecorder.ts
|
|
11404
11439
|
var ScreenRecorder = class {
|
|
@@ -11792,8 +11827,7 @@ var Proctoring = class {
|
|
|
11792
11827
|
onFocusCallback: () => this.onFocusCallback(),
|
|
11793
11828
|
onLostFocusCallback: () => this.onLostFocusCallback()
|
|
11794
11829
|
},
|
|
11795
|
-
options
|
|
11796
|
-
cameraRecorder
|
|
11830
|
+
options
|
|
11797
11831
|
);
|
|
11798
11832
|
const noiseRecorder = new NoiseRecorder(
|
|
11799
11833
|
options,
|
|
@@ -12104,19 +12138,29 @@ Error: ` + error
|
|
|
12104
12138
|
|
|
12105
12139
|
// src/proctoring/useProctoring.ts
|
|
12106
12140
|
function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
12141
|
+
if (!proctoringOptions.showConsole) {
|
|
12142
|
+
console.log = () => {
|
|
12143
|
+
};
|
|
12144
|
+
console.warn = () => {
|
|
12145
|
+
};
|
|
12146
|
+
console.error = () => {
|
|
12147
|
+
};
|
|
12148
|
+
}
|
|
12107
12149
|
const proctoring = new Proctoring({
|
|
12108
12150
|
type: enviromentConfig,
|
|
12109
12151
|
clientId: proctoringOptions.clientId,
|
|
12110
12152
|
examId: proctoringOptions.examId,
|
|
12111
12153
|
token: proctoringOptions.token,
|
|
12112
|
-
credentials: proctoringOptions.credentials
|
|
12154
|
+
credentials: proctoringOptions.credentials,
|
|
12155
|
+
showConsole: proctoringOptions.showConsole
|
|
12113
12156
|
});
|
|
12114
12157
|
const checker = new DeviceChecker({
|
|
12115
12158
|
type: enviromentConfig,
|
|
12116
12159
|
clientId: proctoringOptions.clientId,
|
|
12117
12160
|
examId: proctoringOptions.examId,
|
|
12118
12161
|
token: proctoringOptions.token,
|
|
12119
|
-
credentials: proctoringOptions.credentials
|
|
12162
|
+
credentials: proctoringOptions.credentials,
|
|
12163
|
+
showConsole: proctoringOptions.showConsole
|
|
12120
12164
|
});
|
|
12121
12165
|
const photo = new CapturePhoto();
|
|
12122
12166
|
const login = proctoring.login.bind(proctoring);
|
|
@@ -12151,8 +12195,6 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
12151
12195
|
}
|
|
12152
12196
|
|
|
12153
12197
|
// src/index.ts
|
|
12154
|
-
console.log = () => {
|
|
12155
|
-
};
|
|
12156
12198
|
if (typeof window !== "undefined") {
|
|
12157
12199
|
window.useProctoring = useProctoring;
|
|
12158
12200
|
}
|
package/index.js
CHANGED
|
@@ -20058,7 +20058,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
|
|
|
20058
20058
|
const microphones = document.querySelector("#micSelect");
|
|
20059
20059
|
cameras == null ? void 0 : cameras.addEventListener("change", async () => {
|
|
20060
20060
|
var _a2;
|
|
20061
|
-
await this.cameraRecorder.stopRecording();
|
|
20061
|
+
this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
|
|
20062
20062
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
20063
20063
|
this.cameraRecorder = new CameraRecorder(
|
|
20064
20064
|
{
|
|
@@ -20079,7 +20079,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
|
|
|
20079
20079
|
});
|
|
20080
20080
|
microphones == null ? void 0 : microphones.addEventListener("change", async () => {
|
|
20081
20081
|
var _a2;
|
|
20082
|
-
await this.cameraRecorder.stopRecording();
|
|
20082
|
+
this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
|
|
20083
20083
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
20084
20084
|
this.cameraRecorder = new CameraRecorder(
|
|
20085
20085
|
{
|
|
@@ -20133,7 +20133,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
|
|
|
20133
20133
|
this.faceDetection.stopDetection();
|
|
20134
20134
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
20135
20135
|
this.volumeMedia = Math.ceil(this.volumeSum / this.volumeCounter);
|
|
20136
|
-
await this.cameraRecorder.stopRecording();
|
|
20136
|
+
this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
|
|
20137
20137
|
}
|
|
20138
20138
|
applyStyles(element, styles) {
|
|
20139
20139
|
for (const [property, value] of Object.entries(styles)) {
|
|
@@ -20375,12 +20375,11 @@ var ProctoringUploader = class {
|
|
|
20375
20375
|
|
|
20376
20376
|
// src/new-flow/recorders/AlertRecorder.ts
|
|
20377
20377
|
var AlertRecorder = class {
|
|
20378
|
-
constructor(options, optionsProctoring
|
|
20378
|
+
constructor(options, optionsProctoring) {
|
|
20379
20379
|
this.alerts = [];
|
|
20380
20380
|
this.onLostFocusCallback = options.onLostFocusCallback;
|
|
20381
20381
|
this.onFocusCallback = options.onFocusCallback;
|
|
20382
20382
|
this.optionsProctoring = optionsProctoring;
|
|
20383
|
-
this.cameraRecorder = cameraRecorder;
|
|
20384
20383
|
}
|
|
20385
20384
|
async startRecording() {
|
|
20386
20385
|
this.startTime = new Date(Date.now());
|
|
@@ -20459,7 +20458,7 @@ var AudioRecorder = class {
|
|
|
20459
20458
|
async resumeRecording() {
|
|
20460
20459
|
}
|
|
20461
20460
|
async stopRecording() {
|
|
20462
|
-
await this.recordingStop();
|
|
20461
|
+
this.recordingStop && await this.recordingStop();
|
|
20463
20462
|
}
|
|
20464
20463
|
async saveOnSession(session, start, end) {
|
|
20465
20464
|
session.addRecording({
|
|
@@ -22836,7 +22835,7 @@ var NoiseRecorder = class {
|
|
|
22836
22835
|
}
|
|
22837
22836
|
}
|
|
22838
22837
|
async stopSoundRecord() {
|
|
22839
|
-
await this.audioRecorder.stopRecording();
|
|
22838
|
+
this.audioRecorder.stopRecording && await this.audioRecorder.stopRecording();
|
|
22840
22839
|
this.recordingEndTime = Date.now() - this.examStartTime;
|
|
22841
22840
|
if (this.optionsProctoring.proctoringType !== "REALTIME")
|
|
22842
22841
|
return;
|
|
@@ -22878,8 +22877,6 @@ var NoiseRecorder = class {
|
|
|
22878
22877
|
if (this.optionsProctoring.proctoringType !== "REALTIME") {
|
|
22879
22878
|
return nameIncludesSpeech;
|
|
22880
22879
|
}
|
|
22881
|
-
if (nameIncludesSpeech)
|
|
22882
|
-
console.log(parseFloat(result.score));
|
|
22883
22880
|
const scoreGreaterThanThreshold = parseFloat(result.score) > 0.22;
|
|
22884
22881
|
if (nameIncludesSpeech && scoreGreaterThanThreshold) {
|
|
22885
22882
|
return true;
|
|
@@ -22902,7 +22899,7 @@ var NoiseRecorder = class {
|
|
|
22902
22899
|
async streamingAudioClassification() {
|
|
22903
22900
|
this.context = new AudioContext({ sampleRate: 16e3 });
|
|
22904
22901
|
try {
|
|
22905
|
-
await this.context.audioWorklet.addModule("
|
|
22902
|
+
await this.context.audioWorklet.addModule(URL.createObjectURL(new Blob([audioProcessorContent], { type: "text/javascript" })));
|
|
22906
22903
|
} catch (error) {
|
|
22907
22904
|
throw new Error("\u274C Error loading audio worklet module");
|
|
22908
22905
|
}
|
|
@@ -22930,6 +22927,44 @@ var NoiseRecorder = class {
|
|
|
22930
22927
|
this.audioWorkletNode.connect(this.context.destination);
|
|
22931
22928
|
}
|
|
22932
22929
|
};
|
|
22930
|
+
var audioProcessorContent = `
|
|
22931
|
+
class AudioProcessor extends AudioWorkletProcessor {
|
|
22932
|
+
bufferSize;
|
|
22933
|
+
inputBuffer;
|
|
22934
|
+
bufferIndex;
|
|
22935
|
+
|
|
22936
|
+
constructor() {
|
|
22937
|
+
super();
|
|
22938
|
+
this.bufferSize = 16384;
|
|
22939
|
+
this.inputBuffer = new Float32Array(this.bufferSize);
|
|
22940
|
+
this.bufferIndex = 0;
|
|
22941
|
+
}
|
|
22942
|
+
|
|
22943
|
+
process(
|
|
22944
|
+
inputs,
|
|
22945
|
+
outputs,
|
|
22946
|
+
parameters
|
|
22947
|
+
) {
|
|
22948
|
+
const input = inputs[0];
|
|
22949
|
+
if (input.length > 0) {
|
|
22950
|
+
const inputData = input[0];
|
|
22951
|
+
|
|
22952
|
+
for (let i = 0; i < inputData.length; i++) {
|
|
22953
|
+
this.inputBuffer[this.bufferIndex++] = inputData[i];
|
|
22954
|
+
|
|
22955
|
+
if (this.bufferIndex === this.bufferSize) {
|
|
22956
|
+
this.port.postMessage(this.inputBuffer);
|
|
22957
|
+
this.bufferIndex = 0;
|
|
22958
|
+
}
|
|
22959
|
+
}
|
|
22960
|
+
}
|
|
22961
|
+
|
|
22962
|
+
return true;
|
|
22963
|
+
}
|
|
22964
|
+
}
|
|
22965
|
+
|
|
22966
|
+
registerProcessor("audio-processor", AudioProcessor);
|
|
22967
|
+
`;
|
|
22933
22968
|
|
|
22934
22969
|
// src/new-flow/recorders/ScreenRecorder.ts
|
|
22935
22970
|
var ScreenRecorder = class {
|
|
@@ -23323,8 +23358,7 @@ var Proctoring = class {
|
|
|
23323
23358
|
onFocusCallback: () => this.onFocusCallback(),
|
|
23324
23359
|
onLostFocusCallback: () => this.onLostFocusCallback()
|
|
23325
23360
|
},
|
|
23326
|
-
options
|
|
23327
|
-
cameraRecorder
|
|
23361
|
+
options
|
|
23328
23362
|
);
|
|
23329
23363
|
const noiseRecorder = new NoiseRecorder(
|
|
23330
23364
|
options,
|
|
@@ -23635,19 +23669,29 @@ Error: ` + error
|
|
|
23635
23669
|
|
|
23636
23670
|
// src/proctoring/useProctoring.ts
|
|
23637
23671
|
function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
23672
|
+
if (!proctoringOptions.showConsole) {
|
|
23673
|
+
console.log = () => {
|
|
23674
|
+
};
|
|
23675
|
+
console.warn = () => {
|
|
23676
|
+
};
|
|
23677
|
+
console.error = () => {
|
|
23678
|
+
};
|
|
23679
|
+
}
|
|
23638
23680
|
const proctoring = new Proctoring({
|
|
23639
23681
|
type: enviromentConfig,
|
|
23640
23682
|
clientId: proctoringOptions.clientId,
|
|
23641
23683
|
examId: proctoringOptions.examId,
|
|
23642
23684
|
token: proctoringOptions.token,
|
|
23643
|
-
credentials: proctoringOptions.credentials
|
|
23685
|
+
credentials: proctoringOptions.credentials,
|
|
23686
|
+
showConsole: proctoringOptions.showConsole
|
|
23644
23687
|
});
|
|
23645
23688
|
const checker = new DeviceChecker({
|
|
23646
23689
|
type: enviromentConfig,
|
|
23647
23690
|
clientId: proctoringOptions.clientId,
|
|
23648
23691
|
examId: proctoringOptions.examId,
|
|
23649
23692
|
token: proctoringOptions.token,
|
|
23650
|
-
credentials: proctoringOptions.credentials
|
|
23693
|
+
credentials: proctoringOptions.credentials,
|
|
23694
|
+
showConsole: proctoringOptions.showConsole
|
|
23651
23695
|
});
|
|
23652
23696
|
const photo = new CapturePhoto();
|
|
23653
23697
|
const login = proctoring.login.bind(proctoring);
|
|
@@ -23682,8 +23726,6 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
23682
23726
|
}
|
|
23683
23727
|
|
|
23684
23728
|
// src/index.ts
|
|
23685
|
-
console.log = () => {
|
|
23686
|
-
};
|
|
23687
23729
|
if (typeof window !== "undefined") {
|
|
23688
23730
|
window.useProctoring = useProctoring;
|
|
23689
23731
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ProctoringSessionOptions } from "../../proctoring/options/ProctoringOptions";
|
|
2
2
|
import { ProctoringSession } from "../proctoring/ProctoringSession";
|
|
3
|
-
import { CameraRecorder } from "./CameraRecorder";
|
|
4
3
|
import { IRecorder } from "./IRecorder";
|
|
5
4
|
export declare class AlertRecorder implements IRecorder {
|
|
6
5
|
private alerts;
|
|
@@ -8,13 +7,10 @@ export declare class AlertRecorder implements IRecorder {
|
|
|
8
7
|
private onLostFocusCallback;
|
|
9
8
|
private onFocusCallback;
|
|
10
9
|
private optionsProctoring;
|
|
11
|
-
private cameraRecorder;
|
|
12
|
-
private intervalNoiseDetection;
|
|
13
|
-
private volumeMeter;
|
|
14
10
|
constructor(options: {
|
|
15
11
|
onLostFocusCallback: () => void;
|
|
16
12
|
onFocusCallback: () => void;
|
|
17
|
-
}, optionsProctoring: ProctoringSessionOptions
|
|
13
|
+
}, optionsProctoring: ProctoringSessionOptions);
|
|
18
14
|
startRecording(): Promise<void>;
|
|
19
15
|
pauseRecording(): Promise<void>;
|
|
20
16
|
resumeRecording(): Promise<void>;
|
package/package.json
CHANGED