remotion 4.0.0-alpha13 → 4.0.0-alpha14

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.
@@ -57,7 +57,6 @@ const RemotionRoot = ({ children, numberOfAudioTags }) => {
57
57
  };
58
58
  }, [fastRefreshes]);
59
59
  (0, react_1.useEffect)(() => {
60
- // TODO: This can be moved to renderer?
61
60
  if (typeof __webpack_module__ !== 'undefined') {
62
61
  if (__webpack_module__.hot) {
63
62
  __webpack_module__.hot.addStatusHandler((status) => {
@@ -12,7 +12,7 @@ exports.ResolveCompositionContext = (0, react_1.createContext)(null);
12
12
  exports.resolveCompositionsRef = (0, react_1.createRef)();
13
13
  const ResolveCompositionConfig = ({ children }) => {
14
14
  const [currentRenderModalComposition, setCurrentRenderModalComposition] = (0, react_1.useState)(null);
15
- const { compositions, currentComposition } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
15
+ const { compositions, currentComposition, currentCompositionMetadata } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
16
16
  const selectedComposition = compositions.find((c) => c.id === currentComposition);
17
17
  const renderModalComposition = compositions.find((c) => c.id === currentRenderModalComposition);
18
18
  const { props: allEditorProps } = (0, react_1.useContext)(EditorProps_js_1.EditorPropsContext);
@@ -31,6 +31,9 @@ const ResolveCompositionConfig = ({ children }) => {
31
31
  }, [allEditorProps, renderModalComposition]);
32
32
  const doResolution = (0, react_1.useCallback)((composition, editorProps) => {
33
33
  const controller = new AbortController();
34
+ if (currentCompositionMetadata) {
35
+ return controller;
36
+ }
34
37
  const { signal } = controller;
35
38
  const promOrNot = (0, resolve_video_config_js_1.resolveVideoConfig)({ composition, editorProps, signal });
36
39
  if (typeof promOrNot === 'object' && 'then' in promOrNot) {
@@ -76,7 +79,7 @@ const ResolveCompositionConfig = ({ children }) => {
76
79
  }));
77
80
  }
78
81
  return controller;
79
- }, []);
82
+ }, [currentCompositionMetadata]);
80
83
  (0, react_1.useImperativeHandle)(exports.resolveCompositionsRef, () => {
81
84
  return {
82
85
  setCurrentRenderModalComposition: (id) => {
@@ -141,7 +144,7 @@ exports.needsResolution = needsResolution;
141
144
  const useResolvedVideoConfig = (preferredCompositionId) => {
142
145
  const context = (0, react_1.useContext)(exports.ResolveCompositionContext);
143
146
  const { props: allEditorProps } = (0, react_1.useContext)(EditorProps_js_1.EditorPropsContext);
144
- const { compositions, currentComposition } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
147
+ const { compositions, currentComposition, currentCompositionMetadata } = (0, react_1.useContext)(CompositionManagerContext_js_1.CompositionManager);
145
148
  const compositionId = preferredCompositionId !== null && preferredCompositionId !== void 0 ? preferredCompositionId : currentComposition;
146
149
  const composition = compositions.find((c) => c.id === compositionId);
147
150
  const selectedEditorProps = (0, react_1.useMemo)(() => {
@@ -149,23 +152,33 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
149
152
  return composition ? (_a = allEditorProps[composition.id]) !== null && _a !== void 0 ? _a : {} : {};
150
153
  }, [allEditorProps, composition]);
151
154
  return (0, react_1.useMemo)(() => {
152
- var _a, _b;
155
+ var _a, _b, _c;
153
156
  if (!composition) {
154
157
  return null;
155
158
  }
159
+ if (currentCompositionMetadata) {
160
+ return {
161
+ type: 'success',
162
+ result: {
163
+ ...currentCompositionMetadata,
164
+ id: composition.id,
165
+ defaultProps: (_a = currentCompositionMetadata.defaultProps) !== null && _a !== void 0 ? _a : {},
166
+ },
167
+ };
168
+ }
156
169
  if (!(0, exports.needsResolution)(composition)) {
157
170
  return {
158
171
  type: 'success',
159
172
  result: {
160
173
  ...composition,
161
174
  defaultProps: {
162
- ...((_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {}),
175
+ ...((_b = composition.defaultProps) !== null && _b !== void 0 ? _b : {}),
163
176
  ...(selectedEditorProps !== null && selectedEditorProps !== void 0 ? selectedEditorProps : {}),
164
177
  ...(typeof window === 'undefined' ||
165
178
  (0, get_environment_js_1.getRemotionEnvironment)() === 'player-development' ||
166
179
  (0, get_environment_js_1.getRemotionEnvironment)() === 'player-production'
167
180
  ? {}
168
- : (_b = (0, input_props_js_1.getInputProps)()) !== null && _b !== void 0 ? _b : {}),
181
+ : (_c = (0, input_props_js_1.getInputProps)()) !== null && _c !== void 0 ? _c : {}),
169
182
  },
170
183
  },
171
184
  };
@@ -174,6 +187,6 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
174
187
  return null;
175
188
  }
176
189
  return context[composition.id];
177
- }, [composition, context, selectedEditorProps]);
190
+ }, [composition, context, currentCompositionMetadata, selectedEditorProps]);
178
191
  };
179
192
  exports.useResolvedVideoConfig = useResolvedVideoConfig;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { TSequence } from './CompositionManager.js';
3
+ export declare type SequenceManagerContext = {
4
+ registerSequence: (seq: TSequence) => void;
5
+ unregisterSequence: (id: string) => void;
6
+ sequences: TSequence[];
7
+ };
8
+ export declare const SequenceManager: React.Context<SequenceManagerContext>;
9
+ export declare const SequenceAndAssetManagerProvider: React.FC<{
10
+ children: React.ReactNode;
11
+ }>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.SequenceAndAssetManagerProvider = exports.SequenceManager = void 0;
27
+ const jsx_runtime_1 = require("react/jsx-runtime");
28
+ const react_1 = __importStar(require("react"));
29
+ exports.SequenceManager = react_1.default.createContext({
30
+ registerSequence: () => {
31
+ throw new Error('SequenceManagerContext not initialized');
32
+ },
33
+ unregisterSequence: () => {
34
+ throw new Error('SequenceManagerContext not initialized');
35
+ },
36
+ sequences: [],
37
+ });
38
+ const SequenceAndAssetManagerProvider = ({ children }) => {
39
+ const [sequences, setSequences] = (0, react_1.useState)([]);
40
+ const registerSequence = (0, react_1.useCallback)((seq) => {
41
+ setSequences((seqs) => {
42
+ return [...seqs, seq];
43
+ });
44
+ }, []);
45
+ const unregisterSequence = (0, react_1.useCallback)((seq) => {
46
+ setSequences((seqs) => seqs.filter((s) => s.id !== seq));
47
+ }, []);
48
+ const context = (0, react_1.useMemo)(() => {
49
+ return {
50
+ registerSequence,
51
+ sequences,
52
+ unregisterSequence,
53
+ };
54
+ }, [registerSequence, sequences, unregisterSequence]);
55
+ return ((0, jsx_runtime_1.jsx)(exports.SequenceManager.Provider, { value: context, children: children }));
56
+ };
57
+ exports.SequenceAndAssetManagerProvider = SequenceAndAssetManagerProvider;
@@ -0,0 +1,294 @@
1
+ /**
2
+ * The configuration has moved to @remotion/cli.
3
+ * For the moment the type definitions are going to stay here
4
+ */
5
+ import type { Configuration } from 'webpack';
6
+ declare type Concurrency = number | null;
7
+ declare type BrowserExecutable = string | null;
8
+ declare type FrameRange = number | [number, number];
9
+ declare type FfmpegExecutable = string | null;
10
+ declare type Loop = number | null;
11
+ declare type CodecOrUndefined = 'h264' | 'h265' | 'vp8' | 'vp9' | 'mp3' | 'aac' | 'wav' | 'prores' | 'h264-mkv' | 'gif' | undefined;
12
+ declare type Crf = number | undefined;
13
+ export declare type WebpackConfiguration = Configuration;
14
+ export declare type WebpackOverrideFn = (currentConfiguration: WebpackConfiguration) => WebpackConfiguration;
15
+ declare type FlatConfig = RemotionConfigObject['Bundling'] & RemotionConfigObject['Log'] & RemotionConfigObject['Preview'] & RemotionConfigObject['Puppeteer'] & RemotionConfigObject['Output'] & RemotionConfigObject['Rendering'] & {
16
+ /**
17
+ * Set the audio codec to use for the output video.
18
+ * See the Encoding guide in the docs for defaults and available options.
19
+ */
20
+ setAudioCodec: (codec: 'pcm-16' | 'aac' | 'mp3' | 'opus') => void;
21
+ };
22
+ declare global {
23
+ interface RemotionBundlingOptions {
24
+ /**
25
+ * Specify the entry point so you don't have to specify it in the
26
+ * CLI command
27
+ */
28
+ readonly setEntryPoint: (src: string) => void;
29
+ /**
30
+ * Whether Webpack bundles should be cached to make
31
+ * subsequent renders faster. Default: true
32
+ */
33
+ readonly setCachingEnabled: (flag: boolean) => void;
34
+ /**
35
+ * Define on which port Remotion should start it's HTTP servers during preview and rendering.
36
+ * By default, Remotion will try to find a free port.
37
+ * If you specify a port, but it's not available, Remotion will throw an error.
38
+ */
39
+ readonly setPort: (port: number | undefined) => void;
40
+ /**
41
+ * Define the location of the public/ directory.
42
+ * By default it is a folder named "public" inside the current working directory.
43
+ * You can set an absolute path or a relative path that will be resolved from the closest package.json location.
44
+ */
45
+ readonly setPublicDir: (publicDir: string | null) => void;
46
+ readonly overrideWebpackConfig: (f: WebpackOverrideFn) => void;
47
+ }
48
+ interface RemotionConfigObject {
49
+ /**
50
+ * @deprecated New flat config format: You can now replace `Config.Preview.` with `Config.`
51
+ */
52
+ readonly Preview: {
53
+ /**
54
+ * Change the maximum amount of tracks that are shown in the timeline.
55
+ * @param maxTracks The maximum amount of timeline tracks that you would like to show.
56
+ * @default 15
57
+ */
58
+ readonly setMaxTimelineTracks: (maxTracks: number) => void;
59
+ /**
60
+ * Enable Keyboard shortcuts in the Remotion Preview.
61
+ * @param enabled Boolean whether to enable the keyboard shortcuts
62
+ * @default true
63
+ */
64
+ readonly setKeyboardShortcutsEnabled: (enableShortcuts: boolean) => void;
65
+ /**
66
+ * Set number of shared audio tags. https://www.remotion.dev/docs/player/autoplay#use-the-numberofsharedaudiotags-property
67
+ * @param numberOfAudioTags
68
+ * @default 0
69
+ */
70
+ readonly setNumberOfSharedAudioTags: (numberOfAudioTags: number) => void;
71
+ /**
72
+ * Enable Webpack polling instead of file system listeners for hot reloading in the preview.
73
+ * This is useful if you are using a remote directory or a virtual machine.
74
+ * @param interval
75
+ * @default null
76
+ */
77
+ readonly setWebpackPollingInMilliseconds: (interval: number | null) => void;
78
+ /**
79
+ * Whether Remotion should open a browser when starting the Preview.
80
+ * @param should
81
+ * @default true
82
+ */
83
+ readonly setShouldOpenBrowser: (should: boolean) => void;
84
+ };
85
+ /**
86
+ * @deprecated New flat config format: You can now replace `Config.Bundling.` with `Config.`
87
+ */
88
+ readonly Bundling: RemotionBundlingOptions;
89
+ /**
90
+ * @deprecated New flat config format: You can now replace `Config.Log.` with `Config.`
91
+ */
92
+ readonly Log: {
93
+ /**
94
+ * Set the log level.
95
+ * Acceptable values: 'error' | 'warning' | 'info' | 'verbose'
96
+ * Default value: 'info'
97
+ *
98
+ * Set this to 'verbose' to get browser logs and other IO.
99
+ */
100
+ readonly setLevel: (newLogLevel: 'verbose' | 'info' | 'warn' | 'error') => void;
101
+ };
102
+ /**
103
+ * @deprecated New flat config format: You can now replace `Config.Puppeteer.` with `Config.`
104
+ */
105
+ readonly Puppeteer: {
106
+ /**
107
+ * Specify executable path for the browser to use.
108
+ * Default: null, which will make Remotion find or download a version of said browser.
109
+ */
110
+ readonly setBrowserExecutable: (newBrowserExecutablePath: BrowserExecutable) => void;
111
+ /**
112
+ * Set how many milliseconds a frame may take to render before it times out.
113
+ * Default: `30000`
114
+ */
115
+ readonly setDelayRenderTimeoutInMilliseconds: (newPuppeteerTimeout: number) => void;
116
+ /**
117
+ * @deprecated Renamed to `setDelayRenderTimeoutInMilliseconds`.
118
+ * Set how many milliseconds a frame may take to render before it times out.
119
+ * Default: `30000`
120
+ */
121
+ readonly setTimeoutInMilliseconds: (newPuppeteerTimeout: number) => void;
122
+ /**
123
+ * Setting deciding whether to disable CORS and other Chrome security features.
124
+ * Default: false
125
+ */
126
+ readonly setChromiumDisableWebSecurity: (should: boolean) => void;
127
+ /**
128
+ * Setting whether to ignore any invalid SSL certificates, such as self-signed ones.
129
+ * Default: false
130
+ */
131
+ readonly setChromiumIgnoreCertificateErrors: (should: boolean) => void;
132
+ /**
133
+ * If false, will open an actual browser during rendering to observe progress.
134
+ * Default: true
135
+ */
136
+ readonly setChromiumHeadlessMode: (should: boolean) => void;
137
+ /**
138
+ * Set the OpenGL rendering backend for Chrome. Possible values: 'egl', 'angle', 'swiftshader' and 'swangle'.
139
+ * Default: 'swangle' in Lambda, null elsewhere.
140
+ */
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;
147
+ };
148
+ /**
149
+ * @deprecated New flat config format: You can now replace `Config.Rendering.` with `Config.`
150
+ */
151
+ readonly Rendering: {
152
+ /**
153
+ * Set a custom location for a .env file.
154
+ * Default: `.env`
155
+ */
156
+ readonly setDotEnvLocation: (file: string) => void;
157
+ /**
158
+ * Sets how many Puppeteer instances will work on rendering your video in parallel.
159
+ * Default: `null`, meaning half of the threads available on your CPU.
160
+ */
161
+ readonly setConcurrency: (newConcurrency: Concurrency) => void;
162
+ /**
163
+ * Set the JPEG quality for the frames.
164
+ * Must be between 0 and 100.
165
+ * Must be between 0 and 100.
166
+ * Default: 80
167
+ */
168
+ readonly setQuality: (q: number | undefined) => void;
169
+ /** Decide in which image format to render. Can be either 'jpeg' or 'png'.
170
+ * PNG is slower, but supports transparency.
171
+ */
172
+ readonly setImageFormat: (format: 'png' | 'jpeg' | 'none') => void;
173
+ /**
174
+ * Render only a subset of a video.
175
+ * Pass in a tuple [20, 30] to only render frames 20-30 into a video.
176
+ * Pass in a single number `20` to only render a single frame as an image.
177
+ * The frame count starts at 0.
178
+ */
179
+ readonly setFrameRange: (newFrameRange: FrameRange | null) => void;
180
+ /**
181
+ * Specify local ffmpeg executable.
182
+ * Default: null, which will use ffmpeg available in PATH.
183
+ */
184
+ readonly setFfmpegExecutable: (ffmpegPath: FfmpegExecutable) => void;
185
+ /**
186
+ * Specify local ffprobe executable.
187
+ * Default: null, which will use ffprobe available in PATH.
188
+ */
189
+ readonly setFfprobeExecutable: (ffprobePath: FfmpegExecutable) => void;
190
+ /**
191
+ * Scales the output dimensions by a factor.
192
+ * Default: 1.
193
+ */
194
+ readonly setScale: (newScale: number) => void;
195
+ /**
196
+ * Specify which frames should be picked for rendering a GIF
197
+ * Default: 1, which means every frame
198
+ * https://remotion.dev/docs/render-as-gif
199
+ */
200
+ readonly setEveryNthFrame: (frame: number) => void;
201
+ /**
202
+ * Specify the number of Loop a GIF should have.
203
+ * Default: null (means GIF will loop infinite)
204
+ */
205
+ readonly setNumberOfGifLoops: (newLoop: Loop) => void;
206
+ /**
207
+ * Disable audio output.
208
+ * Default: false
209
+ */
210
+ readonly setMuted: (muted: boolean) => void;
211
+ /**
212
+ * Don't render an audio track if it would be silent.
213
+ * Default: true
214
+ */
215
+ readonly setEnforceAudioTrack: (enforceAudioTrack: boolean) => void;
216
+ };
217
+ /**
218
+ * @deprecated New flat config format: You can now replace `Config.Output.` with `Config.`
219
+ */
220
+ readonly Output: {
221
+ /**
222
+ * Set the output file location string. Default: `out/{composition}.{codec}`
223
+ */
224
+ readonly setOutputLocation: (newOutputLocation: string) => void;
225
+ /**
226
+ * If the video file already exists, should Remotion overwrite
227
+ * the output? Default: true
228
+ */
229
+ readonly setOverwriteOutput: (newOverwrite: boolean) => void;
230
+ /**
231
+ * Sets the pixel format in FFMPEG.
232
+ * See https://trac.ffmpeg.org/wiki/Chroma%20Subsampling for an explanation.
233
+ * You can override this using the `--pixel-format` Cli flag.
234
+ */
235
+ readonly setPixelFormat: (format: 'yuv420p' | 'yuva420p' | 'yuv422p' | 'yuv444p' | 'yuv420p10le' | 'yuv422p10le' | 'yuv444p10le' | 'yuva444p10le') => void;
236
+ /**
237
+ * @deprecated Use setCodec() and setImageSequence() instead.
238
+ * Specify what kind of output you, either `mp4` or `png-sequence`.
239
+ */
240
+ readonly setOutputFormat: (newLegacyFormat: 'mp4' | 'png-sequence') => void;
241
+ /**
242
+ * Specify the codec for stitching the frames into a video.
243
+ * Can be `h264` (default), `h265`, `vp8` or `vp9`
244
+ */
245
+ readonly setCodec: (newCodec: CodecOrUndefined) => void;
246
+ /**
247
+ * Set the Constant Rate Factor to pass to FFMPEG.
248
+ * Lower values mean better quality, but be aware that the ranges of
249
+ * possible values greatly differs between codecs.
250
+ */
251
+ readonly setCrf: (newCrf: Crf) => void;
252
+ /**
253
+ * Set to true if don't want a video but an image sequence as the output.
254
+ */
255
+ readonly setImageSequence: (newImageSequence: boolean) => void;
256
+ /**
257
+ * Overrides the height of a composition
258
+ */
259
+ readonly overrideHeight: (newHeight: number) => void;
260
+ /**
261
+ * Overrides the width of a composition
262
+ */
263
+ readonly overrideWidth: (newWidth: number) => void;
264
+ /**
265
+ * Set the ProRes profile.
266
+ * This method is only valid if the codec has been set to 'prores'.
267
+ * Possible values: 4444-xq, 4444, hq, standard, light, proxy. Default: 'hq'
268
+ * See https://avpres.net/FFmpeg/im_ProRes.html for meaning of possible values.
269
+ */
270
+ readonly setProResProfile: (profile: '4444-xq' | '4444' | 'hq' | 'standard' | 'light' | 'proxy' | undefined) => void;
271
+ /**
272
+ * Override the arguments that Remotion passes to FFMPEG.
273
+ * Consult https://remotion.dev/docs/renderer/render-media#ffmpegoverride before using this feature.
274
+ */
275
+ readonly overrideFfmpegCommand: (command: (info: {
276
+ type: 'pre-stitcher' | 'stitcher';
277
+ args: string[];
278
+ }) => string[]) => void;
279
+ /**
280
+ * Set a target audio bitrate to be passed to FFMPEG.
281
+ */
282
+ readonly setAudioBitrate: (bitrate: string | null) => void;
283
+ /**
284
+ * Set a target video bitrate to be passed to FFMPEG.
285
+ * Mutually exclusive with setCrf().
286
+ */
287
+ readonly setVideoBitrate: (bitrate: string | null) => void;
288
+ };
289
+ }
290
+ }
291
+ export declare type ConfigType = RemotionConfigObject & FlatConfig;
292
+ export type { Concurrency };
293
+ export declare const Config: ConfigType;
294
+ export declare const enableLegacyRemotionConfig: () => void;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enableLegacyRemotionConfig = exports.Config = void 0;
4
+ const conf = {};
5
+ let enabled = false;
6
+ exports.Config = new Proxy(conf, {
7
+ get(target, prop, receiver) {
8
+ if (!enabled) {
9
+ if (typeof document !== 'undefined') {
10
+ // We are in the browser
11
+ return {};
12
+ }
13
+ throw new Error('To use the Remotion config file, you need to have @remotion/cli installed.\n- Make sure that all versions of Remotion are the same.\n- Make sure that @remotion/cli is installed.\n- Make sure Config is imported from "@remotion/cli", not "remotion".');
14
+ }
15
+ return Reflect.get(target, prop, receiver);
16
+ },
17
+ });
18
+ const enableLegacyRemotionConfig = () => {
19
+ enabled = true;
20
+ };
21
+ exports.enableLegacyRemotionConfig = enableLegacyRemotionConfig;
@@ -7,9 +7,10 @@ declare global {
7
7
  interface Window {
8
8
  remotion_renderReady: boolean;
9
9
  remotion_cancelledError: string | undefined;
10
+ remotion_getCompositionNames: () => string[];
10
11
  getStaticCompositions: () => Promise<AnyCompMetadata[]>;
11
- calculateComposition: (compId: string) => Promise<VideoConfig>;
12
- setBundleMode: (bundleMode: BundleState) => void;
12
+ remotion_calculateComposition: (compId: string) => Promise<VideoConfig>;
13
+ remotion_setBundleMode: (bundleMode: BundleState) => void;
13
14
  remotion_staticBase: string;
14
15
  remotion_staticFiles: StaticFile[];
15
16
  remotion_editorName: string | null;
@@ -35,7 +36,7 @@ declare global {
35
36
  remotion_imported: string | boolean;
36
37
  }
37
38
  }
38
- export declare type BundleState = {
39
+ export type BundleState = {
39
40
  type: 'index';
40
41
  } | {
41
42
  type: 'evaluation';
@@ -126,5 +126,6 @@ export declare const Internals: {
126
126
  }>>;
127
127
  REMOTION_STUDIO_CONTAINER_ELEMENT: string;
128
128
  AssetManager: import("react").Context<import("./AssetManager.js").AssetManagerContext>;
129
+ bundleName: string;
129
130
  };
130
131
  export type { TComposition, Timeline, TCompMetadata, TSequence, TAsset, TimelineContextValue, SetTimelineContextValue, CompProps, CompositionManagerContext, MediaVolumeContextValue, SetMediaVolumeContextValue, RemotionEnvironment, };
@@ -116,4 +116,5 @@ exports.Internals = {
116
116
  ResolveCompositionConfig: ResolveCompositionConfig_js_1.ResolveCompositionConfig,
117
117
  REMOTION_STUDIO_CONTAINER_ELEMENT: get_preview_dom_element_js_1.REMOTION_STUDIO_CONTAINER_ELEMENT,
118
118
  AssetManager: AssetManager_js_1.AssetManager,
119
+ bundleName: 'bundle.js',
119
120
  };
@@ -6,7 +6,7 @@ const get_environment_js_1 = require("./get-environment.js");
6
6
  const validate_dimensions_js_1 = require("./validation/validate-dimensions.js");
7
7
  const validate_duration_in_frames_js_1 = require("./validation/validate-duration-in-frames.js");
8
8
  const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined, signal, }) => {
9
- var _a, _b, _c, _d;
9
+ var _a, _b, _c, _d, _e;
10
10
  const calculatedProm = composition.calculateMetadata
11
11
  ? composition.calculateMetadata({
12
12
  defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
@@ -44,10 +44,17 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
44
44
  calculated: calculatedProm,
45
45
  composition,
46
46
  });
47
+ if (calculatedProm === null) {
48
+ return {
49
+ ...data,
50
+ id: composition.id,
51
+ defaultProps: (_d = composition === null || composition === void 0 ? void 0 : composition.defaultProps) !== null && _d !== void 0 ? _d : {},
52
+ };
53
+ }
47
54
  return {
48
55
  ...data,
49
56
  id: composition.id,
50
- defaultProps: ((_d = calculatedProm === null || calculatedProm === void 0 ? void 0 : calculatedProm.props) !== null && _d !== void 0 ? _d : {}),
57
+ defaultProps: ((_e = calculatedProm === null || calculatedProm === void 0 ? void 0 : calculatedProm.props) !== null && _e !== void 0 ? _e : {}),
51
58
  };
52
59
  };
53
60
  exports.resolveVideoConfig = resolveVideoConfig;
@@ -0,0 +1 @@
1
+ export declare const validateOffthreadVideoImageFormat: (input: unknown) => void;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateOffthreadVideoImageFormat = void 0;
4
+ const validateOffthreadVideoImageFormat = (input) => {
5
+ if (typeof input === 'undefined') {
6
+ return;
7
+ }
8
+ if (typeof input !== 'string') {
9
+ throw new TypeError(`<OffthreadVideo imageFormat=""> must be a string, but got ${JSON.stringify(input)} instead.`);
10
+ }
11
+ if (input !== 'png' && input !== 'jpeg') {
12
+ throw new TypeError(`<OffthreadVideo imageFormat=""> must be either "png" or "jpeg", but got ${input}`);
13
+ }
14
+ };
15
+ exports.validateOffthreadVideoImageFormat = validateOffthreadVideoImageFormat;
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.0-alpha13";
1
+ export declare const VERSION = "4.0.0-alpha14";
@@ -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.0-alpha13';
5
+ exports.VERSION = '4.0.0-alpha14';
@@ -58,7 +58,7 @@ function truthy(value) {
58
58
  }
59
59
 
60
60
  // Automatically generated on publish
61
- const VERSION = '4.0.0-alpha13';
61
+ const VERSION = '4.0.0-alpha14';
62
62
 
63
63
  const checkMultipleRemotionVersions = () => {
64
64
  if (typeof globalThis === 'undefined') {
@@ -378,7 +378,7 @@ const validateDurationInFrames = ({ allowFloats, component, durationInFrames, })
378
378
  };
379
379
 
380
380
  const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined, signal, }) => {
381
- var _a, _b, _c, _d;
381
+ var _a, _b, _c, _d, _e;
382
382
  const calculatedProm = composition.calculateMetadata
383
383
  ? composition.calculateMetadata({
384
384
  defaultProps: (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {},
@@ -416,10 +416,17 @@ const resolveVideoConfig = ({ composition, editorProps: editorPropsOrUndefined,
416
416
  calculated: calculatedProm,
417
417
  composition,
418
418
  });
419
+ if (calculatedProm === null) {
420
+ return {
421
+ ...data,
422
+ id: composition.id,
423
+ defaultProps: (_d = composition === null || composition === void 0 ? void 0 : composition.defaultProps) !== null && _d !== void 0 ? _d : {},
424
+ };
425
+ }
419
426
  return {
420
427
  ...data,
421
428
  id: composition.id,
422
- defaultProps: ((_d = calculatedProm === null || calculatedProm === void 0 ? void 0 : calculatedProm.props) !== null && _d !== void 0 ? _d : {}),
429
+ defaultProps: ((_e = calculatedProm === null || calculatedProm === void 0 ? void 0 : calculatedProm.props) !== null && _e !== void 0 ? _e : {}),
423
430
  };
424
431
  };
425
432
  const validateCalculated = ({ composition, calculated, }) => {
@@ -455,7 +462,7 @@ const ResolveCompositionContext = createContext(null);
455
462
  const resolveCompositionsRef = createRef();
456
463
  const ResolveCompositionConfig = ({ children }) => {
457
464
  const [currentRenderModalComposition, setCurrentRenderModalComposition] = useState(null);
458
- const { compositions, currentComposition } = useContext(CompositionManager);
465
+ const { compositions, currentComposition, currentCompositionMetadata } = useContext(CompositionManager);
459
466
  const selectedComposition = compositions.find((c) => c.id === currentComposition);
460
467
  const renderModalComposition = compositions.find((c) => c.id === currentRenderModalComposition);
461
468
  const { props: allEditorProps } = useContext(EditorPropsContext);
@@ -474,6 +481,9 @@ const ResolveCompositionConfig = ({ children }) => {
474
481
  }, [allEditorProps, renderModalComposition]);
475
482
  const doResolution = useCallback((composition, editorProps) => {
476
483
  const controller = new AbortController();
484
+ if (currentCompositionMetadata) {
485
+ return controller;
486
+ }
477
487
  const { signal } = controller;
478
488
  const promOrNot = resolveVideoConfig({ composition, editorProps, signal });
479
489
  if (typeof promOrNot === 'object' && 'then' in promOrNot) {
@@ -519,7 +529,7 @@ const ResolveCompositionConfig = ({ children }) => {
519
529
  }));
520
530
  }
521
531
  return controller;
522
- }, []);
532
+ }, [currentCompositionMetadata]);
523
533
  useImperativeHandle(resolveCompositionsRef, () => {
524
534
  return {
525
535
  setCurrentRenderModalComposition: (id) => {
@@ -582,7 +592,7 @@ const needsResolution = (composition) => {
582
592
  const useResolvedVideoConfig = (preferredCompositionId) => {
583
593
  const context = useContext(ResolveCompositionContext);
584
594
  const { props: allEditorProps } = useContext(EditorPropsContext);
585
- const { compositions, currentComposition } = useContext(CompositionManager);
595
+ const { compositions, currentComposition, currentCompositionMetadata } = useContext(CompositionManager);
586
596
  const compositionId = preferredCompositionId !== null && preferredCompositionId !== void 0 ? preferredCompositionId : currentComposition;
587
597
  const composition = compositions.find((c) => c.id === compositionId);
588
598
  const selectedEditorProps = useMemo(() => {
@@ -590,23 +600,33 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
590
600
  return composition ? (_a = allEditorProps[composition.id]) !== null && _a !== void 0 ? _a : {} : {};
591
601
  }, [allEditorProps, composition]);
592
602
  return useMemo(() => {
593
- var _a, _b;
603
+ var _a, _b, _c;
594
604
  if (!composition) {
595
605
  return null;
596
606
  }
607
+ if (currentCompositionMetadata) {
608
+ return {
609
+ type: 'success',
610
+ result: {
611
+ ...currentCompositionMetadata,
612
+ id: composition.id,
613
+ defaultProps: (_a = currentCompositionMetadata.defaultProps) !== null && _a !== void 0 ? _a : {},
614
+ },
615
+ };
616
+ }
597
617
  if (!needsResolution(composition)) {
598
618
  return {
599
619
  type: 'success',
600
620
  result: {
601
621
  ...composition,
602
622
  defaultProps: {
603
- ...((_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {}),
623
+ ...((_b = composition.defaultProps) !== null && _b !== void 0 ? _b : {}),
604
624
  ...(selectedEditorProps !== null && selectedEditorProps !== void 0 ? selectedEditorProps : {}),
605
625
  ...(typeof window === 'undefined' ||
606
626
  getRemotionEnvironment() === 'player-development' ||
607
627
  getRemotionEnvironment() === 'player-production'
608
628
  ? {}
609
- : (_b = getInputProps()) !== null && _b !== void 0 ? _b : {}),
629
+ : (_c = getInputProps()) !== null && _c !== void 0 ? _c : {}),
610
630
  },
611
631
  },
612
632
  };
@@ -615,7 +635,7 @@ const useResolvedVideoConfig = (preferredCompositionId) => {
615
635
  return null;
616
636
  }
617
637
  return context[composition.id];
618
- }, [composition, context, selectedEditorProps]);
638
+ }, [composition, context, currentCompositionMetadata, selectedEditorProps]);
619
639
  };
620
640
 
621
641
  const useVideo = () => {
@@ -3478,7 +3498,6 @@ const RemotionRoot = ({ children, numberOfAudioTags }) => {
3478
3498
  };
3479
3499
  }, [fastRefreshes]);
3480
3500
  useEffect(() => {
3481
- // TODO: This can be moved to renderer?
3482
3501
  if (typeof __webpack_module__ !== 'undefined') {
3483
3502
  if (__webpack_module__.hot) {
3484
3503
  __webpack_module__.hot.addStatusHandler((status) => {
@@ -3641,6 +3660,7 @@ const Internals = {
3641
3660
  ResolveCompositionConfig,
3642
3661
  REMOTION_STUDIO_CONTAINER_ELEMENT,
3643
3662
  AssetManager,
3663
+ bundleName: 'bundle.js',
3644
3664
  };
3645
3665
 
3646
3666
  const flattenChildren = (children) => {
@@ -1,4 +1,4 @@
1
1
  // Automatically generated on publish
2
- const VERSION = '4.0.0-alpha13';
2
+ const VERSION = '4.0.0-alpha14';
3
3
 
4
4
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remotion",
3
- "version": "4.0.0-alpha13",
3
+ "version": "4.0.0-alpha14",
4
4
  "description": "Render videos in React",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "@types/react": "18.0.26",
26
26
  "@types/react-dom": "18.0.10",
27
27
  "@vitejs/plugin-react": "^2.0.0",
28
- "eslint": "8.25.0",
28
+ "eslint": "8.42.0",
29
29
  "eslint-plugin-require-extensions": "^0.1.2",
30
30
  "jsdom": "21.1.0",
31
31
  "prettier": "^2.7.1",
@@ -34,7 +34,7 @@
34
34
  "react-dom": "^18.0.0",
35
35
  "rimraf": "^3.0.2",
36
36
  "rollup": "^2.70.1",
37
- "typescript": "^4.7.0",
37
+ "typescript": "4.9.5",
38
38
  "vitest": "0.31.1",
39
39
  "webpack": "5.83.1",
40
40
  "zod": "3.21.4"