easyproctor-hml 0.0.1 → 0.0.2

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.
Files changed (41) hide show
  1. package/dtos/AlertDTO.js +2 -0
  2. package/dtos/ProctoringConfigDto.js +2 -0
  3. package/dtos/SaveScreenDTO.js +2 -0
  4. package/dtos/SessionDTO.js +2 -0
  5. package/dtos/StartProctoringResponse.js +2 -0
  6. package/dtos/UploadDataDTO.js +2 -0
  7. package/errors/errors.js +13 -0
  8. package/esm/index.js +47 -73
  9. package/index.js +34 -67
  10. package/interfaces/Devices.js +2 -0
  11. package/modules/checkPermissions.js +43 -0
  12. package/modules/enumarateDevices.js +20 -0
  13. package/new-flow/backend/BackendService.js +171 -0
  14. package/new-flow/download/IDownloadService.js +2 -0
  15. package/new-flow/download/downloadService.js +31 -0
  16. package/new-flow/proctoring/ProctoringRecorder.js +28 -0
  17. package/new-flow/proctoring/ProctoringSession.js +74 -0
  18. package/new-flow/proctoring/ProctoringUploader.js +80 -0
  19. package/new-flow/recorders/AlertRecorder.js +50 -0
  20. package/new-flow/recorders/AudioRecorder.js +49 -0
  21. package/new-flow/recorders/CameraRecorder.js +57 -0
  22. package/new-flow/recorders/IRecorder.js +6 -0
  23. package/new-flow/recorders/ScreenRecorder.js +64 -0
  24. package/new-flow/repository/ISessionRepository.js +2 -0
  25. package/new-flow/repository/IndexDbSessionRepository.js +75 -0
  26. package/new-flow/upload/AwsUploadService.js +50 -0
  27. package/new-flow/upload/AzureUploadService.js +49 -0
  28. package/new-flow/upload/IUploadService.js +2 -0
  29. package/new-flow/upload/uploadCalback.js +2 -0
  30. package/package.json +1 -1
  31. package/plugins/MicRecorder2.js +8 -0
  32. package/plugins/insights.js +33 -0
  33. package/plugins/recorder.js +34 -0
  34. package/proctoring/DeviceChecker.js +48 -0
  35. package/proctoring/options/ProctoringOptions.js +15 -0
  36. package/proctoring/options/ProctoringVideoOptions.js +15 -0
  37. package/proctoring/proctoring.js +256 -0
  38. package/proctoring/useProctoring.js +41 -0
  39. package/unpkg/easyproctor.min.js +12 -12
  40. package/utils/time.js +27 -0
  41. package/utils/verifyVersion.js +11 -0
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PERMISSIONS_NOT_GRANTED = exports.NO_VIDEOS_RECORDED = exports.PROCTORING_RUNNING = exports.PROCTORING_NOT_STARTED = exports.PROCTORING_ALREADY_STARTED = exports.MULTIPLE_MONITORS_DETECTED = exports.NOT_SHARED_FIRST_SCREEN = exports.REQUIRED_FIELD_NOT_PROVIDED = exports.INCOMPATIBLE_NAVIGATOR = exports.SCRIPT_NOT_CALLED_INSIDE_BODY = void 0;
4
+ exports.SCRIPT_NOT_CALLED_INSIDE_BODY = "script_not_called_inside_body";
5
+ exports.INCOMPATIBLE_NAVIGATOR = "incompatible_navigator";
6
+ exports.REQUIRED_FIELD_NOT_PROVIDED = "required_field_not_provided";
7
+ exports.NOT_SHARED_FIRST_SCREEN = 'not_shared_first_screen';
8
+ exports.MULTIPLE_MONITORS_DETECTED = "multiple_monitors_detected";
9
+ exports.PROCTORING_ALREADY_STARTED = "proctoring_already_started";
10
+ exports.PROCTORING_NOT_STARTED = "proctoring_not_started";
11
+ exports.PROCTORING_RUNNING = "proctoring_running";
12
+ exports.NO_VIDEOS_RECORDED = "no_videos_recorded";
13
+ exports.PERMISSIONS_NOT_GRANTED = "permissions_not_granted";
package/esm/index.js CHANGED
@@ -14361,12 +14361,14 @@ async function enumarateDevices() {
14361
14361
 
14362
14362
  // src/new-flow/proctoring/ProctoringSession.ts
14363
14363
  var ProctoringSession = class {
14364
- id;
14365
- state;
14366
- startedAt;
14367
- sessionDuration = 0;
14368
- alerts;
14369
- recordings;
14364
+ constructor(id) {
14365
+ this.sessionDuration = 0;
14366
+ this.id = id;
14367
+ this.state = "Created" /* Created */;
14368
+ this.startedAt = new Date();
14369
+ this.alerts = [];
14370
+ this.recordings = [];
14371
+ }
14370
14372
  get hasSomethingToUpload() {
14371
14373
  for (const rec of this.recordings) {
14372
14374
  if (!rec.upload) {
@@ -14375,13 +14377,6 @@ var ProctoringSession = class {
14375
14377
  }
14376
14378
  return false;
14377
14379
  }
14378
- constructor(id) {
14379
- this.id = id;
14380
- this.state = "Created" /* Created */;
14381
- this.startedAt = new Date();
14382
- this.alerts = [];
14383
- this.recordings = [];
14384
- }
14385
14380
  start() {
14386
14381
  this.state = "Recording" /* Recording */;
14387
14382
  this.startedAt = new Date(Date.now());
@@ -14441,23 +14436,19 @@ function recorder(stream, buffer) {
14441
14436
 
14442
14437
  // src/new-flow/recorders/CameraRecorder.ts
14443
14438
  var CameraRecorder = class {
14444
- blobs = [];
14445
- options = {
14446
- cameraId: void 0,
14447
- microphoneId: void 0
14448
- };
14449
- videoOptions = {
14450
- width: 640,
14451
- height: 480
14452
- };
14453
- recorder;
14454
- cameraStream;
14455
14439
  constructor(options, videoOptions) {
14440
+ this.blobs = [];
14441
+ this.options = {
14442
+ cameraId: void 0,
14443
+ microphoneId: void 0
14444
+ };
14445
+ this.videoOptions = {
14446
+ width: 640,
14447
+ height: 480
14448
+ };
14456
14449
  this.options = options;
14457
14450
  this.videoOptions = videoOptions;
14458
14451
  }
14459
- file;
14460
- recordingStop;
14461
14452
  async startRecording() {
14462
14453
  console.log("Starting...");
14463
14454
  const { cameraId, microphoneId } = this.options;
@@ -14499,16 +14490,10 @@ var PROCTORING_NOT_STARTED = "proctoring_not_started";
14499
14490
 
14500
14491
  // src/new-flow/recorders/ScreenRecorder.ts
14501
14492
  var ScreenRecorder = class {
14502
- blobs = [];
14503
- options;
14504
- recorder;
14505
- screenStream;
14506
- startTime;
14507
14493
  constructor(options) {
14494
+ this.blobs = [];
14508
14495
  this.options = options;
14509
14496
  }
14510
- file;
14511
- recordingStop;
14512
14497
  async startRecording() {
14513
14498
  this.startTime = new Date(Date.now());
14514
14499
  const { allowOnlyFirstMonitor, onStopSharingScreenCallback } = this.options;
@@ -14582,9 +14567,6 @@ function validatePartialVideoOptions(options) {
14582
14567
 
14583
14568
  // src/proctoring/DeviceChecker.ts
14584
14569
  var DeviceChecker = class {
14585
- videoOptions;
14586
- cameraRecorder;
14587
- screenRecorder;
14588
14570
  constructor() {
14589
14571
  }
14590
14572
  async checkDevices(options = getDefaultProctoringOptions(), _videoOptions) {
@@ -16409,7 +16391,6 @@ var BackendService = class {
16409
16391
  this.options = options;
16410
16392
  this.baseUrl = this.options.homol ? HOMOL_BASE_URL : PROD_BASE_URL;
16411
16393
  }
16412
- baseUrl;
16413
16394
  async confirmStart(proctoringOptions, proctoringType) {
16414
16395
  return await this.makeRequest({
16415
16396
  path: `/proctoring/start/${proctoringOptions.examId}`,
@@ -16566,12 +16547,10 @@ var BackendService = class {
16566
16547
 
16567
16548
  // src/new-flow/download/downloadService.ts
16568
16549
  var DownloadService = class {
16569
- proctoringId;
16570
16550
  constructor(proctoringId) {
16551
+ this.loadingBoolean = true;
16571
16552
  this.proctoringId = proctoringId;
16572
16553
  }
16573
- loadingBoolean = true;
16574
- loadingInterval;
16575
16554
  async upload(data, token) {
16576
16555
  try {
16577
16556
  const { file, onProgress } = data;
@@ -16690,12 +16669,8 @@ var ProctoringUploader = class {
16690
16669
 
16691
16670
  // src/new-flow/recorders/AlertRecorder.ts
16692
16671
  var AlertRecorder = class {
16693
- alerts = [];
16694
- startTime;
16695
- onLostFocusCallback;
16696
- onFocusCallback;
16697
- optionsProctoring;
16698
16672
  constructor(options, optionsProctoring) {
16673
+ this.alerts = [];
16699
16674
  this.onLostFocusCallback = options.onLostFocusCallback;
16700
16675
  this.onFocusCallback = options.onFocusCallback;
16701
16676
  this.optionsProctoring = optionsProctoring;
@@ -16743,12 +16718,9 @@ function createMicRecorder(config) {
16743
16718
 
16744
16719
  // src/new-flow/recorders/AudioRecorder.ts
16745
16720
  var AudioRecorder = class {
16746
- blobs = [];
16747
- recorder;
16748
- cameraStream;
16749
16721
  constructor() {
16722
+ this.blobs = [];
16750
16723
  }
16751
- file;
16752
16724
  async startRecording() {
16753
16725
  this.recorder = createMicRecorder({
16754
16726
  bitRate: 128
@@ -16785,9 +16757,11 @@ var AudioRecorder = class {
16785
16757
 
16786
16758
  // src/new-flow/repository/IndexDbSessionRepository.ts
16787
16759
  var IndexDbSessionRepository = class {
16788
- dbName = "EasyProctorDb";
16789
- dbVersion = 1;
16790
- storeName = "exams2";
16760
+ constructor() {
16761
+ this.dbName = "EasyProctorDb";
16762
+ this.dbVersion = 1;
16763
+ this.storeName = "exams2";
16764
+ }
16791
16765
  async save(data) {
16792
16766
  const { transaction, store } = await this.connectToStore("readwrite");
16793
16767
  return this.processRequest(store.put(data), transaction).then(() => {
@@ -16824,7 +16798,6 @@ var IndexDbSessionRepository = class {
16824
16798
  const list = await this.list();
16825
16799
  return list.length > 0;
16826
16800
  }
16827
- connection;
16828
16801
  async connectToStore(mode) {
16829
16802
  const connection = await this.connect();
16830
16803
  const db = connection.result;
@@ -24907,7 +24880,6 @@ var AwsUploadService = class {
24907
24880
  this.backend = backend;
24908
24881
  this.proctoringId = proctoringId;
24909
24882
  }
24910
- proctoringId;
24911
24883
  async upload(data, token) {
24912
24884
  try {
24913
24885
  const { file, onProgress } = data;
@@ -24946,7 +24918,6 @@ var AzureUploadService = class {
24946
24918
  this.backend = backend;
24947
24919
  this.proctoringId = proctoringId;
24948
24920
  }
24949
- proctoringId;
24950
24921
  async upload(data, token) {
24951
24922
  try {
24952
24923
  const { file, onProgress } = data;
@@ -24991,41 +24962,35 @@ function versionVerify() {
24991
24962
  var Proctoring = class {
24992
24963
  constructor(context) {
24993
24964
  this.context = context;
24965
+ this.proctoringId = "";
24966
+ this.config = void 0;
24967
+ this.state = "Stop" /* Stop */;
24968
+ this.onStopSharingScreenCallback = () => {
24969
+ };
24970
+ this.onLostFocusCallback = () => {
24971
+ };
24972
+ this.onFocusCallback = () => {
24973
+ };
24974
+ this.onProgress = (percentage) => {
24975
+ };
24994
24976
  console.log("new proctoring", context);
24995
24977
  this.backend = new BackendService({
24996
24978
  homol: context.homol
24997
24979
  });
24998
24980
  this.repository = new IndexDbSessionRepository();
24999
24981
  }
25000
- backend;
25001
- repository;
25002
- proctoringId = "";
25003
- config = void 0;
25004
- proctoringSession;
25005
- sessionOptions;
25006
- videoOptions;
25007
- state = "Stop" /* Stop */;
25008
- recorder;
25009
- onStopSharingScreenCallback = () => {
25010
- };
25011
24982
  setOnStopSharingScreenCallback(cb) {
25012
24983
  console.log("proctoring.setOnStopSharingScreenCallback");
25013
24984
  this.onStopSharingScreenCallback = () => cb();
25014
24985
  }
25015
- onLostFocusCallback = () => {
25016
- };
25017
24986
  setOnLostFocusCallback(cb) {
25018
24987
  console.log("proctoring.setOnLostFocusCallback");
25019
24988
  this.onLostFocusCallback = () => cb();
25020
24989
  }
25021
- onFocusCallback = () => {
25022
- };
25023
24990
  setOnFocusCallback(cb) {
25024
24991
  console.log("proctoring.setOnFocusCallback");
25025
24992
  this.onFocusCallback = () => cb();
25026
24993
  }
25027
- onProgress = (percentage) => {
25028
- };
25029
24994
  setOnProgress(cb) {
25030
24995
  console.log("proctoring.setOnProgress");
25031
24996
  this.onProgress = (percentage) => cb(percentage);
@@ -25124,7 +25089,16 @@ var Proctoring = class {
25124
25089
  new DownloadService(this.proctoringId)
25125
25090
  ]);
25126
25091
  }
25127
- await uploader.upload(this.onProgress, this.context.token);
25092
+ await uploader.upload(this.onProgress, this.context.token).catch(async (error) => {
25093
+ if (versionVerify() !== "1.0.0.0") {
25094
+ uploader = new ProctoringUploader(this.proctoringSession, [
25095
+ new AzureUploadService(this.proctoringId, this.backend),
25096
+ new AwsUploadService(this.proctoringId, this.backend),
25097
+ new DownloadService(this.proctoringId)
25098
+ ]);
25099
+ await uploader.upload(this.onProgress, this.context.token);
25100
+ }
25101
+ });
25128
25102
  await this.backend.saveScreenAlerts(this.context, this.proctoringSession).catch((err) => {
25129
25103
  trackers.registerFinish(this.proctoringSession.id, false, "save-screen error: " + err);
25130
25104
  });
package/index.js CHANGED
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
8
  var __commonJS = (cb, mod) => function __require() {
10
9
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
10
  };
@@ -23,10 +22,6 @@ var __copyProps = (to, from, except, desc) => {
23
22
  };
24
23
  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));
25
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
- var __publicField = (obj, key, value) => {
27
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
28
- return value;
29
- };
30
25
 
31
26
  // node_modules/delayed-stream/lib/delayed_stream.js
32
27
  var require_delayed_stream = __commonJS({
@@ -33308,12 +33303,7 @@ async function enumarateDevices() {
33308
33303
  // src/new-flow/proctoring/ProctoringSession.ts
33309
33304
  var ProctoringSession = class {
33310
33305
  constructor(id) {
33311
- __publicField(this, "id");
33312
- __publicField(this, "state");
33313
- __publicField(this, "startedAt");
33314
- __publicField(this, "sessionDuration", 0);
33315
- __publicField(this, "alerts");
33316
- __publicField(this, "recordings");
33306
+ this.sessionDuration = 0;
33317
33307
  this.id = id;
33318
33308
  this.state = "Created" /* Created */;
33319
33309
  this.startedAt = new Date();
@@ -33388,19 +33378,15 @@ function recorder(stream3, buffer) {
33388
33378
  // src/new-flow/recorders/CameraRecorder.ts
33389
33379
  var CameraRecorder = class {
33390
33380
  constructor(options, videoOptions) {
33391
- __publicField(this, "blobs", []);
33392
- __publicField(this, "options", {
33381
+ this.blobs = [];
33382
+ this.options = {
33393
33383
  cameraId: void 0,
33394
33384
  microphoneId: void 0
33395
- });
33396
- __publicField(this, "videoOptions", {
33385
+ };
33386
+ this.videoOptions = {
33397
33387
  width: 640,
33398
33388
  height: 480
33399
- });
33400
- __publicField(this, "recorder");
33401
- __publicField(this, "cameraStream");
33402
- __publicField(this, "file");
33403
- __publicField(this, "recordingStop");
33389
+ };
33404
33390
  this.options = options;
33405
33391
  this.videoOptions = videoOptions;
33406
33392
  }
@@ -33446,13 +33432,7 @@ var PROCTORING_NOT_STARTED = "proctoring_not_started";
33446
33432
  // src/new-flow/recorders/ScreenRecorder.ts
33447
33433
  var ScreenRecorder = class {
33448
33434
  constructor(options) {
33449
- __publicField(this, "blobs", []);
33450
- __publicField(this, "options");
33451
- __publicField(this, "recorder");
33452
- __publicField(this, "screenStream");
33453
- __publicField(this, "startTime");
33454
- __publicField(this, "file");
33455
- __publicField(this, "recordingStop");
33435
+ this.blobs = [];
33456
33436
  this.options = options;
33457
33437
  }
33458
33438
  async startRecording() {
@@ -33529,9 +33509,6 @@ function validatePartialVideoOptions(options) {
33529
33509
  // src/proctoring/DeviceChecker.ts
33530
33510
  var DeviceChecker = class {
33531
33511
  constructor() {
33532
- __publicField(this, "videoOptions");
33533
- __publicField(this, "cameraRecorder");
33534
- __publicField(this, "screenRecorder");
33535
33512
  }
33536
33513
  async checkDevices(options = getDefaultProctoringOptions(), _videoOptions) {
33537
33514
  var _a, _b;
@@ -35961,7 +35938,6 @@ var PROD_BASE_URL = "https://proctoring-api.easyproctor.tech/api";
35961
35938
  var BackendService = class {
35962
35939
  constructor(options) {
35963
35940
  this.options = options;
35964
- __publicField(this, "baseUrl");
35965
35941
  this.baseUrl = this.options.homol ? HOMOL_BASE_URL : PROD_BASE_URL;
35966
35942
  }
35967
35943
  async confirmStart(proctoringOptions, proctoringType) {
@@ -36122,9 +36098,7 @@ var BackendService = class {
36122
36098
  // src/new-flow/download/downloadService.ts
36123
36099
  var DownloadService = class {
36124
36100
  constructor(proctoringId) {
36125
- __publicField(this, "proctoringId");
36126
- __publicField(this, "loadingBoolean", true);
36127
- __publicField(this, "loadingInterval");
36101
+ this.loadingBoolean = true;
36128
36102
  this.proctoringId = proctoringId;
36129
36103
  }
36130
36104
  async upload(data, token) {
@@ -36246,11 +36220,7 @@ var ProctoringUploader = class {
36246
36220
  // src/new-flow/recorders/AlertRecorder.ts
36247
36221
  var AlertRecorder = class {
36248
36222
  constructor(options, optionsProctoring) {
36249
- __publicField(this, "alerts", []);
36250
- __publicField(this, "startTime");
36251
- __publicField(this, "onLostFocusCallback");
36252
- __publicField(this, "onFocusCallback");
36253
- __publicField(this, "optionsProctoring");
36223
+ this.alerts = [];
36254
36224
  this.onLostFocusCallback = options.onLostFocusCallback;
36255
36225
  this.onFocusCallback = options.onFocusCallback;
36256
36226
  this.optionsProctoring = optionsProctoring;
@@ -36300,10 +36270,7 @@ function createMicRecorder(config) {
36300
36270
  // src/new-flow/recorders/AudioRecorder.ts
36301
36271
  var AudioRecorder = class {
36302
36272
  constructor() {
36303
- __publicField(this, "blobs", []);
36304
- __publicField(this, "recorder");
36305
- __publicField(this, "cameraStream");
36306
- __publicField(this, "file");
36273
+ this.blobs = [];
36307
36274
  }
36308
36275
  async startRecording() {
36309
36276
  this.recorder = createMicRecorder({
@@ -36342,10 +36309,9 @@ var AudioRecorder = class {
36342
36309
  // src/new-flow/repository/IndexDbSessionRepository.ts
36343
36310
  var IndexDbSessionRepository = class {
36344
36311
  constructor() {
36345
- __publicField(this, "dbName", "EasyProctorDb");
36346
- __publicField(this, "dbVersion", 1);
36347
- __publicField(this, "storeName", "exams2");
36348
- __publicField(this, "connection");
36312
+ this.dbName = "EasyProctorDb";
36313
+ this.dbVersion = 1;
36314
+ this.storeName = "exams2";
36349
36315
  }
36350
36316
  async save(data) {
36351
36317
  const { transaction, store } = await this.connectToStore("readwrite");
@@ -36450,7 +36416,6 @@ var trackers = {
36450
36416
  var AwsUploadService = class {
36451
36417
  constructor(proctoringId, backend) {
36452
36418
  this.backend = backend;
36453
- __publicField(this, "proctoringId");
36454
36419
  this.proctoringId = proctoringId;
36455
36420
  }
36456
36421
  async upload(data, token) {
@@ -36489,7 +36454,6 @@ var AwsUploadService = class {
36489
36454
  var AzureUploadService = class {
36490
36455
  constructor(proctoringId, backend) {
36491
36456
  this.backend = backend;
36492
- __publicField(this, "proctoringId");
36493
36457
  this.proctoringId = proctoringId;
36494
36458
  }
36495
36459
  async upload(data, token) {
@@ -36536,23 +36500,17 @@ function versionVerify() {
36536
36500
  var Proctoring = class {
36537
36501
  constructor(context) {
36538
36502
  this.context = context;
36539
- __publicField(this, "backend");
36540
- __publicField(this, "repository");
36541
- __publicField(this, "proctoringId", "");
36542
- __publicField(this, "config");
36543
- __publicField(this, "proctoringSession");
36544
- __publicField(this, "sessionOptions");
36545
- __publicField(this, "videoOptions");
36546
- __publicField(this, "state", "Stop" /* Stop */);
36547
- __publicField(this, "recorder");
36548
- __publicField(this, "onStopSharingScreenCallback", () => {
36549
- });
36550
- __publicField(this, "onLostFocusCallback", () => {
36551
- });
36552
- __publicField(this, "onFocusCallback", () => {
36553
- });
36554
- __publicField(this, "onProgress", (percentage) => {
36555
- });
36503
+ this.proctoringId = "";
36504
+ this.config = void 0;
36505
+ this.state = "Stop" /* Stop */;
36506
+ this.onStopSharingScreenCallback = () => {
36507
+ };
36508
+ this.onLostFocusCallback = () => {
36509
+ };
36510
+ this.onFocusCallback = () => {
36511
+ };
36512
+ this.onProgress = (percentage) => {
36513
+ };
36556
36514
  console.log("new proctoring", context);
36557
36515
  this.backend = new BackendService({
36558
36516
  homol: context.homol
@@ -36670,7 +36628,16 @@ var Proctoring = class {
36670
36628
  new DownloadService(this.proctoringId)
36671
36629
  ]);
36672
36630
  }
36673
- await uploader.upload(this.onProgress, this.context.token);
36631
+ await uploader.upload(this.onProgress, this.context.token).catch(async (error) => {
36632
+ if (versionVerify() !== "1.0.0.0") {
36633
+ uploader = new ProctoringUploader(this.proctoringSession, [
36634
+ new AzureUploadService(this.proctoringId, this.backend),
36635
+ new AwsUploadService(this.proctoringId, this.backend),
36636
+ new DownloadService(this.proctoringId)
36637
+ ]);
36638
+ await uploader.upload(this.onProgress, this.context.token);
36639
+ }
36640
+ });
36674
36641
  await this.backend.saveScreenAlerts(this.context, this.proctoringSession).catch((err) => {
36675
36642
  trackers.registerFinish(this.proctoringSession.id, false, "save-screen error: " + err);
36676
36643
  });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkIfhasMultipleMonitors = exports.checkPermissions = void 0;
4
+ async function checkPermissions() {
5
+ console.log("checkPermissions()");
6
+ try {
7
+ const constraints = {
8
+ audio: true,
9
+ video: true,
10
+ };
11
+ const stream = await navigator.mediaDevices.getUserMedia(constraints);
12
+ stream.getTracks().forEach((el) => {
13
+ el.stop();
14
+ });
15
+ return true;
16
+ }
17
+ catch (error) {
18
+ return false;
19
+ }
20
+ }
21
+ exports.checkPermissions = checkPermissions;
22
+ async function checkIfhasMultipleMonitors() {
23
+ console.log("checkIfhasMultipleMonitors()");
24
+ return new Promise((resolve, reject) => {
25
+ if (typeof PresentationRequest === "undefined") {
26
+ resolve(false);
27
+ }
28
+ const presentationRequest = new PresentationRequest("receiver.html");
29
+ presentationRequest
30
+ .getAvailability()
31
+ .then((availability) => {
32
+ let hasMultipleMonitors = availability.value;
33
+ availability.addEventListener("change", function () {
34
+ hasMultipleMonitors = availability.value;
35
+ });
36
+ setTimeout(() => {
37
+ resolve(hasMultipleMonitors);
38
+ }, 1000);
39
+ })
40
+ .catch((error) => reject(error));
41
+ });
42
+ }
43
+ exports.checkIfhasMultipleMonitors = checkIfhasMultipleMonitors;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ async function enumarateDevices() {
4
+ console.log("enumarateDevices()");
5
+ const mediaDevices = await navigator.mediaDevices.enumerateDevices();
6
+ const devices = {
7
+ cameras: mediaDevices
8
+ .filter((el) => el.kind == "videoinput" && el.deviceId)
9
+ .map((e) => {
10
+ return { label: e.label || "Generic Device", id: e.deviceId };
11
+ }),
12
+ microphones: mediaDevices
13
+ .filter((el) => el.kind == "audioinput" && el.deviceId)
14
+ .map((e) => {
15
+ return { label: e.label || "Generic Device", id: e.deviceId };
16
+ }),
17
+ };
18
+ return devices;
19
+ }
20
+ exports.default = enumarateDevices;