easyproctor 2.5.0 → 2.5.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/esm/index.js CHANGED
@@ -10258,7 +10258,7 @@ var CameraRecorder = class {
10258
10258
  }
10259
10259
  }
10260
10260
  async startRecording(options) {
10261
- var _a2, _b, _c2, _d, _e3, _f, _g;
10261
+ var _a2, _b, _c2, _d, _e3, _f, _g, _h;
10262
10262
  if ((((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone) || ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace)) && !(options == null ? void 0 : options.retry)) {
10263
10263
  await this.initializeDetectors();
10264
10264
  }
@@ -10284,13 +10284,7 @@ var CameraRecorder = class {
10284
10284
  this.cameraStream = this.hardwareStream;
10285
10285
  const track = this.cameraStream.getVideoTracks()[0];
10286
10286
  const settings = track.getSettings();
10287
- const { width = 0, height = 0 } = settings;
10288
- const needsRotationFix = isMobileDevice() && width > height;
10289
- this.isCanvasLoopActive = true;
10290
- if (needsRotationFix) {
10291
- console.log("Aplicando corre\xE7\xE3o e substituindo stream p\xFAblico...");
10292
- this.cameraStream = this.createRotatedStream(this.hardwareStream);
10293
- }
10287
+ let { width = 0, height = 0 } = settings;
10294
10288
  const {
10295
10289
  startRecording,
10296
10290
  stopRecording,
@@ -10313,6 +10307,12 @@ var CameraRecorder = class {
10313
10307
  this.recorderOptions = recorderOptions;
10314
10308
  this.getBufferSize = getBufferSize;
10315
10309
  this.recordingStart();
10310
+ const isPortrait = (_d = screen.orientation) == null ? void 0 : _d.type.includes("portrait");
10311
+ if (isPortrait && isMobileDevice()) {
10312
+ if (this.videoOptions.width == height && this.videoOptions.height == width) {
10313
+ [width, height] = [height, width];
10314
+ }
10315
+ }
10316
10316
  if (this.videoOptions.minWidth > width || this.videoOptions.minHeight > height) {
10317
10317
  throw STREAM_UNDER_MINIMUM_PERMITTED;
10318
10318
  } else if (this.videoOptions.width !== width || this.videoOptions.height !== height) {
@@ -10328,11 +10328,11 @@ Setting: ${JSON.stringify(settings, null, 2)}`
10328
10328
  );
10329
10329
  throw ANOTHER_STREAM_ACTIVE;
10330
10330
  }
10331
- ((_d = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _d.useUploadImage) && this.options.proctoringType == "IMAGE" && this.photoShotsCycle();
10332
- if ((_e3 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _e3.detectFace) {
10331
+ ((_e3 = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _e3.useUploadImage) && this.options.proctoringType == "IMAGE" && this.photoShotsCycle();
10332
+ if ((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectFace) {
10333
10333
  await this.faceDetection.enableCam(this.cameraStream);
10334
10334
  }
10335
- if (((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectPerson) || ((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectCellPhone)) {
10335
+ if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectPerson) || ((_h = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _h.detectCellPhone)) {
10336
10336
  await this.objectDetection.enableCam(this.cameraStream);
10337
10337
  }
10338
10338
  this.filesToUpload = [];
@@ -10598,7 +10598,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
10598
10598
  const video = document.createElement("video");
10599
10599
  video.srcObject = this.internalClonedStream;
10600
10600
  video.muted = true;
10601
- video.playsInline = true;
10602
10601
  video.play();
10603
10602
  const canvas = document.createElement("canvas");
10604
10603
  const ctx = canvas.getContext("2d");
@@ -11013,9 +11012,6 @@ var DeviceCheckerUI = class {
11013
11012
  const center = document.createElement("div");
11014
11013
  video.setAttribute("id", "cameraStream");
11015
11014
  video.muted = true;
11016
- video.setAttribute("playsinline", "true");
11017
- video.setAttribute("webkit-playsinline", "true");
11018
- video.autoplay = true;
11019
11015
  const divCameraStyles = {
11020
11016
  width: "100%",
11021
11017
  display: "flex",
@@ -19365,10 +19361,10 @@ Upload Services: ${uploaderServices}`,
19365
19361
  });
19366
19362
  }
19367
19363
  await this.backend.finishAndSendUrls(this.context).then((finishResponse) => {
19368
- var _a2, _b;
19364
+ var _a2, _b, _c2, _d;
19369
19365
  trackers.registerFinish(this.proctoringSession.id, true, "");
19370
19366
  console.log("finishResponse: ", finishResponse);
19371
- options.onFinish && options.onFinish((_a2 = finishResponse == null ? void 0 : finishResponse.score) != null ? _a2 : 100, (_b = finishResponse == null ? void 0 : finishResponse.approved) != null ? _b : true);
19367
+ options.onFinish && options.onFinish((_a2 = finishResponse == null ? void 0 : finishResponse.score) != null ? _a2 : 100, (_b = finishResponse == null ? void 0 : finishResponse.scoreThreshold) != null ? _b : 70, (_c2 = finishResponse == null ? void 0 : finishResponse.approved) != null ? _c2 : true, (_d = finishResponse == null ? void 0 : finishResponse.justification) != null ? _d : "");
19372
19368
  }).catch((error) => {
19373
19369
  trackers.registerFinish(
19374
19370
  this.proctoringSession.id,
package/index.js CHANGED
@@ -28355,7 +28355,7 @@ var CameraRecorder = class {
28355
28355
  }
28356
28356
  }
28357
28357
  async startRecording(options) {
28358
- var _a2, _b, _c2, _d, _e3, _f, _g;
28358
+ var _a2, _b, _c2, _d, _e3, _f, _g, _h;
28359
28359
  if ((((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone) || ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace)) && !(options == null ? void 0 : options.retry)) {
28360
28360
  await this.initializeDetectors();
28361
28361
  }
@@ -28381,13 +28381,7 @@ var CameraRecorder = class {
28381
28381
  this.cameraStream = this.hardwareStream;
28382
28382
  const track = this.cameraStream.getVideoTracks()[0];
28383
28383
  const settings = track.getSettings();
28384
- const { width = 0, height = 0 } = settings;
28385
- const needsRotationFix = isMobileDevice() && width > height;
28386
- this.isCanvasLoopActive = true;
28387
- if (needsRotationFix) {
28388
- console.log("Aplicando corre\xE7\xE3o e substituindo stream p\xFAblico...");
28389
- this.cameraStream = this.createRotatedStream(this.hardwareStream);
28390
- }
28384
+ let { width = 0, height = 0 } = settings;
28391
28385
  const {
28392
28386
  startRecording,
28393
28387
  stopRecording,
@@ -28410,6 +28404,12 @@ var CameraRecorder = class {
28410
28404
  this.recorderOptions = recorderOptions;
28411
28405
  this.getBufferSize = getBufferSize;
28412
28406
  this.recordingStart();
28407
+ const isPortrait = (_d = screen.orientation) == null ? void 0 : _d.type.includes("portrait");
28408
+ if (isPortrait && isMobileDevice()) {
28409
+ if (this.videoOptions.width == height && this.videoOptions.height == width) {
28410
+ [width, height] = [height, width];
28411
+ }
28412
+ }
28413
28413
  if (this.videoOptions.minWidth > width || this.videoOptions.minHeight > height) {
28414
28414
  throw STREAM_UNDER_MINIMUM_PERMITTED;
28415
28415
  } else if (this.videoOptions.width !== width || this.videoOptions.height !== height) {
@@ -28425,11 +28425,11 @@ Setting: ${JSON.stringify(settings, null, 2)}`
28425
28425
  );
28426
28426
  throw ANOTHER_STREAM_ACTIVE;
28427
28427
  }
28428
- ((_d = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _d.useUploadImage) && this.options.proctoringType == "IMAGE" && this.photoShotsCycle();
28429
- if ((_e3 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _e3.detectFace) {
28428
+ ((_e3 = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _e3.useUploadImage) && this.options.proctoringType == "IMAGE" && this.photoShotsCycle();
28429
+ if ((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectFace) {
28430
28430
  await this.faceDetection.enableCam(this.cameraStream);
28431
28431
  }
28432
- if (((_f = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _f.detectPerson) || ((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectCellPhone)) {
28432
+ if (((_g = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _g.detectPerson) || ((_h = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _h.detectCellPhone)) {
28433
28433
  await this.objectDetection.enableCam(this.cameraStream);
28434
28434
  }
28435
28435
  this.filesToUpload = [];
@@ -28695,7 +28695,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
28695
28695
  const video = document.createElement("video");
28696
28696
  video.srcObject = this.internalClonedStream;
28697
28697
  video.muted = true;
28698
- video.playsInline = true;
28699
28698
  video.play();
28700
28699
  const canvas = document.createElement("canvas");
28701
28700
  const ctx = canvas.getContext("2d");
@@ -29110,9 +29109,6 @@ var DeviceCheckerUI = class {
29110
29109
  const center = document.createElement("div");
29111
29110
  video.setAttribute("id", "cameraStream");
29112
29111
  video.muted = true;
29113
- video.setAttribute("playsinline", "true");
29114
- video.setAttribute("webkit-playsinline", "true");
29115
- video.autoplay = true;
29116
29112
  const divCameraStyles = {
29117
29113
  width: "100%",
29118
29114
  display: "flex",
@@ -34614,10 +34610,10 @@ Upload Services: ${uploaderServices}`,
34614
34610
  });
34615
34611
  }
34616
34612
  await this.backend.finishAndSendUrls(this.context).then((finishResponse) => {
34617
- var _a2, _b;
34613
+ var _a2, _b, _c2, _d;
34618
34614
  trackers.registerFinish(this.proctoringSession.id, true, "");
34619
34615
  console.log("finishResponse: ", finishResponse);
34620
- options.onFinish && options.onFinish((_a2 = finishResponse == null ? void 0 : finishResponse.score) != null ? _a2 : 100, (_b = finishResponse == null ? void 0 : finishResponse.approved) != null ? _b : true);
34616
+ options.onFinish && options.onFinish((_a2 = finishResponse == null ? void 0 : finishResponse.score) != null ? _a2 : 100, (_b = finishResponse == null ? void 0 : finishResponse.scoreThreshold) != null ? _b : 70, (_c2 = finishResponse == null ? void 0 : finishResponse.approved) != null ? _c2 : true, (_d = finishResponse == null ? void 0 : finishResponse.justification) != null ? _d : "");
34621
34617
  }).catch((error) => {
34622
34618
  trackers.registerFinish(
34623
34619
  this.proctoringSession.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -15,7 +15,7 @@ export interface ProctoringContext {
15
15
  }
16
16
  export interface ProctoringFinisherOptions {
17
17
  onProgress?: (percentage: number) => void;
18
- onFinish?: (score: number, approved: boolean) => void;
18
+ onFinish?: (score: number, scoreThreshold: number, approved: boolean, justification: string) => void;
19
19
  }
20
20
  export interface ProctoringChangeDevicesOptions {
21
21
  status?: (devices: DevicesChanged) => void;