easyproctor 2.0.2 → 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 +3 -0
- package/esm/index.js +41 -7
- package/index.js +41 -7
- package/new-flow/recorders/AlertRecorder.d.ts +1 -5
- package/package.json +1 -1
- package/unpkg/easyproctor.min.js +47 -10
package/README.md
CHANGED
|
@@ -263,6 +263,9 @@ 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
|
+
|
|
266
269
|
## Release Note V 2.0.2
|
|
267
270
|
- Tratamento para fechamento de streams
|
|
268
271
|
- console.log() configuravel
|
package/esm/index.js
CHANGED
|
@@ -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());
|
|
@@ -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,
|
package/index.js
CHANGED
|
@@ -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());
|
|
@@ -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,
|
|
@@ -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>;
|