easyproctor-hml 2.5.19 → 2.5.21

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
@@ -12777,13 +12777,21 @@ var CameraRecorder = class {
12777
12777
  }
12778
12778
  }
12779
12779
  configImageCapture() {
12780
+ var _a2;
12780
12781
  this.video = document.createElement("video");
12781
12782
  this.canvas = document.createElement("canvas");
12782
12783
  this.video.srcObject = this.cameraStream;
12783
12784
  this.video.play();
12784
12785
  this.video.muted = true;
12785
- this.canvas.width = this.videoOptions.width;
12786
- this.canvas.height = this.videoOptions.height;
12786
+ const isPortrait = (_a2 = screen.orientation) == null ? void 0 : _a2.type.includes("portrait");
12787
+ if (isPortrait && isMobileDevice()) {
12788
+ console.log("configurando canvas em portrait");
12789
+ this.canvas.width = this.videoOptions.height / 2;
12790
+ this.canvas.height = this.videoOptions.width / 2;
12791
+ } else {
12792
+ this.canvas.width = this.videoOptions.width / 2;
12793
+ this.canvas.height = this.videoOptions.height / 2;
12794
+ }
12787
12795
  }
12788
12796
  async bufferError(e3) {
12789
12797
  var _a2, _b;
@@ -12988,16 +12996,9 @@ Setting: ${JSON.stringify(settings, null, 2)}`
12988
12996
  var _a2, _b;
12989
12997
  let imageFile;
12990
12998
  this.configImageCapture();
12991
- let newCanvasWidth = this.videoOptions.width / 2;
12992
- let newCanvasHeight = this.videoOptions.height / 2;
12993
- if (newCanvasWidth < 320) newCanvasWidth = 320;
12994
- if (newCanvasHeight < 180) newCanvasHeight = 180;
12995
- this.canvas.width = newCanvasWidth;
12996
- this.canvas.height = newCanvasHeight;
12997
12999
  const packSize = (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimePackageSize;
12998
13000
  this.imageCount = 0;
12999
13001
  this.imageInterval = setInterval(async () => {
13000
- console.log("capturando frame " + this.imageCount);
13001
13002
  this.canvas.getContext("2d").drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
13002
13003
  const image_data_url = this.canvas.toDataURL("image/jpeg");
13003
13004
  if (this.proctoringId == void 0) return;
@@ -13129,45 +13130,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
13129
13130
  }
13130
13131
  this.noiseWait++;
13131
13132
  }
13132
- /**
13133
- * Cria um stream processado onde os frames são rotacionados via Canvas.
13134
- * Isso corrige o problema de gravação deitada em iOS/Mobile.
13135
- */
13136
- createRotatedStream(originalStream) {
13137
- this.internalClonedStream = originalStream.clone();
13138
- const video = document.createElement("video");
13139
- video.srcObject = this.internalClonedStream;
13140
- video.muted = true;
13141
- video.play();
13142
- const canvas = document.createElement("canvas");
13143
- const ctx = canvas.getContext("2d");
13144
- const track = originalStream.getVideoTracks()[0];
13145
- const settings = track.getSettings();
13146
- const width = settings.width || 640;
13147
- const height = settings.height || 480;
13148
- canvas.width = height;
13149
- canvas.height = width;
13150
- const draw = () => {
13151
- if (video.paused || video.ended) return;
13152
- if (!this.isCanvasLoopActive) return;
13153
- if (ctx) {
13154
- ctx.clearRect(0, 0, canvas.width, canvas.height);
13155
- ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
13156
- }
13157
- if (this.isCanvasLoopActive) {
13158
- this.animationFrameId = requestAnimationFrame(draw);
13159
- }
13160
- };
13161
- video.onplaying = () => {
13162
- this.isCanvasLoopActive = true;
13163
- draw();
13164
- };
13165
- const canvasStream = canvas.captureStream(30);
13166
- originalStream.getAudioTracks().forEach((track2) => {
13167
- canvasStream.addTrack(track2);
13168
- });
13169
- return canvasStream;
13170
- }
13171
13133
  };
13172
13134
 
13173
13135
  // src/new-flow/checkers/DeviceCheckerUI.ts
package/index.js CHANGED
@@ -30874,13 +30874,21 @@ var CameraRecorder = class {
30874
30874
  }
30875
30875
  }
30876
30876
  configImageCapture() {
30877
+ var _a2;
30877
30878
  this.video = document.createElement("video");
30878
30879
  this.canvas = document.createElement("canvas");
30879
30880
  this.video.srcObject = this.cameraStream;
30880
30881
  this.video.play();
30881
30882
  this.video.muted = true;
30882
- this.canvas.width = this.videoOptions.width;
30883
- this.canvas.height = this.videoOptions.height;
30883
+ const isPortrait = (_a2 = screen.orientation) == null ? void 0 : _a2.type.includes("portrait");
30884
+ if (isPortrait && isMobileDevice()) {
30885
+ console.log("configurando canvas em portrait");
30886
+ this.canvas.width = this.videoOptions.height / 2;
30887
+ this.canvas.height = this.videoOptions.width / 2;
30888
+ } else {
30889
+ this.canvas.width = this.videoOptions.width / 2;
30890
+ this.canvas.height = this.videoOptions.height / 2;
30891
+ }
30884
30892
  }
30885
30893
  async bufferError(e3) {
30886
30894
  var _a2, _b;
@@ -31085,16 +31093,9 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31085
31093
  var _a2, _b;
31086
31094
  let imageFile;
31087
31095
  this.configImageCapture();
31088
- let newCanvasWidth = this.videoOptions.width / 2;
31089
- let newCanvasHeight = this.videoOptions.height / 2;
31090
- if (newCanvasWidth < 320) newCanvasWidth = 320;
31091
- if (newCanvasHeight < 180) newCanvasHeight = 180;
31092
- this.canvas.width = newCanvasWidth;
31093
- this.canvas.height = newCanvasHeight;
31094
31096
  const packSize = (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimePackageSize;
31095
31097
  this.imageCount = 0;
31096
31098
  this.imageInterval = setInterval(async () => {
31097
- console.log("capturando frame " + this.imageCount);
31098
31099
  this.canvas.getContext("2d").drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
31099
31100
  const image_data_url = this.canvas.toDataURL("image/jpeg");
31100
31101
  if (this.proctoringId == void 0) return;
@@ -31226,45 +31227,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31226
31227
  }
31227
31228
  this.noiseWait++;
31228
31229
  }
31229
- /**
31230
- * Cria um stream processado onde os frames são rotacionados via Canvas.
31231
- * Isso corrige o problema de gravação deitada em iOS/Mobile.
31232
- */
31233
- createRotatedStream(originalStream) {
31234
- this.internalClonedStream = originalStream.clone();
31235
- const video = document.createElement("video");
31236
- video.srcObject = this.internalClonedStream;
31237
- video.muted = true;
31238
- video.play();
31239
- const canvas = document.createElement("canvas");
31240
- const ctx = canvas.getContext("2d");
31241
- const track = originalStream.getVideoTracks()[0];
31242
- const settings = track.getSettings();
31243
- const width = settings.width || 640;
31244
- const height = settings.height || 480;
31245
- canvas.width = height;
31246
- canvas.height = width;
31247
- const draw = () => {
31248
- if (video.paused || video.ended) return;
31249
- if (!this.isCanvasLoopActive) return;
31250
- if (ctx) {
31251
- ctx.clearRect(0, 0, canvas.width, canvas.height);
31252
- ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
31253
- }
31254
- if (this.isCanvasLoopActive) {
31255
- this.animationFrameId = requestAnimationFrame(draw);
31256
- }
31257
- };
31258
- video.onplaying = () => {
31259
- this.isCanvasLoopActive = true;
31260
- draw();
31261
- };
31262
- const canvasStream = canvas.captureStream(30);
31263
- originalStream.getAudioTracks().forEach((track2) => {
31264
- canvasStream.addTrack(track2);
31265
- });
31266
- return canvasStream;
31267
- }
31268
31230
  };
31269
31231
 
31270
31232
  // src/new-flow/checkers/DeviceCheckerUI.ts
@@ -72,5 +72,4 @@ export declare class CameraRecorder implements IRecorder {
72
72
  getFile(file: string, name: string, type: string): Promise<File>;
73
73
  noiseWait: number;
74
74
  private onNoiseDetected;
75
- private createRotatedStream;
76
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor-hml",
3
- "version": "2.5.19",
3
+ "version": "2.5.21",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",