easyproctor-hml 2.5.20 → 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;
@@ -12991,7 +12999,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
12991
12999
  const packSize = (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimePackageSize;
12992
13000
  this.imageCount = 0;
12993
13001
  this.imageInterval = setInterval(async () => {
12994
- console.log("capturando frame " + this.imageCount);
12995
13002
  this.canvas.getContext("2d").drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
12996
13003
  const image_data_url = this.canvas.toDataURL("image/jpeg");
12997
13004
  if (this.proctoringId == void 0) return;
@@ -13123,45 +13130,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
13123
13130
  }
13124
13131
  this.noiseWait++;
13125
13132
  }
13126
- /**
13127
- * Cria um stream processado onde os frames são rotacionados via Canvas.
13128
- * Isso corrige o problema de gravação deitada em iOS/Mobile.
13129
- */
13130
- createRotatedStream(originalStream) {
13131
- this.internalClonedStream = originalStream.clone();
13132
- const video = document.createElement("video");
13133
- video.srcObject = this.internalClonedStream;
13134
- video.muted = true;
13135
- video.play();
13136
- const canvas = document.createElement("canvas");
13137
- const ctx = canvas.getContext("2d");
13138
- const track = originalStream.getVideoTracks()[0];
13139
- const settings = track.getSettings();
13140
- const width = settings.width || 640;
13141
- const height = settings.height || 480;
13142
- canvas.width = height;
13143
- canvas.height = width;
13144
- const draw = () => {
13145
- if (video.paused || video.ended) return;
13146
- if (!this.isCanvasLoopActive) return;
13147
- if (ctx) {
13148
- ctx.clearRect(0, 0, canvas.width, canvas.height);
13149
- ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
13150
- }
13151
- if (this.isCanvasLoopActive) {
13152
- this.animationFrameId = requestAnimationFrame(draw);
13153
- }
13154
- };
13155
- video.onplaying = () => {
13156
- this.isCanvasLoopActive = true;
13157
- draw();
13158
- };
13159
- const canvasStream = canvas.captureStream(30);
13160
- originalStream.getAudioTracks().forEach((track2) => {
13161
- canvasStream.addTrack(track2);
13162
- });
13163
- return canvasStream;
13164
- }
13165
13133
  };
13166
13134
 
13167
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;
@@ -31088,7 +31096,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31088
31096
  const packSize = (_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.realtimePackageSize;
31089
31097
  this.imageCount = 0;
31090
31098
  this.imageInterval = setInterval(async () => {
31091
- console.log("capturando frame " + this.imageCount);
31092
31099
  this.canvas.getContext("2d").drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
31093
31100
  const image_data_url = this.canvas.toDataURL("image/jpeg");
31094
31101
  if (this.proctoringId == void 0) return;
@@ -31220,45 +31227,6 @@ Setting: ${JSON.stringify(settings, null, 2)}`
31220
31227
  }
31221
31228
  this.noiseWait++;
31222
31229
  }
31223
- /**
31224
- * Cria um stream processado onde os frames são rotacionados via Canvas.
31225
- * Isso corrige o problema de gravação deitada em iOS/Mobile.
31226
- */
31227
- createRotatedStream(originalStream) {
31228
- this.internalClonedStream = originalStream.clone();
31229
- const video = document.createElement("video");
31230
- video.srcObject = this.internalClonedStream;
31231
- video.muted = true;
31232
- video.play();
31233
- const canvas = document.createElement("canvas");
31234
- const ctx = canvas.getContext("2d");
31235
- const track = originalStream.getVideoTracks()[0];
31236
- const settings = track.getSettings();
31237
- const width = settings.width || 640;
31238
- const height = settings.height || 480;
31239
- canvas.width = height;
31240
- canvas.height = width;
31241
- const draw = () => {
31242
- if (video.paused || video.ended) return;
31243
- if (!this.isCanvasLoopActive) return;
31244
- if (ctx) {
31245
- ctx.clearRect(0, 0, canvas.width, canvas.height);
31246
- ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
31247
- }
31248
- if (this.isCanvasLoopActive) {
31249
- this.animationFrameId = requestAnimationFrame(draw);
31250
- }
31251
- };
31252
- video.onplaying = () => {
31253
- this.isCanvasLoopActive = true;
31254
- draw();
31255
- };
31256
- const canvasStream = canvas.captureStream(30);
31257
- originalStream.getAudioTracks().forEach((track2) => {
31258
- canvasStream.addTrack(track2);
31259
- });
31260
- return canvasStream;
31261
- }
31262
31230
  };
31263
31231
 
31264
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.20",
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",