easyproctor-hml 2.7.12 → 2.7.13

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 CHANGED
@@ -13777,11 +13777,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
13777
13777
  type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
13778
13778
  });
13779
13779
  const fixedBlob = await fixWebmDuration(rawBlob, this.duration);
13780
- const fileWithDuration = new File(
13781
- [fixedBlob],
13782
- `EP_${session.id}_camera_0.webm`,
13783
- { type: rawBlob.type }
13784
- );
13780
+ const arrayBuffer = await fixedBlob.arrayBuffer();
13785
13781
  session.addRecording({
13786
13782
  device: `Audio
13787
13783
  Sample Rate: ${settingsAudio.sampleRate}
@@ -13789,7 +13785,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
13789
13785
 
13790
13786
  Video:
13791
13787
  ${JSON.stringify(this.recorderOptions)}`,
13792
- file: fileWithDuration,
13788
+ arrayBuffer,
13793
13789
  origin: "Camera" /* Camera */
13794
13790
  });
13795
13791
  }
@@ -15744,46 +15740,60 @@ var ProctoringUploader = class {
15744
15740
  globalOnProgres(100);
15745
15741
  }
15746
15742
  }
15743
+ toFile(rec) {
15744
+ const suffix = rec.origin === "Screen" /* Screen */ ? "screen" : rec.origin === "Camera" /* Camera */ ? "camera" : "audio";
15745
+ const name = `EP_${this.proctoringId}_${suffix}_0.webm`;
15746
+ return new File([rec.arrayBuffer], name, { type: "video/webm" });
15747
+ }
15748
+ getFileType(origin2) {
15749
+ switch (origin2) {
15750
+ case "Camera" /* Camera */:
15751
+ return "Camera";
15752
+ case "Screen" /* Screen */:
15753
+ return "Screen";
15754
+ case "Mic" /* Mic */:
15755
+ return "Audio";
15756
+ }
15757
+ }
15747
15758
  async uploadFile(rec, token, onProgress) {
15759
+ const file = this.toFile(rec);
15748
15760
  for await (const uploadService of this.uploadServices) {
15749
15761
  const result = await uploadService.upload(
15750
15762
  {
15751
- file: rec.file,
15763
+ file,
15752
15764
  onProgress: (progress) => {
15753
15765
  if (onProgress) onProgress(progress);
15754
15766
  }
15755
15767
  },
15756
15768
  token
15757
- ).catch(
15758
- async (e3) => {
15759
- console.log("Upload File Error", e3), trackers.registerError(this.proctoringId, `Upload File
15760
- Name: ${rec.file.name}
15769
+ ).catch(async (e3) => {
15770
+ console.log("Upload File Error", e3), trackers.registerError(
15771
+ this.proctoringId,
15772
+ `Upload File
15773
+ Name: ${file.name}
15761
15774
  Error: ${e3.message}
15762
- Size: ${e3.error}`);
15763
- await uploadService.upload(
15764
- {
15765
- file: rec.file,
15766
- onProgress: (progress) => {
15767
- if (onProgress) onProgress(progress);
15768
- }
15769
- },
15770
- token
15771
- );
15772
- }
15773
- );
15775
+ Size: ${e3.error}`
15776
+ );
15777
+ await uploadService.upload(
15778
+ {
15779
+ file,
15780
+ onProgress: (progress) => {
15781
+ if (onProgress) onProgress(progress);
15782
+ }
15783
+ },
15784
+ token
15785
+ );
15786
+ });
15774
15787
  if (result) {
15775
- let fileType = "";
15776
- if (rec.file.name.search("camera") !== -1) {
15777
- fileType = "Camera";
15778
- } else if (rec.file.name.search("screen") !== -1) {
15779
- fileType = "Screen";
15780
- } else if (rec.file.name.search("audio") !== -1) {
15781
- fileType = "Audio";
15782
- }
15783
- trackers.registerUploadFile(this.proctoringId, `Upload File
15784
- Name: ${rec.file.name}
15785
- Type: ${rec.file.type}
15786
- Size: ${rec.file.size}`, fileType);
15788
+ const fileType = this.getFileType(rec.origin);
15789
+ trackers.registerUploadFile(
15790
+ this.proctoringId,
15791
+ `Upload File
15792
+ Name: ${file.name}
15793
+ Type: ${file.type}
15794
+ Size: ${file.size}`,
15795
+ fileType
15796
+ );
15787
15797
  return result;
15788
15798
  }
15789
15799
  }
@@ -18593,14 +18603,10 @@ var ScreenRecorder = class {
18593
18603
  type: "video/webm"
18594
18604
  });
18595
18605
  const fixedBlob = await fixWebmDuration2(rawBlob, this.duration);
18596
- const file = new File(
18597
- [fixedBlob],
18598
- `EP_${session.id}_screen_0.webm`,
18599
- { type: rawBlob.type }
18600
- );
18606
+ const arrayBuffer = await fixedBlob.arrayBuffer();
18601
18607
  session.addRecording({
18602
18608
  device: "",
18603
- file,
18609
+ arrayBuffer,
18604
18610
  origin: "Screen" /* Screen */
18605
18611
  });
18606
18612
  }
@@ -22880,7 +22886,9 @@ Error: ${error}`
22880
22886
  this.appChecker && await this.appChecker.disconnectWebSocket();
22881
22887
  await this.recorder.saveAllOnSession();
22882
22888
  await this.sendPendingRealtimeAlerts();
22889
+ trackers.registerError(this.proctoringId, `finish this.repository.save starting`);
22883
22890
  await this.repository.save(this.proctoringSession);
22891
+ trackers.registerError(this.proctoringId, `finish this.repository.save finished`);
22884
22892
  let uploader;
22885
22893
  let uploaderServices;
22886
22894
  if (versionVerify() !== "1.0.0.0") {
package/index.js CHANGED
@@ -31874,11 +31874,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31874
31874
  type: ((_b = this.recorderOptions) == null ? void 0 : _b.mimeType) || "video/webm"
31875
31875
  });
31876
31876
  const fixedBlob = await fixWebmDuration(rawBlob, this.duration);
31877
- const fileWithDuration = new File(
31878
- [fixedBlob],
31879
- `EP_${session.id}_camera_0.webm`,
31880
- { type: rawBlob.type }
31881
- );
31877
+ const arrayBuffer = await fixedBlob.arrayBuffer();
31882
31878
  session.addRecording({
31883
31879
  device: `Audio
31884
31880
  Sample Rate: ${settingsAudio.sampleRate}
@@ -31886,7 +31882,7 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31886
31882
 
31887
31883
  Video:
31888
31884
  ${JSON.stringify(this.recorderOptions)}`,
31889
- file: fileWithDuration,
31885
+ arrayBuffer,
31890
31886
  origin: "Camera" /* Camera */
31891
31887
  });
31892
31888
  }
@@ -33841,46 +33837,60 @@ var ProctoringUploader = class {
33841
33837
  globalOnProgres(100);
33842
33838
  }
33843
33839
  }
33840
+ toFile(rec) {
33841
+ const suffix = rec.origin === "Screen" /* Screen */ ? "screen" : rec.origin === "Camera" /* Camera */ ? "camera" : "audio";
33842
+ const name = `EP_${this.proctoringId}_${suffix}_0.webm`;
33843
+ return new File([rec.arrayBuffer], name, { type: "video/webm" });
33844
+ }
33845
+ getFileType(origin2) {
33846
+ switch (origin2) {
33847
+ case "Camera" /* Camera */:
33848
+ return "Camera";
33849
+ case "Screen" /* Screen */:
33850
+ return "Screen";
33851
+ case "Mic" /* Mic */:
33852
+ return "Audio";
33853
+ }
33854
+ }
33844
33855
  async uploadFile(rec, token, onProgress) {
33856
+ const file = this.toFile(rec);
33845
33857
  for await (const uploadService of this.uploadServices) {
33846
33858
  const result = await uploadService.upload(
33847
33859
  {
33848
- file: rec.file,
33860
+ file,
33849
33861
  onProgress: (progress) => {
33850
33862
  if (onProgress) onProgress(progress);
33851
33863
  }
33852
33864
  },
33853
33865
  token
33854
- ).catch(
33855
- async (e3) => {
33856
- console.log("Upload File Error", e3), trackers.registerError(this.proctoringId, `Upload File
33857
- Name: ${rec.file.name}
33866
+ ).catch(async (e3) => {
33867
+ console.log("Upload File Error", e3), trackers.registerError(
33868
+ this.proctoringId,
33869
+ `Upload File
33870
+ Name: ${file.name}
33858
33871
  Error: ${e3.message}
33859
- Size: ${e3.error}`);
33860
- await uploadService.upload(
33861
- {
33862
- file: rec.file,
33863
- onProgress: (progress) => {
33864
- if (onProgress) onProgress(progress);
33865
- }
33866
- },
33867
- token
33868
- );
33869
- }
33870
- );
33872
+ Size: ${e3.error}`
33873
+ );
33874
+ await uploadService.upload(
33875
+ {
33876
+ file,
33877
+ onProgress: (progress) => {
33878
+ if (onProgress) onProgress(progress);
33879
+ }
33880
+ },
33881
+ token
33882
+ );
33883
+ });
33871
33884
  if (result) {
33872
- let fileType = "";
33873
- if (rec.file.name.search("camera") !== -1) {
33874
- fileType = "Camera";
33875
- } else if (rec.file.name.search("screen") !== -1) {
33876
- fileType = "Screen";
33877
- } else if (rec.file.name.search("audio") !== -1) {
33878
- fileType = "Audio";
33879
- }
33880
- trackers.registerUploadFile(this.proctoringId, `Upload File
33881
- Name: ${rec.file.name}
33882
- Type: ${rec.file.type}
33883
- Size: ${rec.file.size}`, fileType);
33885
+ const fileType = this.getFileType(rec.origin);
33886
+ trackers.registerUploadFile(
33887
+ this.proctoringId,
33888
+ `Upload File
33889
+ Name: ${file.name}
33890
+ Type: ${file.type}
33891
+ Size: ${file.size}`,
33892
+ fileType
33893
+ );
33884
33894
  return result;
33885
33895
  }
33886
33896
  }
@@ -36690,14 +36700,10 @@ var ScreenRecorder = class {
36690
36700
  type: "video/webm"
36691
36701
  });
36692
36702
  const fixedBlob = await fixWebmDuration2(rawBlob, this.duration);
36693
- const file = new File(
36694
- [fixedBlob],
36695
- `EP_${session.id}_screen_0.webm`,
36696
- { type: rawBlob.type }
36697
- );
36703
+ const arrayBuffer = await fixedBlob.arrayBuffer();
36698
36704
  session.addRecording({
36699
36705
  device: "",
36700
- file,
36706
+ arrayBuffer,
36701
36707
  origin: "Screen" /* Screen */
36702
36708
  });
36703
36709
  }
@@ -38129,7 +38135,9 @@ Error: ${error}`
38129
38135
  this.appChecker && await this.appChecker.disconnectWebSocket();
38130
38136
  await this.recorder.saveAllOnSession();
38131
38137
  await this.sendPendingRealtimeAlerts();
38138
+ trackers.registerError(this.proctoringId, `finish this.repository.save starting`);
38132
38139
  await this.repository.save(this.proctoringSession);
38140
+ trackers.registerError(this.proctoringId, `finish this.repository.save finished`);
38133
38141
  let uploader;
38134
38142
  let uploaderServices;
38135
38143
  if (versionVerify() !== "1.0.0.0") {
@@ -50,7 +50,7 @@ export interface Alert {
50
50
  }
51
51
  export interface Recording {
52
52
  origin: RecordingOrigin;
53
- file: File;
53
+ arrayBuffer: ArrayBuffer;
54
54
  device: string;
55
55
  upload?: {
56
56
  storage: StorageService;
@@ -10,5 +10,7 @@ export declare class ProctoringUploader {
10
10
  upload(token: string, progress?: ProgressCallback): Promise<void>;
11
11
  private uploadRecordings;
12
12
  private uploadAllFiles;
13
+ private toFile;
14
+ private getFileType;
13
15
  private uploadFile;
14
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor-hml",
3
- "version": "2.7.12",
3
+ "version": "2.7.13",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",