remotion 4.0.10 → 4.0.12

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/dist/cjs/Img.js CHANGED
@@ -65,7 +65,7 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
65
65
  if (process.env.NODE_ENV === 'test') {
66
66
  return;
67
67
  }
68
- const newHandle = (0, delay_render_js_1.delayRender)('Loading <Img> with src=' + src);
68
+ const newHandle = (0, delay_render_js_1.delayRender)('Loading <Img> with src=' + actualSrc);
69
69
  const { current } = imageRef;
70
70
  const onComplete = () => {
71
71
  var _a, _b, _c, _d;
@@ -89,7 +89,7 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
89
89
  current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
90
90
  (0, delay_render_js_1.continueRender)(newHandle);
91
91
  };
92
- }, [src]);
92
+ }, [actualSrc]);
93
93
  }
94
94
  return ((0, jsx_runtime_1.jsx)("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
95
95
  };
@@ -7,7 +7,9 @@ if (typeof window !== 'undefined') {
7
7
  window.remotion_renderReady = false;
8
8
  }
9
9
  let handles = [];
10
- const timeouts = {};
10
+ if (typeof window !== 'undefined') {
11
+ window.remotion_delayRenderTimeouts = {};
12
+ }
11
13
  exports.DELAY_RENDER_CALLSTACK_TOKEN = 'The delayRender was called:';
12
14
  const defaultTimeout = 30000;
13
15
  /**
@@ -29,18 +31,23 @@ const delayRender = (label) => {
29
31
  const timeoutToUse = typeof window === 'undefined'
30
32
  ? defaultTimeout
31
33
  : ((_c = window.remotion_puppeteerTimeout) !== null && _c !== void 0 ? _c : defaultTimeout) - 2000;
32
- timeouts[handle] = setTimeout(() => {
33
- const message = [
34
- `A delayRender()`,
35
- label ? `"${label}"` : null,
36
- `was called but not cleared after ${timeoutToUse}ms. See https://remotion.dev/docs/timeout for help.`,
37
- exports.DELAY_RENDER_CALLSTACK_TOKEN,
38
- called,
39
- ]
40
- .filter(truthy_js_1.truthy)
41
- .join(' ');
42
- throw new Error(message);
43
- }, timeoutToUse);
34
+ if (typeof window !== 'undefined') {
35
+ window.remotion_delayRenderTimeouts[handle] = {
36
+ label: label !== null && label !== void 0 ? label : null,
37
+ timeout: setTimeout(() => {
38
+ const message = [
39
+ `A delayRender()`,
40
+ label ? `"${label}"` : null,
41
+ `was called but not cleared after ${timeoutToUse}ms. See https://remotion.dev/docs/timeout for help.`,
42
+ exports.DELAY_RENDER_CALLSTACK_TOKEN,
43
+ called,
44
+ ]
45
+ .filter(truthy_js_1.truthy)
46
+ .join(' ');
47
+ throw new Error(message);
48
+ }, timeoutToUse),
49
+ };
50
+ }
44
51
  }
45
52
  if (typeof window !== 'undefined') {
46
53
  window.remotion_renderReady = false;
@@ -64,7 +71,8 @@ const continueRender = (handle) => {
64
71
  handles = handles.filter((h) => {
65
72
  if (h === handle) {
66
73
  if ((0, get_environment_js_1.getRemotionEnvironment)() === 'rendering') {
67
- clearTimeout(timeouts[handle]);
74
+ clearTimeout(window.remotion_delayRenderTimeouts[handle].timeout);
75
+ delete window.remotion_delayRenderTimeouts[handle];
68
76
  }
69
77
  return false;
70
78
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import './asset-types.js';
2
3
  import type { TAsset } from './CompositionManager.js';
3
4
  import type { StaticFile } from './get-static-files.js';
@@ -6,6 +7,12 @@ import type { VideoConfig } from './video-config.js';
6
7
  declare global {
7
8
  interface Window {
8
9
  remotion_renderReady: boolean;
10
+ remotion_delayRenderTimeouts: {
11
+ [key: string]: {
12
+ label: string | null;
13
+ timeout: number | NodeJS.Timeout;
14
+ };
15
+ };
9
16
  remotion_cancelledError: string | undefined;
10
17
  remotion_getCompositionNames: () => string[];
11
18
  getStaticCompositions: () => Promise<VideoConfig[]>;
@@ -34,7 +41,7 @@ declare global {
34
41
  remotion_isPlayer: boolean;
35
42
  remotion_isBuilding: undefined | (() => void);
36
43
  remotion_finishedBuilding: undefined | (() => void);
37
- siteVersion: '8';
44
+ siteVersion: '9';
38
45
  remotion_version: string;
39
46
  remotion_imported: string | boolean;
40
47
  }
@@ -5,6 +5,7 @@ export type SerializedJSONWithCustomFields = {
5
5
  mapUsed: boolean;
6
6
  setUsed: boolean;
7
7
  };
8
+ export declare const DATE_TOKEN = "remotion-date:";
8
9
  export declare const FILE_TOKEN = "remotion-file:";
9
10
  export declare const serializeJSONWithDate: ({ data, indent, staticBase, }: {
10
11
  data: Record<string, unknown>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  // Must keep this file in sync with the one in packages/lambda/src/shared/serialize-props.ts!
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.deserializeJSONWithCustomFields = exports.serializeJSONWithDate = exports.FILE_TOKEN = void 0;
4
+ exports.deserializeJSONWithCustomFields = exports.serializeJSONWithDate = exports.FILE_TOKEN = exports.DATE_TOKEN = void 0;
5
5
  const static_file_js_1 = require("./static-file.js");
6
- const DATE_TOKEN = 'remotion-date:';
6
+ exports.DATE_TOKEN = 'remotion-date:';
7
7
  exports.FILE_TOKEN = 'remotion-file:';
8
8
  const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
9
9
  let customDateUsed = false;
@@ -14,7 +14,7 @@ const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
14
14
  const item = this[key];
15
15
  if (item instanceof Date) {
16
16
  customDateUsed = true;
17
- return `${DATE_TOKEN}${item.toISOString()}`;
17
+ return `${exports.DATE_TOKEN}${item.toISOString()}`;
18
18
  }
19
19
  if (item instanceof Map) {
20
20
  mapUsed = true;
@@ -37,8 +37,8 @@ const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
37
37
  exports.serializeJSONWithDate = serializeJSONWithDate;
38
38
  const deserializeJSONWithCustomFields = (data) => {
39
39
  return JSON.parse(data, (_, value) => {
40
- if (typeof value === 'string' && value.startsWith(DATE_TOKEN)) {
41
- return new Date(value.replace(DATE_TOKEN, ''));
40
+ if (typeof value === 'string' && value.startsWith(exports.DATE_TOKEN)) {
41
+ return new Date(value.replace(exports.DATE_TOKEN, ''));
42
42
  }
43
43
  if (typeof value === 'string' && value.startsWith(exports.FILE_TOKEN)) {
44
44
  return (0, static_file_js_1.staticFile)(value.replace(exports.FILE_TOKEN, ''));
@@ -138,6 +138,7 @@ export declare const Internals: {
138
138
  }) => SerializedJSONWithCustomFields;
139
139
  readonly deserializeJSONWithCustomFields: (data: string) => Record<string, unknown>;
140
140
  readonly FILE_TOKEN: "remotion-file:";
141
+ readonly DATE_TOKEN: "remotion-date:";
141
142
  readonly NativeLayersProvider: import("react").FC<{
142
143
  children?: import("react").ReactNode;
143
144
  }>;
@@ -127,6 +127,7 @@ exports.Internals = {
127
127
  serializeJSONWithDate: input_props_serialization_js_1.serializeJSONWithDate,
128
128
  deserializeJSONWithCustomFields: input_props_serialization_js_1.deserializeJSONWithCustomFields,
129
129
  FILE_TOKEN: input_props_serialization_js_1.FILE_TOKEN,
130
+ DATE_TOKEN: input_props_serialization_js_1.DATE_TOKEN,
130
131
  NativeLayersProvider: NativeLayers_js_1.NativeLayersProvider,
131
132
  ClipComposition: Composition_js_1.ClipComposition,
132
133
  };
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.10";
1
+ export declare const VERSION = "4.0.12";
@@ -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 = '4.0.10';
5
+ exports.VERSION = '4.0.12';
@@ -6,6 +6,7 @@ const react_1 = require("react");
6
6
  const absolute_src_js_1 = require("../absolute-src.js");
7
7
  const AssetManager_js_1 = require("../AssetManager.js");
8
8
  const use_audio_frame_js_1 = require("../audio/use-audio-frame.js");
9
+ const cancel_render_js_1 = require("../cancel-render.js");
9
10
  const default_css_js_1 = require("../default-css.js");
10
11
  const Img_js_1 = require("../Img.js");
11
12
  const random_js_1 = require("../random.js");
@@ -91,8 +92,13 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
91
92
  return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent((0, absolute_src_js_1.getAbsoluteSrc)(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}`;
92
93
  }, [currentTime, src, transparent]);
93
94
  const onErr = (0, react_1.useCallback)((e) => {
94
- onError === null || onError === void 0 ? void 0 : onError(e);
95
- }, [onError]);
95
+ if (onError) {
96
+ onError === null || onError === void 0 ? void 0 : onError(e);
97
+ }
98
+ else {
99
+ (0, cancel_render_js_1.cancelRender)('Failed to load image with src ' + actualSrc);
100
+ }
101
+ }, [actualSrc, onError]);
96
102
  const className = (0, react_1.useMemo)(() => {
97
103
  return [default_css_js_1.OFFTHREAD_VIDEO_CLASS_NAME, props.className]
98
104
  .filter(truthy_js_1.truthy)
@@ -59,7 +59,7 @@ function truthy(value) {
59
59
  }
60
60
 
61
61
  // Automatically generated on publish
62
- const VERSION = '4.0.10';
62
+ const VERSION = '4.0.12';
63
63
 
64
64
  const checkMultipleRemotionVersions = () => {
65
65
  if (typeof globalThis === 'undefined') {
@@ -2240,7 +2240,9 @@ if (typeof window !== 'undefined') {
2240
2240
  window.remotion_renderReady = false;
2241
2241
  }
2242
2242
  let handles = [];
2243
- const timeouts = {};
2243
+ if (typeof window !== 'undefined') {
2244
+ window.remotion_delayRenderTimeouts = {};
2245
+ }
2244
2246
  const DELAY_RENDER_CALLSTACK_TOKEN = 'The delayRender was called:';
2245
2247
  const defaultTimeout = 30000;
2246
2248
  /**
@@ -2262,18 +2264,23 @@ const delayRender = (label) => {
2262
2264
  const timeoutToUse = typeof window === 'undefined'
2263
2265
  ? defaultTimeout
2264
2266
  : ((_c = window.remotion_puppeteerTimeout) !== null && _c !== void 0 ? _c : defaultTimeout) - 2000;
2265
- timeouts[handle] = setTimeout(() => {
2266
- const message = [
2267
- `A delayRender()`,
2268
- label ? `"${label}"` : null,
2269
- `was called but not cleared after ${timeoutToUse}ms. See https://remotion.dev/docs/timeout for help.`,
2270
- DELAY_RENDER_CALLSTACK_TOKEN,
2271
- called,
2272
- ]
2273
- .filter(truthy)
2274
- .join(' ');
2275
- throw new Error(message);
2276
- }, timeoutToUse);
2267
+ if (typeof window !== 'undefined') {
2268
+ window.remotion_delayRenderTimeouts[handle] = {
2269
+ label: label !== null && label !== void 0 ? label : null,
2270
+ timeout: setTimeout(() => {
2271
+ const message = [
2272
+ `A delayRender()`,
2273
+ label ? `"${label}"` : null,
2274
+ `was called but not cleared after ${timeoutToUse}ms. See https://remotion.dev/docs/timeout for help.`,
2275
+ DELAY_RENDER_CALLSTACK_TOKEN,
2276
+ called,
2277
+ ]
2278
+ .filter(truthy)
2279
+ .join(' ');
2280
+ throw new Error(message);
2281
+ }, timeoutToUse),
2282
+ };
2283
+ }
2277
2284
  }
2278
2285
  if (typeof window !== 'undefined') {
2279
2286
  window.remotion_renderReady = false;
@@ -2296,7 +2303,8 @@ const continueRender = (handle) => {
2296
2303
  handles = handles.filter((h) => {
2297
2304
  if (h === handle) {
2298
2305
  if (getRemotionEnvironment() === 'rendering') {
2299
- clearTimeout(timeouts[handle]);
2306
+ clearTimeout(window.remotion_delayRenderTimeouts[handle].timeout);
2307
+ delete window.remotion_delayRenderTimeouts[handle];
2300
2308
  }
2301
2309
  return false;
2302
2310
  }
@@ -3018,7 +3026,7 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
3018
3026
  if (process.env.NODE_ENV === 'test') {
3019
3027
  return;
3020
3028
  }
3021
- const newHandle = delayRender('Loading <Img> with src=' + src);
3029
+ const newHandle = delayRender('Loading <Img> with src=' + actualSrc);
3022
3030
  const { current } = imageRef;
3023
3031
  const onComplete = () => {
3024
3032
  var _a, _b, _c, _d;
@@ -3042,7 +3050,7 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
3042
3050
  current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
3043
3051
  continueRender(newHandle);
3044
3052
  };
3045
- }, [src]);
3053
+ }, [actualSrc]);
3046
3054
  }
3047
3055
  return (jsx("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
3048
3056
  };
@@ -3836,6 +3844,7 @@ const Internals = {
3836
3844
  serializeJSONWithDate,
3837
3845
  deserializeJSONWithCustomFields,
3838
3846
  FILE_TOKEN,
3847
+ DATE_TOKEN,
3839
3848
  NativeLayersProvider,
3840
3849
  ClipComposition,
3841
3850
  };
@@ -4247,8 +4256,13 @@ const OffthreadVideoForRendering = ({ onError, volume: volumeProp, playbackRate,
4247
4256
  return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(getAbsoluteSrc(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}`;
4248
4257
  }, [currentTime, src, transparent]);
4249
4258
  const onErr = useCallback((e) => {
4250
- onError === null || onError === void 0 ? void 0 : onError(e);
4251
- }, [onError]);
4259
+ if (onError) {
4260
+ onError === null || onError === void 0 ? void 0 : onError(e);
4261
+ }
4262
+ else {
4263
+ cancelRender('Failed to load image with src ' + actualSrc);
4264
+ }
4265
+ }, [actualSrc, onError]);
4252
4266
  const className = useMemo(() => {
4253
4267
  return [OFFTHREAD_VIDEO_CLASS_NAME, props.className]
4254
4268
  .filter(truthy)
@@ -1,4 +1,4 @@
1
1
  // Automatically generated on publish
2
- const VERSION = '4.0.10';
2
+ const VERSION = '4.0.12';
3
3
 
4
4
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "4.0.10",
3
+ "version": "4.0.12",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",