easyproctor-hml 2.5.4 → 2.5.6

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
@@ -10116,6 +10116,15 @@ var CameraRecorder = class {
10116
10116
  this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback();
10117
10117
  }
10118
10118
  }
10119
+ isMobileDevice() {
10120
+ if ("userAgentData" in navigator) {
10121
+ const navUAData = navigator.userAgentData;
10122
+ const mobile = navUAData.mobile || false;
10123
+ const platform = navUAData.platform || "";
10124
+ return mobile || /Android|iOS/i.test(platform);
10125
+ }
10126
+ return /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
10127
+ }
10119
10128
  async startRecording(options) {
10120
10129
  var _a2, _b, _c2, _d, _e3, _f, _g, _h;
10121
10130
  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)) {
@@ -10164,11 +10173,12 @@ var CameraRecorder = class {
10164
10173
  const tracks = this.cameraStream.getVideoTracks();
10165
10174
  const settings = tracks[0].getSettings();
10166
10175
  let { width = 0, height = 0 } = settings;
10167
- const isPortrait = ((_d = screen.orientation) == null ? void 0 : _d.type.includes("portrait")) || window.innerHeight > window.innerWidth;
10168
- if (isPortrait && width > height) {
10176
+ const isPortrait = (_d = screen.orientation) == null ? void 0 : _d.type.includes("portrait");
10177
+ if (isPortrait && this.isMobileDevice()) {
10169
10178
  [width, height] = [height, width];
10170
10179
  }
10171
10180
  console.log("isPortrait -> ", isPortrait);
10181
+ console.log("this.isMobileDevice() -> ", this.isMobileDevice());
10172
10182
  console.log("width -> ", width);
10173
10183
  console.log("height -> ", height);
10174
10184
  console.log("minWidth -> ", this.videoOptions.minWidth);
package/index.js CHANGED
@@ -28213,6 +28213,15 @@ var CameraRecorder = class {
28213
28213
  this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback();
28214
28214
  }
28215
28215
  }
28216
+ isMobileDevice() {
28217
+ if ("userAgentData" in navigator) {
28218
+ const navUAData = navigator.userAgentData;
28219
+ const mobile = navUAData.mobile || false;
28220
+ const platform = navUAData.platform || "";
28221
+ return mobile || /Android|iOS/i.test(platform);
28222
+ }
28223
+ return /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
28224
+ }
28216
28225
  async startRecording(options) {
28217
28226
  var _a2, _b, _c2, _d, _e3, _f, _g, _h;
28218
28227
  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)) {
@@ -28261,11 +28270,12 @@ var CameraRecorder = class {
28261
28270
  const tracks = this.cameraStream.getVideoTracks();
28262
28271
  const settings = tracks[0].getSettings();
28263
28272
  let { width = 0, height = 0 } = settings;
28264
- const isPortrait = ((_d = screen.orientation) == null ? void 0 : _d.type.includes("portrait")) || window.innerHeight > window.innerWidth;
28265
- if (isPortrait && width > height) {
28273
+ const isPortrait = (_d = screen.orientation) == null ? void 0 : _d.type.includes("portrait");
28274
+ if (isPortrait && this.isMobileDevice()) {
28266
28275
  [width, height] = [height, width];
28267
28276
  }
28268
28277
  console.log("isPortrait -> ", isPortrait);
28278
+ console.log("this.isMobileDevice() -> ", this.isMobileDevice());
28269
28279
  console.log("width -> ", width);
28270
28280
  console.log("height -> ", height);
28271
28281
  console.log("minWidth -> ", this.videoOptions.minWidth);
@@ -52,6 +52,7 @@ export declare class CameraRecorder implements IRecorder {
52
52
  configImageCapture(): void;
53
53
  currentRetries: number;
54
54
  bufferError(e: any): Promise<void>;
55
+ isMobileDevice(): boolean;
55
56
  startRecording(options?: {
56
57
  retry?: boolean;
57
58
  }): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor-hml",
3
- "version": "2.5.4",
3
+ "version": "2.5.6",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",