remotion 4.0.447 → 4.0.449

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.
@@ -24,6 +24,7 @@ export type CalcMetadataReturnType<T extends Record<string, unknown>> = {
24
24
  defaultVideoImageFormat?: VideoImageFormat;
25
25
  defaultPixelFormat?: PixelFormat;
26
26
  defaultProResProfile?: ProResProfile;
27
+ defaultSampleRate?: number;
27
28
  };
28
29
  export type CalculateMetadataFunction<T extends Record<string, unknown>> = (options: {
29
30
  defaultProps: T;
@@ -4,7 +4,7 @@ import type { AnyComposition, TComposition } from './CompositionManager.js';
4
4
  import type { TFolder } from './Folder.js';
5
5
  import type { NonceHistory } from './nonce.js';
6
6
  import type { VideoConfig } from './video-config.js';
7
- export type BaseMetadata = Pick<VideoConfig, 'durationInFrames' | 'fps' | 'props' | 'height' | 'width' | 'defaultCodec' | 'defaultOutName' | 'defaultVideoImageFormat' | 'defaultPixelFormat' | 'defaultProResProfile'>;
7
+ export type BaseMetadata = Pick<VideoConfig, 'durationInFrames' | 'fps' | 'props' | 'height' | 'width' | 'defaultCodec' | 'defaultOutName' | 'defaultVideoImageFormat' | 'defaultPixelFormat' | 'defaultProResProfile' | 'defaultSampleRate'>;
8
8
  export type CanvasContent = {
9
9
  type: 'composition';
10
10
  compositionId: string;
package/dist/cjs/Img.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ export declare function truncateSrcForLabel(src: string): string;
2
3
  type NativeImgProps = Omit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, 'src'>;
3
4
  export type ImgProps = NativeImgProps & {
4
5
  readonly maxRetries?: number;
package/dist/cjs/Img.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Img = void 0;
4
+ exports.truncateSrcForLabel = truncateSrcForLabel;
4
5
  const jsx_runtime_1 = require("react/jsx-runtime");
5
6
  const react_1 = require("react");
6
7
  const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
@@ -15,6 +16,14 @@ const wrap_in_schema_js_1 = require("./wrap-in-schema.js");
15
16
  function exponentialBackoff(errorCount) {
16
17
  return 1000 * 2 ** (errorCount - 1);
17
18
  }
19
+ // Data URLs like the ones from canvas.toDataURL() can be many megabytes, which makes the delayRender() label
20
+ // unreadable and bloats log output
21
+ function truncateSrcForLabel(src) {
22
+ if (src.startsWith('data:') && src.length > 100) {
23
+ return src.slice(0, 60) + '...[' + src.length + ' chars total]';
24
+ }
25
+ return src;
26
+ }
18
27
  const imgSchema = {
19
28
  'style.translate': {
20
29
  type: 'translate',
@@ -110,12 +119,13 @@ const ImgInner = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRenderR
110
119
  if (((_g = errors.current[(_f = imageRef.current) === null || _f === void 0 ? void 0 : _f.src]) !== null && _g !== void 0 ? _g : 0) <= maxRetries) {
111
120
  const backoff = exponentialBackoff((_j = errors.current[(_h = imageRef.current) === null || _h === void 0 ? void 0 : _h.src]) !== null && _j !== void 0 ? _j : 0);
112
121
  // eslint-disable-next-line no-console
113
- console.warn(`Could not load image with source ${(_k = imageRef.current) === null || _k === void 0 ? void 0 : _k.src}, retrying again in ${backoff}ms`);
122
+ console.warn(`Could not load image with source ${truncateSrcForLabel((_k = imageRef.current) === null || _k === void 0 ? void 0 : _k.src)}, retrying again in ${backoff}ms`);
114
123
  retryIn(backoff);
115
124
  return;
116
125
  }
117
126
  try {
118
- cancelRender('Error loading image with src: ' + ((_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src));
127
+ cancelRender('Error loading image with src: ' +
128
+ truncateSrcForLabel((_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src));
119
129
  }
120
130
  catch (_m) {
121
131
  // cancelRender() intentionally throws after storing the error in scope.
@@ -138,7 +148,7 @@ const ImgInner = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRenderR
138
148
  if (!current) {
139
149
  return;
140
150
  }
141
- const newHandle = delayRender('Loading <Img> with src=' + actualSrc, {
151
+ const newHandle = delayRender('Loading <Img> with src=' + truncateSrcForLabel(actualSrc), {
142
152
  retries: delayRenderRetries !== null && delayRenderRetries !== void 0 ? delayRenderRetries : undefined,
143
153
  timeoutInMilliseconds: delayRenderTimeoutInMilliseconds !== null && delayRenderTimeoutInMilliseconds !== void 0 ? delayRenderTimeoutInMilliseconds : undefined,
144
154
  });
@@ -156,7 +166,7 @@ const ImgInner = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRenderR
156
166
  if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
157
167
  delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
158
168
  // eslint-disable-next-line no-console
159
- console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
169
+ console.info(`Retry successful - ${truncateSrcForLabel((_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src)} is now loaded`);
160
170
  }
161
171
  if (current) {
162
172
  onImageFrame === null || onImageFrame === void 0 ? void 0 : onImageFrame(current);
@@ -75,6 +75,7 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
75
75
  defaultVideoImageFormat: null,
76
76
  defaultPixelFormat: null,
77
77
  defaultProResProfile: null,
78
+ defaultSampleRate: null,
78
79
  },
79
80
  };
80
81
  }
@@ -55,6 +55,7 @@ declare global {
55
55
  remotion_envVariables: string;
56
56
  remotion_isMainTab: boolean;
57
57
  remotion_mediaCacheSizeInBytes: number | null;
58
+ remotion_sampleRate: number;
58
59
  remotion_initialMemoryAvailable: number | null;
59
60
  remotion_collectAssets: () => TRenderAsset[];
60
61
  remotion_isPlayer: boolean;
@@ -80,6 +81,7 @@ export type BundleCompositionState = {
80
81
  compositionDefaultVideoImageFormat: VideoImageFormat | null;
81
82
  compositionDefaultPixelFormat: PixelFormat | null;
82
83
  compositionDefaultProResProfile: ProResProfile | null;
84
+ compositionDefaultSampleRate: number | null;
83
85
  };
84
86
  export type BundleIndexState = {
85
87
  type: 'index';
@@ -28,6 +28,7 @@ const validateCalculated = ({ calculated, compositionId, compositionFps, composi
28
28
  const defaultVideoImageFormat = calculated === null || calculated === void 0 ? void 0 : calculated.defaultVideoImageFormat;
29
29
  const defaultPixelFormat = calculated === null || calculated === void 0 ? void 0 : calculated.defaultPixelFormat;
30
30
  const defaultProResProfile = calculated === null || calculated === void 0 ? void 0 : calculated.defaultProResProfile;
31
+ const defaultSampleRate = calculated === null || calculated === void 0 ? void 0 : calculated.defaultSampleRate;
31
32
  return {
32
33
  width,
33
34
  height,
@@ -38,10 +39,11 @@ const validateCalculated = ({ calculated, compositionId, compositionFps, composi
38
39
  defaultVideoImageFormat,
39
40
  defaultPixelFormat,
40
41
  defaultProResProfile,
42
+ defaultSampleRate,
41
43
  };
42
44
  };
43
45
  const resolveVideoConfig = ({ calculateMetadata, signal, defaultProps, inputProps: originalProps, compositionId, compositionDurationInFrames, compositionFps, compositionHeight, compositionWidth, }) => {
44
- var _a, _b, _c, _d, _e, _f;
46
+ var _a, _b, _c, _d, _e, _f, _g;
45
47
  const calculatedProm = calculateMetadata
46
48
  ? calculateMetadata({
47
49
  defaultProps,
@@ -56,7 +58,7 @@ const resolveVideoConfig = ({ calculateMetadata, signal, defaultProps, inputProp
56
58
  'then' in calculatedProm) {
57
59
  return calculatedProm.then((c) => {
58
60
  var _a;
59
- const { height, width, durationInFrames, fps, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile, } = validateCalculated({
61
+ const { height, width, durationInFrames, fps, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile, defaultSampleRate, } = validateCalculated({
60
62
  calculated: c,
61
63
  compositionDurationInFrames,
62
64
  compositionFps,
@@ -77,6 +79,7 @@ const resolveVideoConfig = ({ calculateMetadata, signal, defaultProps, inputProp
77
79
  defaultVideoImageFormat: defaultVideoImageFormat !== null && defaultVideoImageFormat !== void 0 ? defaultVideoImageFormat : null,
78
80
  defaultPixelFormat: defaultPixelFormat !== null && defaultPixelFormat !== void 0 ? defaultPixelFormat : null,
79
81
  defaultProResProfile: defaultProResProfile !== null && defaultProResProfile !== void 0 ? defaultProResProfile : null,
82
+ defaultSampleRate: defaultSampleRate !== null && defaultSampleRate !== void 0 ? defaultSampleRate : null,
80
83
  };
81
84
  });
82
85
  }
@@ -99,6 +102,7 @@ const resolveVideoConfig = ({ calculateMetadata, signal, defaultProps, inputProp
99
102
  defaultVideoImageFormat: null,
100
103
  defaultPixelFormat: null,
101
104
  defaultProResProfile: null,
105
+ defaultSampleRate: null,
102
106
  };
103
107
  }
104
108
  return {
@@ -111,6 +115,7 @@ const resolveVideoConfig = ({ calculateMetadata, signal, defaultProps, inputProp
111
115
  defaultVideoImageFormat: (_d = calculatedProm.defaultVideoImageFormat) !== null && _d !== void 0 ? _d : null,
112
116
  defaultPixelFormat: (_e = calculatedProm.defaultPixelFormat) !== null && _e !== void 0 ? _e : null,
113
117
  defaultProResProfile: (_f = calculatedProm.defaultProResProfile) !== null && _f !== void 0 ? _f : null,
118
+ defaultSampleRate: (_g = calculatedProm.defaultSampleRate) !== null && _g !== void 0 ? _g : null,
114
119
  };
115
120
  };
116
121
  exports.resolveVideoConfig = resolveVideoConfig;
@@ -15,7 +15,7 @@ const useUnsafeVideoConfig = () => {
15
15
  if (!video) {
16
16
  return null;
17
17
  }
18
- const { id, durationInFrames, fps, height, width, defaultProps, props, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile, } = video;
18
+ const { id, durationInFrames, fps, height, width, defaultProps, props, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile, defaultSampleRate, } = video;
19
19
  return {
20
20
  id,
21
21
  width: ctxWidth !== null && ctxWidth !== void 0 ? ctxWidth : width,
@@ -29,6 +29,7 @@ const useUnsafeVideoConfig = () => {
29
29
  defaultVideoImageFormat,
30
30
  defaultPixelFormat,
31
31
  defaultProResProfile,
32
+ defaultSampleRate,
32
33
  };
33
34
  }, [ctxDuration, ctxHeight, ctxWidth, video]);
34
35
  };
@@ -3,4 +3,4 @@
3
3
  * @see [Documentation](https://remotion.dev/docs/version)
4
4
  * @returns {string} The current version of the remotion package
5
5
  */
6
- export declare const VERSION = "4.0.447";
6
+ export declare const VERSION = "4.0.449";
@@ -7,4 +7,4 @@ exports.VERSION = void 0;
7
7
  * @see [Documentation](https://remotion.dev/docs/version)
8
8
  * @returns {string} The current version of the remotion package
9
9
  */
10
- exports.VERSION = '4.0.447';
10
+ exports.VERSION = '4.0.449';
@@ -14,4 +14,5 @@ export type VideoConfig = {
14
14
  defaultVideoImageFormat: VideoImageFormat | null;
15
15
  defaultPixelFormat: PixelFormat | null;
16
16
  defaultProResProfile: ProResProfile | null;
17
+ defaultSampleRate: number | null;
17
18
  };
@@ -709,7 +709,8 @@ var useResolvedVideoConfig = (preferredCompositionId) => {
709
709
  defaultOutName: null,
710
710
  defaultVideoImageFormat: null,
711
711
  defaultPixelFormat: null,
712
- defaultProResProfile: null
712
+ defaultProResProfile: null,
713
+ defaultSampleRate: null
713
714
  }
714
715
  };
715
716
  }
@@ -1237,7 +1238,7 @@ var addSequenceStackTraces = (component) => {
1237
1238
  };
1238
1239
 
1239
1240
  // src/version.ts
1240
- var VERSION = "4.0.447";
1241
+ var VERSION = "4.0.449";
1241
1242
 
1242
1243
  // src/multiple-versions-warning.ts
1243
1244
  var checkMultipleRemotionVersions = () => {
@@ -1526,7 +1527,8 @@ var useUnsafeVideoConfig = () => {
1526
1527
  defaultOutName,
1527
1528
  defaultVideoImageFormat,
1528
1529
  defaultPixelFormat,
1529
- defaultProResProfile
1530
+ defaultProResProfile,
1531
+ defaultSampleRate
1530
1532
  } = video;
1531
1533
  return {
1532
1534
  id,
@@ -1540,7 +1542,8 @@ var useUnsafeVideoConfig = () => {
1540
1542
  defaultOutName,
1541
1543
  defaultVideoImageFormat,
1542
1544
  defaultPixelFormat,
1543
- defaultProResProfile
1545
+ defaultProResProfile,
1546
+ defaultSampleRate
1544
1547
  };
1545
1548
  }, [ctxDuration, ctxHeight, ctxWidth, video]);
1546
1549
  };
@@ -5834,6 +5837,12 @@ import { jsx as jsx24 } from "react/jsx-runtime";
5834
5837
  function exponentialBackoff(errorCount) {
5835
5838
  return 1000 * 2 ** (errorCount - 1);
5836
5839
  }
5840
+ function truncateSrcForLabel(src) {
5841
+ if (src.startsWith("data:") && src.length > 100) {
5842
+ return src.slice(0, 60) + "...[" + src.length + " chars total]";
5843
+ }
5844
+ return src;
5845
+ }
5837
5846
  var imgSchema = {
5838
5847
  "style.translate": {
5839
5848
  type: "translate",
@@ -5936,12 +5945,12 @@ var ImgInner = ({
5936
5945
  }
5937
5946
  if ((errors.current[imageRef.current?.src] ?? 0) <= maxRetries) {
5938
5947
  const backoff = exponentialBackoff(errors.current[imageRef.current?.src] ?? 0);
5939
- console.warn(`Could not load image with source ${imageRef.current?.src}, retrying again in ${backoff}ms`);
5948
+ console.warn(`Could not load image with source ${truncateSrcForLabel(imageRef.current?.src)}, retrying again in ${backoff}ms`);
5940
5949
  retryIn(backoff);
5941
5950
  return;
5942
5951
  }
5943
5952
  try {
5944
- cancelRender2("Error loading image with src: " + imageRef.current?.src);
5953
+ cancelRender2("Error loading image with src: " + truncateSrcForLabel(imageRef.current?.src));
5945
5954
  } catch {}
5946
5955
  }, [cancelRender2, maxRetries, onError, retryIn]);
5947
5956
  if (typeof window !== "undefined") {
@@ -5958,7 +5967,7 @@ var ImgInner = ({
5958
5967
  if (!current) {
5959
5968
  return;
5960
5969
  }
5961
- const newHandle = delayRender2("Loading <Img> with src=" + actualSrc, {
5970
+ const newHandle = delayRender2("Loading <Img> with src=" + truncateSrcForLabel(actualSrc), {
5962
5971
  retries: delayRenderRetries ?? undefined,
5963
5972
  timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
5964
5973
  });
@@ -5973,7 +5982,7 @@ var ImgInner = ({
5973
5982
  }
5974
5983
  if ((errors.current[imageRef.current?.src] ?? 0) > 0) {
5975
5984
  delete errors.current[imageRef.current?.src];
5976
- console.info(`Retry successful - ${imageRef.current?.src} is now loaded`);
5985
+ console.info(`Retry successful - ${truncateSrcForLabel(imageRef.current?.src)} is now loaded`);
5977
5986
  }
5978
5987
  if (current) {
5979
5988
  onImageFrame?.(current);
@@ -6381,6 +6390,7 @@ var validateCalculated = ({
6381
6390
  const defaultVideoImageFormat = calculated?.defaultVideoImageFormat;
6382
6391
  const defaultPixelFormat = calculated?.defaultPixelFormat;
6383
6392
  const defaultProResProfile = calculated?.defaultProResProfile;
6393
+ const defaultSampleRate = calculated?.defaultSampleRate;
6384
6394
  return {
6385
6395
  width,
6386
6396
  height,
@@ -6390,7 +6400,8 @@ var validateCalculated = ({
6390
6400
  defaultOutName,
6391
6401
  defaultVideoImageFormat,
6392
6402
  defaultPixelFormat,
6393
- defaultProResProfile
6403
+ defaultProResProfile,
6404
+ defaultSampleRate
6394
6405
  };
6395
6406
  };
6396
6407
  var resolveVideoConfig = ({
@@ -6422,7 +6433,8 @@ var resolveVideoConfig = ({
6422
6433
  defaultOutName,
6423
6434
  defaultVideoImageFormat,
6424
6435
  defaultPixelFormat,
6425
- defaultProResProfile
6436
+ defaultProResProfile,
6437
+ defaultSampleRate
6426
6438
  } = validateCalculated({
6427
6439
  calculated: c2,
6428
6440
  compositionDurationInFrames,
@@ -6443,7 +6455,8 @@ var resolveVideoConfig = ({
6443
6455
  defaultOutName: defaultOutName ?? null,
6444
6456
  defaultVideoImageFormat: defaultVideoImageFormat ?? null,
6445
6457
  defaultPixelFormat: defaultPixelFormat ?? null,
6446
- defaultProResProfile: defaultProResProfile ?? null
6458
+ defaultProResProfile: defaultProResProfile ?? null,
6459
+ defaultSampleRate: defaultSampleRate ?? null
6447
6460
  };
6448
6461
  });
6449
6462
  }
@@ -6465,7 +6478,8 @@ var resolveVideoConfig = ({
6465
6478
  defaultOutName: null,
6466
6479
  defaultVideoImageFormat: null,
6467
6480
  defaultPixelFormat: null,
6468
- defaultProResProfile: null
6481
+ defaultProResProfile: null,
6482
+ defaultSampleRate: null
6469
6483
  };
6470
6484
  }
6471
6485
  return {
@@ -6477,7 +6491,8 @@ var resolveVideoConfig = ({
6477
6491
  defaultOutName: calculatedProm.defaultOutName ?? null,
6478
6492
  defaultVideoImageFormat: calculatedProm.defaultVideoImageFormat ?? null,
6479
6493
  defaultPixelFormat: calculatedProm.defaultPixelFormat ?? null,
6480
- defaultProResProfile: calculatedProm.defaultProResProfile ?? null
6494
+ defaultProResProfile: calculatedProm.defaultProResProfile ?? null,
6495
+ defaultSampleRate: calculatedProm.defaultSampleRate ?? null
6481
6496
  };
6482
6497
  };
6483
6498
  var resolveVideoConfigOrCatch = (params) => {
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.447";
2
+ var VERSION = "4.0.449";
3
3
  export {
4
4
  VERSION
5
5
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/core"
4
4
  },
5
5
  "name": "remotion",
6
- "version": "4.0.447",
6
+ "version": "4.0.449",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "react-dom": "19.2.3",
36
36
  "webpack": "5.105.0",
37
37
  "zod": "4.3.6",
38
- "@remotion/eslint-config-internal": "4.0.447",
38
+ "@remotion/eslint-config-internal": "4.0.448",
39
39
  "eslint": "9.19.0",
40
40
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
41
41
  },