@remotion/webcodecs 4.0.325 → 4.0.327

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.
@@ -365,7 +365,7 @@ var rotateAndResizeVideoFrame = ({
365
365
  needsToBeMultipleOfTwo = false,
366
366
  resizeOperation
367
367
  }) => {
368
- const normalized = (rotation % 360 + 360) % 360;
368
+ const normalized = normalizeVideoRotation(rotation);
369
369
  if (normalized === 0 && resizeOperation === null) {
370
370
  return frame;
371
371
  }
@@ -389,15 +389,17 @@ var rotateAndResizeVideoFrame = ({
389
389
  }
390
390
  canvas.width = width;
391
391
  canvas.height = height;
392
- if (normalized === 90) {
392
+ const frameRotation = frame.rotation ?? 0;
393
+ const canvasRotationToApply = normalizeVideoRotation(normalized + frameRotation);
394
+ if (canvasRotationToApply === 90) {
393
395
  ctx.translate(width, 0);
394
- } else if (normalized === 180) {
396
+ } else if (canvasRotationToApply === 180) {
395
397
  ctx.translate(width, height);
396
- } else if (normalized === 270) {
398
+ } else if (canvasRotationToApply === 270) {
397
399
  ctx.translate(0, height);
398
400
  }
399
- if (normalized !== 0) {
400
- ctx.rotate(normalized * (Math.PI / 180));
401
+ if (canvasRotationToApply !== 0) {
402
+ ctx.rotate(canvasRotationToApply * (Math.PI / 180));
401
403
  }
402
404
  if (frame.displayHeight !== height || frame.displayWidth !== width) {
403
405
  const dimensionsAfterRotate = calculateNewDimensionsFromRotate({
@@ -7,7 +7,7 @@ const normalizeVideoRotation = (rotation) => {
7
7
  };
8
8
  exports.normalizeVideoRotation = normalizeVideoRotation;
9
9
  const rotateAndResizeVideoFrame = ({ frame, rotation, needsToBeMultipleOfTwo = false, resizeOperation, }) => {
10
- const normalized = ((rotation % 360) + 360) % 360;
10
+ const normalized = (0, exports.normalizeVideoRotation)(rotation);
11
11
  // No resize, no rotation
12
12
  if (normalized === 0 && resizeOperation === null) {
13
13
  return frame;
@@ -35,17 +35,20 @@ const rotateAndResizeVideoFrame = ({ frame, rotation, needsToBeMultipleOfTwo = f
35
35
  }
36
36
  canvas.width = width;
37
37
  canvas.height = height;
38
- if (normalized === 90) {
38
+ // @ts-expect-error
39
+ const frameRotation = frame.rotation ?? 0;
40
+ const canvasRotationToApply = (0, exports.normalizeVideoRotation)(normalized + frameRotation);
41
+ if (canvasRotationToApply === 90) {
39
42
  ctx.translate(width, 0);
40
43
  }
41
- else if (normalized === 180) {
44
+ else if (canvasRotationToApply === 180) {
42
45
  ctx.translate(width, height);
43
46
  }
44
- else if (normalized === 270) {
47
+ else if (canvasRotationToApply === 270) {
45
48
  ctx.translate(0, height);
46
49
  }
47
- if (normalized !== 0) {
48
- ctx.rotate(normalized * (Math.PI / 180));
50
+ if (canvasRotationToApply !== 0) {
51
+ ctx.rotate(canvasRotationToApply * (Math.PI / 180));
49
52
  }
50
53
  if (frame.displayHeight !== height || frame.displayWidth !== width) {
51
54
  const dimensionsAfterRotate = (0, rotation_1.calculateNewDimensionsFromRotate)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/webcodecs",
3
- "version": "4.0.325",
3
+ "version": "4.0.327",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/esm/index.mjs",
@@ -19,8 +19,8 @@
19
19
  "author": "Jonny Burger <jonny@remotion.dev>",
20
20
  "license": "Remotion License (See https://remotion.dev/docs/webcodecs#license)",
21
21
  "dependencies": {
22
- "@remotion/media-parser": "4.0.325",
23
- "@remotion/licensing": "4.0.325"
22
+ "@remotion/media-parser": "4.0.327",
23
+ "@remotion/licensing": "4.0.327"
24
24
  },
25
25
  "peerDependencies": {},
26
26
  "devDependencies": {
@@ -29,8 +29,8 @@
29
29
  "vite": "5.4.19",
30
30
  "@playwright/test": "1.51.1",
31
31
  "eslint": "9.19.0",
32
- "@remotion/example-videos": "4.0.325",
33
- "@remotion/eslint-config-internal": "4.0.325"
32
+ "@remotion/example-videos": "4.0.327",
33
+ "@remotion/eslint-config-internal": "4.0.327"
34
34
  },
35
35
  "keywords": [],
36
36
  "publishConfig": {