remotion 3.3.82 → 3.3.83

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.
@@ -139,6 +139,11 @@ declare global {
139
139
  * Default: 'swangle' in Lambda, null elsewhere.
140
140
  */
141
141
  readonly setChromiumOpenGlRenderer: (renderer: 'swangle' | 'angle' | 'egl' | 'swiftshader') => void;
142
+ /**
143
+ * Set the user agent for Chrome. Only works during rendering.
144
+ * Default:
145
+ */
146
+ readonly setChromiumUserAgent: (userAgent: string | null) => void;
142
147
  };
143
148
  /**
144
149
  * @deprecated New flat config format: You can now replace `Config.Rendering.` with `Config.`
@@ -1 +1 @@
1
- export declare const VERSION = "3.3.82";
1
+ export declare const VERSION = "3.3.83";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Automatically generated on publish
5
- exports.VERSION = '3.3.82';
5
+ exports.VERSION = '3.3.83';
@@ -13,19 +13,20 @@ const getMediaTime = ({ fps, frame, src, playbackRate, startFrom, mediaType, })
13
13
  playbackRate,
14
14
  startFrom,
15
15
  });
16
- if (src.endsWith('webm')) {
17
- // For WebM videos, we need to add a little bit of shift to get the right frame.
18
- const msPerFrame = 1000 / fps;
19
- const msShift = msPerFrame / 2;
20
- return (expectedFrame * msPerFrame + msShift) / 1000;
21
- }
22
- if (mediaType === 'video') {
16
+ const isChrome = typeof window !== 'undefined' &&
17
+ window.navigator.userAgent.match(/Chrome\/([0-9]+)/);
18
+ if (isChrome &&
19
+ Number(isChrome[1]) < 112 &&
20
+ mediaType === 'video' &&
21
+ src.endsWith('.mp4')) {
23
22
  // In Chrome, for MP4s, if 30fps, the first frame is still displayed at 0.033333
24
23
  // even though after that it increases by 0.033333333 each.
25
24
  // So frame = 0 in Remotion is like frame = 1 for the browser
26
25
  return (expectedFrame + 1) / fps;
27
26
  }
28
- // For audio, we don't do any shift correction
29
- return expectedFrame / fps;
27
+ // For WebM videos, we need to add a little bit of shift to get the right frame.
28
+ const msPerFrame = 1000 / fps;
29
+ const msShift = msPerFrame / 2;
30
+ return (expectedFrame * msPerFrame + msShift) / 1000;
30
31
  };
31
32
  exports.getMediaTime = getMediaTime;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export declare const REMOTION_COLOR_BRAND = "__remotion-color";
3
+ export declare const parseColor: (value: string) => {
4
+ a: number;
5
+ r: number;
6
+ g: number;
7
+ b: number;
8
+ };
9
+ export declare const zColor: () => z.ZodEffects<z.ZodString, string, string>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.zColor = exports.parseColor = exports.REMOTION_COLOR_BRAND = void 0;
4
+ const zod_1 = require("zod");
5
+ const interpolate_colors_js_1 = require("./interpolate-colors.js");
6
+ exports.REMOTION_COLOR_BRAND = '__remotion-color';
7
+ const parseColor = (value) => {
8
+ const colored = (0, interpolate_colors_js_1.processColor)(value).toString(16).padStart(8, '0');
9
+ const opacity = parseInt(colored.slice(0, 2), 16);
10
+ const r = parseInt(colored.slice(2, 4), 16);
11
+ const g = parseInt(colored.slice(4, 6), 16);
12
+ const b = parseInt(colored.slice(6, 8), 16);
13
+ return { a: opacity, r, g, b };
14
+ };
15
+ exports.parseColor = parseColor;
16
+ const zColor = () => zod_1.z
17
+ .string()
18
+ .refine((value) => {
19
+ try {
20
+ (0, exports.parseColor)(value);
21
+ return true;
22
+ }
23
+ catch (err) {
24
+ return false;
25
+ }
26
+ }, { message: 'Invalid color' })
27
+ .describe(exports.REMOTION_COLOR_BRAND);
28
+ exports.zColor = zColor;
@@ -58,7 +58,7 @@ function truthy(value) {
58
58
  }
59
59
 
60
60
  // Automatically generated on publish
61
- const VERSION = '3.3.82';
61
+ const VERSION = '3.3.83';
62
62
 
63
63
  const checkMultipleRemotionVersions = () => {
64
64
  if (typeof globalThis === 'undefined') {
@@ -1197,20 +1197,21 @@ const getMediaTime = ({ fps, frame, src, playbackRate, startFrom, mediaType, })
1197
1197
  playbackRate,
1198
1198
  startFrom,
1199
1199
  });
1200
- if (src.endsWith('webm')) {
1201
- // For WebM videos, we need to add a little bit of shift to get the right frame.
1202
- const msPerFrame = 1000 / fps;
1203
- const msShift = msPerFrame / 2;
1204
- return (expectedFrame * msPerFrame + msShift) / 1000;
1205
- }
1206
- if (mediaType === 'video') {
1200
+ const isChrome = typeof window !== 'undefined' &&
1201
+ window.navigator.userAgent.match(/Chrome\/([0-9]+)/);
1202
+ if (isChrome &&
1203
+ Number(isChrome[1]) < 112 &&
1204
+ mediaType === 'video' &&
1205
+ src.endsWith('.mp4')) {
1207
1206
  // In Chrome, for MP4s, if 30fps, the first frame is still displayed at 0.033333
1208
1207
  // even though after that it increases by 0.033333333 each.
1209
1208
  // So frame = 0 in Remotion is like frame = 1 for the browser
1210
1209
  return (expectedFrame + 1) / fps;
1211
1210
  }
1212
- // For audio, we don't do any shift correction
1213
- return expectedFrame / fps;
1211
+ // For WebM videos, we need to add a little bit of shift to get the right frame.
1212
+ const msPerFrame = 1000 / fps;
1213
+ const msShift = msPerFrame / 2;
1214
+ return (expectedFrame * msPerFrame + msShift) / 1000;
1214
1215
  };
1215
1216
 
1216
1217
  const alreadyWarned = {};
@@ -1,4 +1,4 @@
1
1
  // Automatically generated on publish
2
- const VERSION = '3.3.82';
2
+ const VERSION = '3.3.83';
3
3
 
4
4
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "3.3.82",
3
+ "version": "3.3.83",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",