easyproctor 0.0.89 → 1.0.1

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 CHANGED
@@ -219,12 +219,9 @@ const {
219
219
  });
220
220
  ```
221
221
 
222
- ## Release Note V 0.0.89
222
+ ## Release Note V 1.0.1
223
223
 
224
- - Adicionou o callback onChangeDevices
225
- - Adicionou a integração com a extensão do chrome
226
- - Adicionou o modal de checkDevices
227
- - Comentou o script do EBML
224
+ - Retirada de requisição da hora no finish
228
225
 
229
226
 
230
227
  ## License
package/esm/index.js CHANGED
@@ -18,13 +18,6 @@ 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
-
28
21
  // src/plugins/mp3.js
29
22
  var require_mp3 = __commonJS({
30
23
  "src/plugins/mp3.js"(exports, module) {
@@ -14308,6 +14301,13 @@ var require_mp3 = __commonJS({
14308
14301
  }
14309
14302
  });
14310
14303
 
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,6 +14356,12 @@ 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
+
14359
14365
  // src/new-flow/proctoring/ProctoringSession.ts
14360
14366
  var ProctoringSession = class {
14361
14367
  constructor(id) {
@@ -14378,6 +14384,12 @@ var ProctoringSession = class {
14378
14384
  this.state = "Recording" /* Recording */;
14379
14385
  this.startedAt = new Date(Date.now());
14380
14386
  }
14387
+ pause() {
14388
+ this.state = "Paused" /* Paused */;
14389
+ }
14390
+ resume() {
14391
+ this.state = "Recording" /* Recording */;
14392
+ }
14381
14393
  stop() {
14382
14394
  this.state = "Ended" /* Ended */;
14383
14395
  this.sessionDuration = Date.now() - this.startedAt.getTime();
@@ -14399,22 +14411,78 @@ var ProctoringSession = class {
14399
14411
  }
14400
14412
  };
14401
14413
 
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
+
14402
14455
  // src/plugins/recorder.ts
14403
- function recorder(stream, buffer) {
14456
+ function recorder(stream, buffer, audio = false) {
14404
14457
  let resolvePromise;
14405
- const options = {
14458
+ let options = {
14406
14459
  mimeType: "video/webm;codecs=vp9",
14407
14460
  videoBitsPerSecond: 128e3,
14408
14461
  audioBitsPerSecond: 64 * 1e3
14409
14462
  };
14463
+ if (audio) {
14464
+ options = {
14465
+ mimeType: "audio/webm",
14466
+ audioBitsPerSecond: 64 * 1e3
14467
+ };
14468
+ }
14410
14469
  const mediaRecorder = new MediaRecorder(stream, options);
14411
14470
  mediaRecorder.ondataavailable = (e) => {
14412
14471
  if (e.data.size > 0) {
14413
14472
  buffer.push(e.data);
14414
14473
  }
14474
+ if (audio && mediaRecorder.state == "inactive") {
14475
+ const blob = new Blob(buffer, { type: "audio/mpeg-3" });
14476
+ buffer = [blob];
14477
+ }
14415
14478
  resolvePromise && resolvePromise();
14416
14479
  };
14417
- mediaRecorder.start();
14480
+ function startRecording() {
14481
+ return new Promise((resolve) => {
14482
+ resolvePromise = resolve;
14483
+ mediaRecorder.start();
14484
+ });
14485
+ }
14418
14486
  function stopRecording() {
14419
14487
  return new Promise((resolve) => {
14420
14488
  if (mediaRecorder.state == "recording") {
@@ -14428,7 +14496,28 @@ function recorder(stream, buffer) {
14428
14496
  }
14429
14497
  });
14430
14498
  }
14431
- return stopRecording;
14499
+ function pauseRecording() {
14500
+ return new Promise((resolve) => {
14501
+ if (mediaRecorder.state == "recording") {
14502
+ mediaRecorder.pause();
14503
+ resolve();
14504
+ } else {
14505
+ resolve();
14506
+ }
14507
+ });
14508
+ }
14509
+ function resumeRecording() {
14510
+ return new Promise((resolve) => {
14511
+ console.log("Resumindo...");
14512
+ if (mediaRecorder.state == "paused") {
14513
+ mediaRecorder.resume();
14514
+ resolve();
14515
+ } else {
14516
+ resolve();
14517
+ }
14518
+ });
14519
+ }
14520
+ return { startRecording, stopRecording, pauseRecording, resumeRecording };
14432
14521
  }
14433
14522
 
14434
14523
  // src/new-flow/recorders/CameraRecorder.ts
@@ -14458,15 +14547,33 @@ var CameraRecorder = class {
14458
14547
  }
14459
14548
  };
14460
14549
  this.cameraStream = await navigator.mediaDevices.getUserMedia(constraints);
14461
- const stopRecording = recorder(this.cameraStream, this.blobs);
14550
+ const { startRecording, stopRecording, pauseRecording, resumeRecording } = recorder(this.cameraStream, this.blobs);
14551
+ this.recordingStart = startRecording;
14462
14552
  this.recordingStop = stopRecording;
14553
+ this.recordingPause = pauseRecording;
14554
+ this.recordingResume = resumeRecording;
14555
+ this.recordingStart();
14463
14556
  }
14464
14557
  async stopRecording() {
14465
14558
  await this.recordingStop();
14466
14559
  }
14560
+ async pauseRecording() {
14561
+ console.log("Pausing...");
14562
+ await this.recordingPause();
14563
+ console.log("Paused");
14564
+ }
14565
+ async resumeRecording() {
14566
+ console.log("Resuming...");
14567
+ await this.recordingResume();
14568
+ console.log("Resumed");
14569
+ }
14467
14570
  async saveOnSession(session) {
14571
+ const settings = this.cameraStream.getVideoTracks()[0].getSettings();
14572
+ const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
14468
14573
  session.addRecording({
14469
- device: "",
14574
+ device: `Audio
14575
+ Sample Rate: ${settingsAudio.sampleRate}
14576
+ Sample Size: ${settingsAudio.sampleSize}`,
14470
14577
  file: new File(this.blobs, `EP_${session.id}_camera_0.webm`, {
14471
14578
  type: "video/webm"
14472
14579
  }),
@@ -14485,6 +14592,7 @@ var PROCTORING_NOT_STARTED = "proctoring_not_started";
14485
14592
  var ScreenRecorder = class {
14486
14593
  constructor(options) {
14487
14594
  this.blobs = [];
14595
+ this.blobsFinal = [];
14488
14596
  this.options = options;
14489
14597
  }
14490
14598
  async startRecording() {
@@ -14515,8 +14623,14 @@ var ScreenRecorder = class {
14515
14623
  });
14516
14624
  throw NOT_SHARED_FIRST_SCREEN;
14517
14625
  }
14518
- const stopRecording = recorder(this.screenStream, this.blobs);
14626
+ const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs);
14627
+ this.recordingStart = startRecording;
14519
14628
  this.recordingStop = stopRecording;
14629
+ this.recordingStart();
14630
+ }
14631
+ async pauseRecording() {
14632
+ }
14633
+ async resumeRecording() {
14520
14634
  }
14521
14635
  async stopRecording() {
14522
14636
  await this.recordingStop();
@@ -14660,12 +14774,14 @@ var DeviceChecker = class {
14660
14774
  width: this.videoOptions.width,
14661
14775
  height: this.videoOptions.height
14662
14776
  });
14777
+ this.audioRecorder = new AudioRecorder();
14663
14778
  this.screenRecorder = options.captureScreen ? new ScreenRecorder({
14664
14779
  allowOnlyFirstMonitor: options.allowOnlyFirstMonitor || options.allowOnlyFirstMonitor == void 0 ? true : false,
14665
14780
  onStopSharingScreenCallback: () => {
14666
14781
  }
14667
14782
  }) : void 0;
14668
14783
  await this.cameraRecorder.startRecording();
14784
+ await this.audioRecorder.startRecording();
14669
14785
  if (this.screenRecorder) {
14670
14786
  await this.screenRecorder.startRecording();
14671
14787
  }
@@ -14678,6 +14794,7 @@ var DeviceChecker = class {
14678
14794
  const checkDevices = document.querySelector("#checkDevices");
14679
14795
  checkDevices == null ? void 0 : checkDevices.remove();
14680
14796
  await this.cameraRecorder.stopRecording();
14797
+ await this.audioRecorder.stopRecording();
14681
14798
  if (this.screenRecorder) {
14682
14799
  await this.screenRecorder.stopRecording();
14683
14800
  }
@@ -14708,8 +14825,8 @@ var Extension = class {
14708
14825
  }, 1e3);
14709
14826
  });
14710
14827
  }
14711
- sendVerifyMsg() {
14712
- window.postMessage({ type: "easyproctor", func: "verifyExtensionEasyproctor" }, "*");
14828
+ sendVerifyMsg(link, token) {
14829
+ window.postMessage({ type: "easyproctor", func: "verifyExtensionEasyproctor", url: link, token }, "*");
14713
14830
  }
14714
14831
  verify(event) {
14715
14832
  if (event.source == window && event.data.sender && event.data.sender === "easyproctor-extension" && event.data.message_name && event.data.message_name === "progress") {
@@ -14727,7 +14844,6 @@ var Extension = class {
14727
14844
  }
14728
14845
  addEventListener() {
14729
14846
  window.addEventListener("message", (event) => this.verify(event));
14730
- setTimeout(() => this.sendVerifyMsg(), 5e3);
14731
14847
  }
14732
14848
  };
14733
14849
 
@@ -22772,8 +22888,10 @@ var trackers = {
22772
22888
  registerStart: (proctoringId, success, description) => registerCustomEvent(eventNames.START, { proctoringId, success, description }),
22773
22889
  registerFinish: (proctoringId, success, description) => registerCustomEvent(eventNames.FINISH, { proctoringId, success, description }),
22774
22890
  registerError: (proctoringId, description) => registerCustomEvent(eventNames.ERROR, { proctoringId, description }),
22775
- registerUploadVideo: (proctoringId, success, description, serviceType, uploadTime) => registerCustomEvent(eventNames.UPLOAD_VIDEO, { proctoringId, success, description, serviceType, uploadTime }),
22776
- registerChangeDevice: (proctoringId, inOrOut, devicesChanged) => registerCustomEvent(eventNames.UPLOAD_VIDEO, { proctoringId, inOrOut, devicesChanged })
22891
+ registerUpload: (proctoringId, success, description, serviceType, uploadTime) => registerCustomEvent(eventNames.UPLOAD_VIDEO, { proctoringId, success, description, serviceType, uploadTime }),
22892
+ registerUploadFile: (proctoringId, description, fileType) => registerCustomEvent(eventNames.UPLOAD_VIDEO, { proctoringId, description, fileType }),
22893
+ registerChangeDevice: (proctoringId, inOrOut, devicesChanged) => registerCustomEvent(eventNames.UPLOAD_VIDEO, { proctoringId, inOrOut, devicesChanged }),
22894
+ registerStopSharingScreen: (proctoringId, description) => registerCustomEvent(eventNames.UPLOAD_VIDEO, { proctoringId, description })
22777
22895
  };
22778
22896
 
22779
22897
  // src/modules/onChangeDevices.ts
@@ -24607,10 +24725,12 @@ var BackendService = class {
24607
24725
  this.baseUrl = this.selectBaseUrl(options.type);
24608
24726
  }
24609
24727
  selectBaseUrl(type) {
24610
- if (type === "dev") {
24728
+ if (type === "dev" /* dev */) {
24611
24729
  return DEV_BASE_URL;
24612
- } else if (type === "homol") {
24730
+ } else if (type === "homol" /* homol */) {
24613
24731
  return HOMOL_BASE_URL;
24732
+ } else if (type === "prod" /* prod */) {
24733
+ return PROD_BASE_URL;
24614
24734
  } else {
24615
24735
  return PROD_BASE_URL;
24616
24736
  }
@@ -24631,6 +24751,8 @@ var BackendService = class {
24631
24751
  path: `/AzureKey/getInsights`,
24632
24752
  method: "GET",
24633
24753
  jwt: proctoringOptions.token
24754
+ }).catch((error) => {
24755
+ throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
24634
24756
  });
24635
24757
  return insights2.data;
24636
24758
  }
@@ -24681,8 +24803,7 @@ var BackendService = class {
24681
24803
  }
24682
24804
  async finishAndSendUrls(proctoringOptions, proctoringSession) {
24683
24805
  var _a2, _b, _c;
24684
- const serverHour = await this.getServerHour(proctoringOptions.token).catch(() => void 0);
24685
- const serverTime = serverHour ? new Date(serverHour).toISOString() : new Date().toISOString();
24806
+ const serverTime = new Date().toISOString();
24686
24807
  const videoCameraUpload = (_a2 = proctoringSession.recordings.find((e) => e.origin === "Camera" /* Camera */)) == null ? void 0 : _a2.upload;
24687
24808
  const audioCameraUpload = (_b = proctoringSession.recordings.find((e) => e.origin === "Mic" /* Mic */)) == null ? void 0 : _b.upload;
24688
24809
  const videoScreenUpload = (_c = proctoringSession.recordings.find((e) => e.origin === "Screen" /* Screen */)) == null ? void 0 : _c.upload;
@@ -24806,6 +24927,16 @@ var ProctoringRecorder = class {
24806
24927
  const startPromises = this.recorders.map((rec) => rec.startRecording());
24807
24928
  await Promise.all(startPromises);
24808
24929
  }
24930
+ async pauseAll() {
24931
+ this.session.pause();
24932
+ const pausePromises = this.recorders.map((rec) => rec.pauseRecording());
24933
+ await Promise.all(pausePromises);
24934
+ }
24935
+ async resumeAll() {
24936
+ this.session.resume();
24937
+ const resumePromises = this.recorders.map((rec) => rec.resumeRecording());
24938
+ await Promise.all(resumePromises);
24939
+ }
24809
24940
  async stopAll() {
24810
24941
  const stopPromises = this.recorders.map((rec) => rec.stopRecording());
24811
24942
  await Promise.all(stopPromises);
@@ -24821,8 +24952,9 @@ var ProctoringRecorder = class {
24821
24952
 
24822
24953
  // src/new-flow/proctoring/ProctoringUploader.ts
24823
24954
  var ProctoringUploader = class {
24824
- constructor(session, uploadServices) {
24955
+ constructor(session, proctoringId, uploadServices) {
24825
24956
  this.session = session;
24957
+ this.proctoringId = proctoringId;
24826
24958
  this.uploadServices = uploadServices;
24827
24959
  }
24828
24960
  async upload(token, progress) {
@@ -24879,6 +25011,18 @@ var ProctoringUploader = class {
24879
25011
  }
24880
25012
  }, token);
24881
25013
  if (result) {
25014
+ let fileType = "";
25015
+ if (rec.file.name.search("camera") !== -1) {
25016
+ fileType = "Camera";
25017
+ } else if (rec.file.name.search("screen") !== -1) {
25018
+ fileType = "Screen";
25019
+ } else if (rec.file.name.search("audio") !== -1) {
25020
+ fileType = "Audio";
25021
+ }
25022
+ trackers.registerUploadFile(this.proctoringId, `Upload File
25023
+ Name: ${rec.file.name}
25024
+ Type: ${rec.file.type}
25025
+ Size: ${rec.file.size}`, fileType);
24882
25026
  return result;
24883
25027
  }
24884
25028
  }
@@ -24901,6 +25045,16 @@ var AlertRecorder = class {
24901
25045
  window.addEventListener("focus", () => this.onReturnFocus());
24902
25046
  }
24903
25047
  }
25048
+ async pauseRecording() {
25049
+ window.removeEventListener("blur", () => this.onLostFocus());
25050
+ window.removeEventListener("focus", () => this.onReturnFocus());
25051
+ }
25052
+ async resumeRecording() {
25053
+ if (this.optionsProctoring.captureScreen) {
25054
+ window.addEventListener("blur", () => this.onLostFocus());
25055
+ window.addEventListener("focus", () => this.onReturnFocus());
25056
+ }
25057
+ }
24904
25058
  async stopRecording() {
24905
25059
  window.removeEventListener("blur", () => this.onLostFocus());
24906
25060
  window.removeEventListener("focus", () => this.onReturnFocus());
@@ -24930,49 +25084,6 @@ var AlertRecorder = class {
24930
25084
  }
24931
25085
  };
24932
25086
 
24933
- // src/plugins/MicRecorder2.ts
24934
- var MicRecorder = require_mp3();
24935
- function createMicRecorder(config) {
24936
- return new MicRecorder(config);
24937
- }
24938
-
24939
- // src/new-flow/recorders/AudioRecorder.ts
24940
- var AudioRecorder = class {
24941
- constructor() {
24942
- this.blobs = [];
24943
- }
24944
- async startRecording() {
24945
- this.recorder = createMicRecorder({
24946
- bitRate: 128
24947
- });
24948
- this.recorder.start().catch((e) => {
24949
- throw new Error("Error on Audio to Start Recording");
24950
- });
24951
- }
24952
- async stopRecording() {
24953
- if (!this.recorder)
24954
- return;
24955
- const response = await this.recorder.stop().getMp3().then(async ([buffer, blob]) => {
24956
- return { buffer, blob };
24957
- }).catch((e) => {
24958
- alert("We could not retrieve your message");
24959
- return void 0;
24960
- });
24961
- if (response) {
24962
- this.blobs.push(response.blob);
24963
- }
24964
- }
24965
- async saveOnSession(session) {
24966
- session.addRecording({
24967
- device: "",
24968
- file: new File(this.blobs, `EP_${session.id}_audio_0.mp3`, {
24969
- type: "audio/mp3"
24970
- }),
24971
- origin: "Mic" /* Mic */
24972
- });
24973
- }
24974
- };
24975
-
24976
25087
  // src/new-flow/repository/IndexDbSessionRepository.ts
24977
25088
  var IndexDbSessionRepository = class {
24978
25089
  constructor(dbName, storeName) {
@@ -25059,8 +25170,8 @@ var AwsUploadService = class {
25059
25170
  this.proctoringId = proctoringId;
25060
25171
  }
25061
25172
  async upload(data, token) {
25173
+ const { file, onProgress } = data;
25062
25174
  try {
25063
- const { file, onProgress } = data;
25064
25175
  const progressCallback = (e) => {
25065
25176
  const progress = e.loadedBytes / file.size * 100;
25066
25177
  onProgress && onProgress(Math.round(progress));
@@ -25084,8 +25195,11 @@ var AwsUploadService = class {
25084
25195
  uploaded
25085
25196
  };
25086
25197
  } catch (err) {
25087
- trackers.registerError(this.proctoringId, "Failed to upload to azure");
25088
- throw new Error("Failed to upload to azure");
25198
+ trackers.registerError(this.proctoringId, `Failed to upload to AWS
25199
+ File name: ${file.name}
25200
+ File type: ${file.type}
25201
+ File size: ${file.size}`);
25202
+ throw new Error("Failed to upload to AWS");
25089
25203
  }
25090
25204
  }
25091
25205
  };
@@ -25097,8 +25211,8 @@ var AzureUploadService = class {
25097
25211
  this.proctoringId = proctoringId;
25098
25212
  }
25099
25213
  async upload(data, token) {
25214
+ const { file, onProgress } = data;
25100
25215
  try {
25101
- const { file, onProgress } = data;
25102
25216
  const progressCallback = (e) => {
25103
25217
  const progress = e.loadedBytes / file.size * 100;
25104
25218
  onProgress && onProgress(Math.round(progress));
@@ -25121,7 +25235,10 @@ var AzureUploadService = class {
25121
25235
  uploaded
25122
25236
  };
25123
25237
  } catch (err) {
25124
- trackers.registerError(this.proctoringId, "Failed to upload to azure");
25238
+ trackers.registerError(this.proctoringId, `Failed to upload to Azure
25239
+ File name: ${file.name}
25240
+ File type: ${file.type}
25241
+ File size: ${file.size}`);
25125
25242
  throw new Error("Failed to upload to azure");
25126
25243
  }
25127
25244
  }
@@ -25145,6 +25262,8 @@ var Proctoring = class {
25145
25262
  this.state = "Stop" /* Stop */;
25146
25263
  this.serviceType = "Upload" /* Upload */;
25147
25264
  this.onStopSharingScreenCallback = () => {
25265
+ console.log("Stop sharing screen");
25266
+ trackers.registerStopSharingScreen(this.proctoringId, "Stop sharing screen");
25148
25267
  };
25149
25268
  this.onLostFocusCallback = () => {
25150
25269
  };
@@ -25200,6 +25319,8 @@ var Proctoring = class {
25200
25319
  async start(options = getDefaultProctoringOptions(), _videoOptions = {}) {
25201
25320
  this.extension = new Extension();
25202
25321
  this.extension.addEventListener();
25322
+ const baseURL = this.backend.selectBaseUrl(this.context.type);
25323
+ setTimeout(() => this.extension.sendVerifyMsg(baseURL, this.context.token), 5e3);
25203
25324
  const devices = await enumarateDevices();
25204
25325
  await this.repositoryDevices.save({ ...devices, id: "devices" });
25205
25326
  this.sessionOptions = options;
@@ -25221,19 +25342,20 @@ var Proctoring = class {
25221
25342
  }, this.sessionOptions.proctoringType);
25222
25343
  this.proctoringId = startResponse.id;
25223
25344
  this.proctoringSession = new ProctoringSession(this.proctoringId);
25224
- const allRecorders = this.createRecorders(options);
25345
+ this.allRecorders = this.createRecorders(options);
25225
25346
  await this.recorder.startAll();
25226
25347
  await this.repository.save(this.proctoringSession);
25227
25348
  trackers.registerStart(this.proctoringId, true, "");
25228
- startResponse.cameraStream = allRecorders.cameraRecorder.cameraStream;
25229
- if (allRecorders.screenRecorder) {
25230
- startResponse.screenStream = allRecorders.screenRecorder.screenStream;
25349
+ startResponse.cameraStream = this.allRecorders.cameraRecorder.cameraStream;
25350
+ if (this.allRecorders.screenRecorder) {
25351
+ startResponse.screenStream = this.allRecorders.screenRecorder.screenStream;
25231
25352
  }
25232
25353
  this.state = "Recording" /* Recording */;
25233
25354
  return startResponse;
25234
25355
  } catch (error) {
25235
25356
  await this.cancel();
25236
- trackers.registerStart(this.proctoringId, false, "" + error);
25357
+ trackers.registerStart(this.proctoringId, false, `Token: ${this.context.token}
25358
+ Error: ` + error);
25237
25359
  this.state = "Stop" /* Stop */;
25238
25360
  throw error;
25239
25361
  }
@@ -25255,13 +25377,13 @@ var Proctoring = class {
25255
25377
  let uploader;
25256
25378
  let uploaderServices;
25257
25379
  if (versionVerify() !== "1.0.0.0") {
25258
- uploader = new ProctoringUploader(this.proctoringSession, [
25380
+ uploader = new ProctoringUploader(this.proctoringSession, this.proctoringId, [
25259
25381
  new DownloadService(this.proctoringId)
25260
25382
  ]);
25261
25383
  uploaderServices = "Download";
25262
25384
  this.serviceType = "Download" /* Download */;
25263
25385
  } else {
25264
- uploader = new ProctoringUploader(this.proctoringSession, [
25386
+ uploader = new ProctoringUploader(this.proctoringSession, this.proctoringId, [
25265
25387
  new AzureUploadService(this.proctoringId, this.backend),
25266
25388
  new AwsUploadService(this.proctoringId, this.backend),
25267
25389
  new DownloadService(this.proctoringId)
@@ -25279,11 +25401,11 @@ var Proctoring = class {
25279
25401
  }
25280
25402
  if (!extensionSuccess || !this.extension.hasExtension) {
25281
25403
  await uploader.upload(this.context.token, options.onProgress).catch(async (error) => {
25282
- trackers.registerUploadVideo(this.proctoringSession.id, false, `upload error: ${error}
25404
+ trackers.registerUpload(this.proctoringSession.id, false, `upload error: ${error}
25283
25405
 
25284
25406
  Upload Services: ${uploaderServices}`, this.serviceType);
25285
25407
  if (versionVerify() !== "1.0.0.0") {
25286
- uploader = new ProctoringUploader(this.proctoringSession, [
25408
+ uploader = new ProctoringUploader(this.proctoringSession, this.proctoringId, [
25287
25409
  new AzureUploadService(this.proctoringId, this.backend),
25288
25410
  new AwsUploadService(this.proctoringId, this.backend),
25289
25411
  new DownloadService(this.proctoringId)
@@ -25291,14 +25413,14 @@ Upload Services: ${uploaderServices}`, this.serviceType);
25291
25413
  uploaderServices = "Azure, AWS, Download";
25292
25414
  this.serviceType = "Upload" /* Upload */;
25293
25415
  await uploader.upload(this.context.token, options.onProgress).catch((error2) => {
25294
- trackers.registerUploadVideo(this.proctoringSession.id, false, `upload backup error: ${error2}
25416
+ trackers.registerUpload(this.proctoringSession.id, false, `upload backup error: ${error2}
25295
25417
 
25296
25418
  Upload Services: ${uploaderServices}
25297
25419
  Upload backup for Safe Browser`, this.serviceType);
25298
25420
  });
25299
25421
  }
25300
25422
  });
25301
- trackers.registerUploadVideo(this.proctoringSession.id, true, `upload success
25423
+ trackers.registerUpload(this.proctoringSession.id, true, `upload success
25302
25424
 
25303
25425
  Upload Services: ${uploaderServices}`, this.serviceType);
25304
25426
  }
@@ -25351,31 +25473,28 @@ Upload Services: ${uploaderServices}`, this.serviceType);
25351
25473
  await this.repository.save(this.proctoringSession);
25352
25474
  this.state = "Paused" /* Paused */;
25353
25475
  }
25354
- async resume(options = getDefaultProctoringOptions(), examId, _videoOptions = {
25355
- width: 640,
25356
- height: 480
25357
- }) {
25476
+ async resume() {
25358
25477
  var _a2;
25359
25478
  if (this.state != "Paused" /* Paused */) {
25360
25479
  throw PROCTORING_NOT_STARTED;
25361
25480
  }
25362
25481
  await this.verifyMultipleMonitors(this.sessionOptions);
25363
- const allRecorders = this.createRecorders(options);
25482
+ const allRecorders = this.createRecorders(this.sessionOptions);
25364
25483
  await this.recorder.startAll();
25365
25484
  this.proctoringSession.recordings = [];
25366
25485
  await this.repository.save(this.proctoringSession);
25367
25486
  this.state = "Recording" /* Recording */;
25368
25487
  return {
25369
- cameraStream: allRecorders.cameraRecorder.cameraStream,
25370
- _screenStream: (_a2 = allRecorders.screenRecorder) == null ? void 0 : _a2.screenStream
25488
+ cameraStream: this.allRecorders.cameraRecorder.cameraStream,
25489
+ _screenStream: (_a2 = this.allRecorders.screenRecorder) == null ? void 0 : _a2.screenStream
25371
25490
  };
25372
25491
  }
25373
25492
  };
25374
25493
 
25375
25494
  // src/proctoring/useProctoring.ts
25376
- function useProctoring(proctoringOptions, homolConfig = "prod") {
25495
+ function useProctoring(proctoringOptions, enviromentConfig = "prod" /* prod */) {
25377
25496
  const proctoring = new Proctoring({
25378
- type: homolConfig,
25497
+ type: enviromentConfig,
25379
25498
  clientId: proctoringOptions.clientId,
25380
25499
  examId: proctoringOptions.examId,
25381
25500
  token: proctoringOptions.token
@@ -5,7 +5,7 @@ export declare class Extension {
5
5
  responseStart: boolean;
6
6
  onProgress: ProgressCallback;
7
7
  start(): Promise<boolean>;
8
- sendVerifyMsg(): void;
8
+ sendVerifyMsg(link: string, token: string): void;
9
9
  private verify;
10
10
  addEventListener(): void;
11
11
  }