easyproctor 1.1.10 → 1.1.11

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
@@ -17889,11 +17889,13 @@ function validatePartialVideoOptions(options) {
17889
17889
  // src/proctoring/DeviceChecker.ts
17890
17890
  var DeviceChecker = class {
17891
17891
  constructor() {
17892
+ this.videoOptions = { width: 1080, height: 720, minWidth: 0, minHeight: 0 };
17892
17893
  this.volumeMedia = 0;
17893
17894
  this.volumeSum = 0;
17894
17895
  this.volumeCounter = 0;
17896
+ this.allowedResolution = true;
17895
17897
  }
17896
- async checkDevices(options = getDefaultProctoringOptions, _videoOptions = { width: 1080, height: 720 }) {
17898
+ async checkDevices(options = getDefaultProctoringOptions, _videoOptions) {
17897
17899
  this.options = {
17898
17900
  ...getDefaultProctoringOptions,
17899
17901
  ...options,
@@ -17901,16 +17903,25 @@ var DeviceChecker = class {
17901
17903
  allowMultipleMonitors: true,
17902
17904
  allowOnlyFirstMonitor: false
17903
17905
  };
17904
- this.videoOptions = _videoOptions;
17906
+ this.videoOptions = { ...this.videoOptions, ..._videoOptions };
17905
17907
  const { cameraId, microphoneId } = await this.checkDevicesInterface();
17906
17908
  return new Promise((resolve) => {
17907
17909
  resolve({
17908
17910
  cameraId,
17909
17911
  microphoneId,
17910
- volumeRange: this.volumeMedia
17912
+ volumeRange: this.volumeMedia,
17913
+ allowedResolution: this.allowedResolution
17911
17914
  });
17912
17915
  });
17913
17916
  }
17917
+ isUnderResolution() {
17918
+ const settings = this.cameraRecorder.cameraStream.getVideoTracks()[0].getSettings();
17919
+ const error = document.getElementById("cameraError");
17920
+ if (this.videoOptions.minWidth > settings.width || this.videoOptions.minHeight > settings.height) {
17921
+ this.allowedResolution = false;
17922
+ error.innerText = `A c\xE2mera n\xE3o satisfaz a resolu\xE7\xE3o m\xEDnima exigida (${this.videoOptions.minWidth}x${this.videoOptions.minHeight}). Para iniciar um exame utilize uma outra c\xE2mera.`;
17923
+ }
17924
+ }
17914
17925
  checkDevicesInterface() {
17915
17926
  return new Promise((resolve) => {
17916
17927
  const fullBg = document.createElement("div");
@@ -17961,8 +17972,18 @@ var DeviceChecker = class {
17961
17972
  divCameraHeader.appendChild(h3Camera);
17962
17973
  divCameraHeader.appendChild(selectCamera);
17963
17974
  modal.appendChild(divCameraHeader);
17975
+ const divCameraError = document.createElement("div");
17976
+ const error = document.createElement("error");
17977
+ error.setAttribute("id", "cameraError");
17978
+ divCameraError.style.width = "calc(100% - 40px)";
17979
+ divCameraError.style.marginBottom = "5px";
17980
+ error.style.color = "#FF0000";
17981
+ error.style.textAlign = "left";
17982
+ divCameraError.appendChild(error);
17983
+ modal.appendChild(divCameraError);
17964
17984
  const divCamera = document.createElement("div");
17965
17985
  const video = document.createElement("video");
17986
+ const center = document.createElement("div");
17966
17987
  video.setAttribute("id", "cameraStream");
17967
17988
  video.muted = true;
17968
17989
  divCamera.style.width = "calc(100% - 40px)";
@@ -17975,6 +17996,7 @@ var DeviceChecker = class {
17975
17996
  video.style.backgroundColor = "#000";
17976
17997
  video.style.borderRadius = "10px";
17977
17998
  video.style.marginBottom = "15px";
17999
+ divCamera.appendChild(center);
17978
18000
  divCamera.appendChild(video);
17979
18001
  modal.appendChild(divCamera);
17980
18002
  const divMicHeader = document.createElement("div");
@@ -18067,6 +18089,7 @@ var DeviceChecker = class {
18067
18089
  if (cameraStream) {
18068
18090
  cameraStream.srcObject = stream;
18069
18091
  cameraStream.play();
18092
+ this.isUnderResolution();
18070
18093
  }
18071
18094
  }
18072
18095
  audioDeviceInterface(stream) {
package/index.js CHANGED
@@ -29437,11 +29437,13 @@ function validatePartialVideoOptions(options) {
29437
29437
  // src/proctoring/DeviceChecker.ts
29438
29438
  var DeviceChecker = class {
29439
29439
  constructor() {
29440
+ this.videoOptions = { width: 1080, height: 720, minWidth: 0, minHeight: 0 };
29440
29441
  this.volumeMedia = 0;
29441
29442
  this.volumeSum = 0;
29442
29443
  this.volumeCounter = 0;
29444
+ this.allowedResolution = true;
29443
29445
  }
29444
- async checkDevices(options = getDefaultProctoringOptions, _videoOptions = { width: 1080, height: 720 }) {
29446
+ async checkDevices(options = getDefaultProctoringOptions, _videoOptions) {
29445
29447
  this.options = {
29446
29448
  ...getDefaultProctoringOptions,
29447
29449
  ...options,
@@ -29449,16 +29451,25 @@ var DeviceChecker = class {
29449
29451
  allowMultipleMonitors: true,
29450
29452
  allowOnlyFirstMonitor: false
29451
29453
  };
29452
- this.videoOptions = _videoOptions;
29454
+ this.videoOptions = { ...this.videoOptions, ..._videoOptions };
29453
29455
  const { cameraId, microphoneId } = await this.checkDevicesInterface();
29454
29456
  return new Promise((resolve) => {
29455
29457
  resolve({
29456
29458
  cameraId,
29457
29459
  microphoneId,
29458
- volumeRange: this.volumeMedia
29460
+ volumeRange: this.volumeMedia,
29461
+ allowedResolution: this.allowedResolution
29459
29462
  });
29460
29463
  });
29461
29464
  }
29465
+ isUnderResolution() {
29466
+ const settings = this.cameraRecorder.cameraStream.getVideoTracks()[0].getSettings();
29467
+ const error = document.getElementById("cameraError");
29468
+ if (this.videoOptions.minWidth > settings.width || this.videoOptions.minHeight > settings.height) {
29469
+ this.allowedResolution = false;
29470
+ error.innerText = `A c\xE2mera n\xE3o satisfaz a resolu\xE7\xE3o m\xEDnima exigida (${this.videoOptions.minWidth}x${this.videoOptions.minHeight}). Para iniciar um exame utilize uma outra c\xE2mera.`;
29471
+ }
29472
+ }
29462
29473
  checkDevicesInterface() {
29463
29474
  return new Promise((resolve) => {
29464
29475
  const fullBg = document.createElement("div");
@@ -29509,8 +29520,18 @@ var DeviceChecker = class {
29509
29520
  divCameraHeader.appendChild(h3Camera);
29510
29521
  divCameraHeader.appendChild(selectCamera);
29511
29522
  modal.appendChild(divCameraHeader);
29523
+ const divCameraError = document.createElement("div");
29524
+ const error = document.createElement("error");
29525
+ error.setAttribute("id", "cameraError");
29526
+ divCameraError.style.width = "calc(100% - 40px)";
29527
+ divCameraError.style.marginBottom = "5px";
29528
+ error.style.color = "#FF0000";
29529
+ error.style.textAlign = "left";
29530
+ divCameraError.appendChild(error);
29531
+ modal.appendChild(divCameraError);
29512
29532
  const divCamera = document.createElement("div");
29513
29533
  const video = document.createElement("video");
29534
+ const center = document.createElement("div");
29514
29535
  video.setAttribute("id", "cameraStream");
29515
29536
  video.muted = true;
29516
29537
  divCamera.style.width = "calc(100% - 40px)";
@@ -29523,6 +29544,7 @@ var DeviceChecker = class {
29523
29544
  video.style.backgroundColor = "#000";
29524
29545
  video.style.borderRadius = "10px";
29525
29546
  video.style.marginBottom = "15px";
29547
+ divCamera.appendChild(center);
29526
29548
  divCamera.appendChild(video);
29527
29549
  modal.appendChild(divCamera);
29528
29550
  const divMicHeader = document.createElement("div");
@@ -29615,6 +29637,7 @@ var DeviceChecker = class {
29615
29637
  if (cameraStream) {
29616
29638
  cameraStream.srcObject = stream4;
29617
29639
  cameraStream.play();
29640
+ this.isUnderResolution();
29618
29641
  }
29619
29642
  }
29620
29643
  audioDeviceInterface(stream4) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -8,6 +8,7 @@ export interface checkDevicesReturn {
8
8
  cameraId: string;
9
9
  microphoneId: string;
10
10
  volumeRange: number;
11
+ allowedResolution: boolean;
11
12
  }
12
13
  export declare class DeviceChecker {
13
14
  private options;
@@ -17,8 +18,10 @@ export declare class DeviceChecker {
17
18
  private volumeMedia;
18
19
  private volumeSum;
19
20
  private volumeCounter;
21
+ private allowedResolution;
20
22
  constructor();
21
- checkDevices(options?: ProctoringSessionOptions, _videoOptions?: ProctoringVideoOptions): Promise<checkDevicesReturn>;
23
+ checkDevices(options: ProctoringSessionOptions | undefined, _videoOptions: ProctoringVideoOptions): Promise<checkDevicesReturn>;
24
+ private isUnderResolution;
22
25
  private checkDevicesInterface;
23
26
  private videoDeviceInterface;
24
27
  private audioDeviceInterface;
@@ -10,7 +10,7 @@ export declare function useProctoring(proctoringOptions: ProctoringContext, envi
10
10
  onNoiseDetected: (cb: () => void) => void;
11
11
  onChangeDevices: (options?: import("./proctoring").ProctoringChangeDevicesOptions) => Promise<void>;
12
12
  onBufferSizeError: (cb: () => void) => void;
13
- checkDevices: (options?: import("./options/ProctoringOptions").ProctoringSessionOptions, _videoOptions?: import("./options/ProctoringVideoOptions").ProctoringVideoOptions) => Promise<import("./DeviceChecker").checkDevicesReturn>;
13
+ checkDevices: (options: import("./options/ProctoringOptions").ProctoringSessionOptions | undefined, _videoOptions: import("./options/ProctoringVideoOptions").ProctoringVideoOptions) => Promise<import("./DeviceChecker").checkDevicesReturn>;
14
14
  capturePhoto: (title: string, subtitle: string, resolution?: import("./CapturePhoto").IResolution) => Promise<import("./CapturePhoto").cameraInterface>;
15
15
  pause: () => Promise<void>;
16
16
  resume: () => Promise<{