easyproctor-hml 0.0.69 → 0.0.71

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
@@ -26386,7 +26386,6 @@ var Proctoring = class {
26386
26386
  type: context.type || "prod",
26387
26387
  token: context.token
26388
26388
  });
26389
- this.repository = new IndexDbSessionRepository("EasyProctorDb", "exams2");
26390
26389
  this.repositoryDevices = new IndexDbSessionRepository("EasyProctorDbDevices", "devices");
26391
26390
  ((_a2 = this.context.credentials) == null ? void 0 : _a2.cpf) && (this.auth = new Auth(this.context.credentials.cpf, this.backend));
26392
26391
  }
@@ -26500,17 +26499,12 @@ var Proctoring = class {
26500
26499
  throw PROCTORING_ALREADY_STARTED;
26501
26500
  }
26502
26501
  this.state = "Starting" /* Starting */;
26503
- if (await this.repository.hasSessions()) {
26504
- await this.repository.clear();
26505
- }
26506
- this.proctoringSession = new ProctoringSession();
26507
26502
  this.allRecorders = this.createRecorders(this.sessionOptions);
26508
26503
  await this.recorder.startAll();
26509
26504
  this.proctoringId = "123541";
26510
26505
  this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
26511
26506
  this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
26512
26507
  this.proctoringSession.setProctoringId(this.proctoringId);
26513
- await this.repository.save(this.proctoringSession);
26514
26508
  const _navigator = {};
26515
26509
  for (const i3 in navigator)
26516
26510
  _navigator[i3] = navigator[i3];
@@ -26541,7 +26535,6 @@ Error: ${error}`);
26541
26535
  }
26542
26536
  await this.recorder.stopAll();
26543
26537
  await this.recorder.saveAllOnSession();
26544
- await this.repository.save(this.proctoringSession);
26545
26538
  this.state = "Stop" /* Stop */;
26546
26539
  } catch (error) {
26547
26540
  await this.cancel();
@@ -26565,30 +26558,55 @@ Error: ` + error);
26565
26558
  }
26566
26559
  async finishDownload() {
26567
26560
  await this.finish();
26568
- this.state = "Stop" /* Stop */;
26569
- const file2 = this.proctoringSession.recordings[0].file;
26570
- const url2 = URL.createObjectURL(file2);
26571
- const a3 = document.createElement("a");
26572
- document.body.appendChild(a3);
26573
- a3.style.display = "none";
26574
- a3.href = url2;
26575
- a3.download = file2.name;
26576
- a3.click();
26577
- window.URL.revokeObjectURL(url2);
26561
+ console.log("Length:" + this.proctoringSession.recordings.length);
26562
+ for (let i3 = 0; i3 < this.proctoringSession.recordings.length; i3++) {
26563
+ console.log("baixando " + this.proctoringSession.recordings[i3].device);
26564
+ this.state = "Stop" /* Stop */;
26565
+ const file2 = this.proctoringSession.recordings[i3].file;
26566
+ const url2 = URL.createObjectURL(file2);
26567
+ console.log("url2 " + url2);
26568
+ console.log("file2 length " + file2.size);
26569
+ const a3 = document.createElement("a");
26570
+ document.body.appendChild(a3);
26571
+ a3.style.display = "none";
26572
+ a3.href = url2;
26573
+ a3.download = file2.name;
26574
+ a3.click();
26575
+ console.log("click " + this.proctoringSession.recordings[i3].device);
26576
+ window.URL.revokeObjectURL(url2);
26577
+ console.log("revokeObjectURL " + this.proctoringSession.recordings[i3].device);
26578
+ }
26579
+ for (let i3 = 0; i3 < this.proctoringSession.recordings.length; i3++) {
26580
+ console.log("baixando " + this.proctoringSession.recordings[i3].device);
26581
+ this.state = "Stop" /* Stop */;
26582
+ const currentFile = this.proctoringSession.recordings[i3].file;
26583
+ const file2 = new File([currentFile], currentFile.name);
26584
+ const url2 = URL.createObjectURL(file2);
26585
+ console.log("url2 " + url2);
26586
+ console.log("file2 length " + file2.size);
26587
+ const a3 = document.createElement("a");
26588
+ document.body.appendChild(a3);
26589
+ a3.style.display = "none";
26590
+ a3.href = url2;
26591
+ a3.download = file2.name;
26592
+ a3.click();
26593
+ console.log("click " + this.proctoringSession.recordings[i3].device);
26594
+ window.URL.revokeObjectURL(url2);
26595
+ console.log("revokeObjectURL " + this.proctoringSession.recordings[i3].device);
26596
+ }
26578
26597
  }
26579
26598
  async download() {
26580
- const file = new File(["foo"], "foo.txt", {
26599
+ const file = new File(["foo"], "file.txt", {
26581
26600
  type: "text/plain"
26582
26601
  });
26583
- const url = URL.createObjectURL(file);
26584
- console.log("url:" + url);
26585
- const a3 = document.createElement("a");
26586
- document.body.appendChild(a3);
26587
- a3.style.display = "none";
26588
- a3.href = url;
26589
- a3.download = file.name;
26590
- a3.click();
26591
- window.URL.revokeObjectURL(url);
26602
+ this.proctoringSession = new ProctoringSession();
26603
+ this.proctoringSession.addRecording(
26604
+ {
26605
+ device: `teste txt`,
26606
+ file,
26607
+ origin: "Camera" /* Camera */
26608
+ }
26609
+ );
26592
26610
  await this.start(
26593
26611
  {
26594
26612
  cameraId: "default",
@@ -26667,7 +26685,6 @@ Error: ` + error);
26667
26685
  }
26668
26686
  await this.recorder.stopAll();
26669
26687
  await this.recorder.saveAllOnSession();
26670
- await this.repository.save(this.proctoringSession);
26671
26688
  this.state = "Paused" /* Paused */;
26672
26689
  }
26673
26690
  async resume() {
@@ -26679,7 +26696,6 @@ Error: ` + error);
26679
26696
  await this.verifyMultipleMonitors(this.sessionOptions);
26680
26697
  await this.recorder.startAll();
26681
26698
  this.proctoringSession.recordings = [];
26682
- await this.repository.save(this.proctoringSession);
26683
26699
  this.state = "Recording" /* Recording */;
26684
26700
  return {
26685
26701
  cameraStream: this.allRecorders.cameraRecorder.cameraStream,
package/index.js CHANGED
@@ -37934,7 +37934,6 @@ var Proctoring = class {
37934
37934
  type: context.type || "prod",
37935
37935
  token: context.token
37936
37936
  });
37937
- this.repository = new IndexDbSessionRepository("EasyProctorDb", "exams2");
37938
37937
  this.repositoryDevices = new IndexDbSessionRepository("EasyProctorDbDevices", "devices");
37939
37938
  ((_a2 = this.context.credentials) == null ? void 0 : _a2.cpf) && (this.auth = new Auth(this.context.credentials.cpf, this.backend));
37940
37939
  }
@@ -38048,17 +38047,12 @@ var Proctoring = class {
38048
38047
  throw PROCTORING_ALREADY_STARTED;
38049
38048
  }
38050
38049
  this.state = "Starting" /* Starting */;
38051
- if (await this.repository.hasSessions()) {
38052
- await this.repository.clear();
38053
- }
38054
- this.proctoringSession = new ProctoringSession();
38055
38050
  this.allRecorders = this.createRecorders(this.sessionOptions);
38056
38051
  await this.recorder.startAll();
38057
38052
  this.proctoringId = "123541";
38058
38053
  this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
38059
38054
  this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
38060
38055
  this.proctoringSession.setProctoringId(this.proctoringId);
38061
- await this.repository.save(this.proctoringSession);
38062
38056
  const _navigator = {};
38063
38057
  for (const i3 in navigator)
38064
38058
  _navigator[i3] = navigator[i3];
@@ -38089,7 +38083,6 @@ Error: ${error}`);
38089
38083
  }
38090
38084
  await this.recorder.stopAll();
38091
38085
  await this.recorder.saveAllOnSession();
38092
- await this.repository.save(this.proctoringSession);
38093
38086
  this.state = "Stop" /* Stop */;
38094
38087
  } catch (error) {
38095
38088
  await this.cancel();
@@ -38113,30 +38106,55 @@ Error: ` + error);
38113
38106
  }
38114
38107
  async finishDownload() {
38115
38108
  await this.finish();
38116
- this.state = "Stop" /* Stop */;
38117
- const file2 = this.proctoringSession.recordings[0].file;
38118
- const url2 = URL.createObjectURL(file2);
38119
- const a3 = document.createElement("a");
38120
- document.body.appendChild(a3);
38121
- a3.style.display = "none";
38122
- a3.href = url2;
38123
- a3.download = file2.name;
38124
- a3.click();
38125
- window.URL.revokeObjectURL(url2);
38109
+ console.log("Length:" + this.proctoringSession.recordings.length);
38110
+ for (let i3 = 0; i3 < this.proctoringSession.recordings.length; i3++) {
38111
+ console.log("baixando " + this.proctoringSession.recordings[i3].device);
38112
+ this.state = "Stop" /* Stop */;
38113
+ const file2 = this.proctoringSession.recordings[i3].file;
38114
+ const url2 = URL.createObjectURL(file2);
38115
+ console.log("url2 " + url2);
38116
+ console.log("file2 length " + file2.size);
38117
+ const a3 = document.createElement("a");
38118
+ document.body.appendChild(a3);
38119
+ a3.style.display = "none";
38120
+ a3.href = url2;
38121
+ a3.download = file2.name;
38122
+ a3.click();
38123
+ console.log("click " + this.proctoringSession.recordings[i3].device);
38124
+ window.URL.revokeObjectURL(url2);
38125
+ console.log("revokeObjectURL " + this.proctoringSession.recordings[i3].device);
38126
+ }
38127
+ for (let i3 = 0; i3 < this.proctoringSession.recordings.length; i3++) {
38128
+ console.log("baixando " + this.proctoringSession.recordings[i3].device);
38129
+ this.state = "Stop" /* Stop */;
38130
+ const currentFile = this.proctoringSession.recordings[i3].file;
38131
+ const file2 = new File([currentFile], currentFile.name);
38132
+ const url2 = URL.createObjectURL(file2);
38133
+ console.log("url2 " + url2);
38134
+ console.log("file2 length " + file2.size);
38135
+ const a3 = document.createElement("a");
38136
+ document.body.appendChild(a3);
38137
+ a3.style.display = "none";
38138
+ a3.href = url2;
38139
+ a3.download = file2.name;
38140
+ a3.click();
38141
+ console.log("click " + this.proctoringSession.recordings[i3].device);
38142
+ window.URL.revokeObjectURL(url2);
38143
+ console.log("revokeObjectURL " + this.proctoringSession.recordings[i3].device);
38144
+ }
38126
38145
  }
38127
38146
  async download() {
38128
- const file = new File(["foo"], "foo.txt", {
38147
+ const file = new File(["foo"], "file.txt", {
38129
38148
  type: "text/plain"
38130
38149
  });
38131
- const url2 = URL.createObjectURL(file);
38132
- console.log("url:" + url2);
38133
- const a3 = document.createElement("a");
38134
- document.body.appendChild(a3);
38135
- a3.style.display = "none";
38136
- a3.href = url2;
38137
- a3.download = file.name;
38138
- a3.click();
38139
- window.URL.revokeObjectURL(url2);
38150
+ this.proctoringSession = new ProctoringSession();
38151
+ this.proctoringSession.addRecording(
38152
+ {
38153
+ device: `teste txt`,
38154
+ file,
38155
+ origin: "Camera" /* Camera */
38156
+ }
38157
+ );
38140
38158
  await this.start(
38141
38159
  {
38142
38160
  cameraId: "default",
@@ -38215,7 +38233,6 @@ Error: ` + error);
38215
38233
  }
38216
38234
  await this.recorder.stopAll();
38217
38235
  await this.recorder.saveAllOnSession();
38218
- await this.repository.save(this.proctoringSession);
38219
38236
  this.state = "Paused" /* Paused */;
38220
38237
  }
38221
38238
  async resume() {
@@ -38227,7 +38244,6 @@ Error: ` + error);
38227
38244
  await this.verifyMultipleMonitors(this.sessionOptions);
38228
38245
  await this.recorder.startAll();
38229
38246
  this.proctoringSession.recordings = [];
38230
- await this.repository.save(this.proctoringSession);
38231
38247
  this.state = "Recording" /* Recording */;
38232
38248
  return {
38233
38249
  cameraStream: this.allRecorders.cameraRecorder.cameraStream,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor-hml",
3
- "version": "0.0.69",
3
+ "version": "0.0.71",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",