remotion 4.0.0-alpha.130 → 4.0.0-alpha.185
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.d.ts +3 -1
- package/dist/cjs/Img.js +69 -32
- package/dist/cjs/config.d.ts +289 -0
- package/dist/cjs/config.js +21 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +27 -1
- package/dist/cjs/internals.d.ts +8 -0
- package/dist/cjs/internals.js +5 -0
- package/dist/cjs/interpolate-colors.d.ts +1 -0
- package/dist/cjs/interpolate-colors.js +4 -8
- package/dist/cjs/static-file.js +14 -0
- package/dist/cjs/use-media-in-timeline.js +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/z-color.d.ts +9 -0
- package/dist/cjs/z-color.js +28 -0
- package/dist/esm/index.mjs +185 -89
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
package/dist/cjs/Img.d.ts
CHANGED
|
@@ -3,4 +3,6 @@ import React from 'react';
|
|
|
3
3
|
* @description Works just like a regular HTML img tag. When you use the <Img> tag, Remotion will ensure that the image is loaded before rendering the frame.
|
|
4
4
|
* @see [Documentation](https://www.remotion.dev/docs/img)
|
|
5
5
|
*/
|
|
6
|
-
export declare const Img: React.ForwardRefExoticComponent<Pick<React.
|
|
6
|
+
export declare const Img: React.ForwardRefExoticComponent<Pick<React.ClassAttributes<HTMLImageElement> & React.ImgHTMLAttributes<HTMLImageElement> & {
|
|
7
|
+
maxRetries?: number | undefined;
|
|
8
|
+
}, "key" | "maxRetries" | keyof React.ImgHTMLAttributes<HTMLImageElement>> & React.RefAttributes<HTMLImageElement>>;
|
package/dist/cjs/Img.js
CHANGED
|
@@ -4,49 +4,86 @@ exports.Img = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const delay_render_js_1 = require("./delay-render.js");
|
|
7
|
-
const get_environment_js_1 = require("./get-environment.js");
|
|
8
7
|
const prefetch_js_1 = require("./prefetch.js");
|
|
9
|
-
|
|
8
|
+
function exponentialBackoff(errorCount) {
|
|
9
|
+
return 1000 * 2 ** (errorCount - 1);
|
|
10
|
+
}
|
|
11
|
+
const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
|
|
10
12
|
const imageRef = (0, react_1.useRef)(null);
|
|
11
|
-
const
|
|
13
|
+
const errors = (0, react_1.useRef)({});
|
|
12
14
|
(0, react_1.useImperativeHandle)(ref, () => {
|
|
13
15
|
return imageRef.current;
|
|
14
16
|
}, []);
|
|
15
17
|
const actualSrc = (0, prefetch_js_1.usePreload)(src);
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
onError(e);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
console.error('Error loading image with src:', (_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src, e, 'Handle the event using the onError() prop to make this message disappear.');
|
|
18
|
+
const retryIn = (0, react_1.useCallback)((timeout) => {
|
|
19
|
+
if (!imageRef.current) {
|
|
20
|
+
return;
|
|
23
21
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (process.env.NODE_ENV === 'test') {
|
|
22
|
+
const currentSrc = imageRef.current.src;
|
|
23
|
+
setTimeout(() => {
|
|
24
|
+
var _a;
|
|
25
|
+
if (!imageRef.current) {
|
|
26
|
+
// Component has been unmounted, do not retry
|
|
30
27
|
return;
|
|
31
28
|
}
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
if (current === null || current === void 0 ? void 0 : current.complete) {
|
|
38
|
-
(0, delay_render_js_1.continueRender)(newHandle);
|
|
29
|
+
const newSrc = (_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src;
|
|
30
|
+
if (newSrc !== currentSrc) {
|
|
31
|
+
// src has changed, do not retry
|
|
32
|
+
return;
|
|
39
33
|
}
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
imageRef.current.removeAttribute('src');
|
|
35
|
+
imageRef.current.setAttribute('src', newSrc);
|
|
36
|
+
}, timeout);
|
|
37
|
+
}, []);
|
|
38
|
+
const didGetError = (0, react_1.useCallback)((e) => {
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
40
|
+
if (!errors.current) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src] =
|
|
44
|
+
((_c = errors.current[(_b = imageRef.current) === null || _b === void 0 ? void 0 : _b.src]) !== null && _c !== void 0 ? _c : 0) + 1;
|
|
45
|
+
if (onError &&
|
|
46
|
+
((_e = errors.current[(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src]) !== null && _e !== void 0 ? _e : 0) > maxRetries) {
|
|
47
|
+
onError(e);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (((_g = errors.current[(_f = imageRef.current) === null || _f === void 0 ? void 0 : _f.src]) !== null && _g !== void 0 ? _g : 0) <= maxRetries) {
|
|
51
|
+
const backoff = exponentialBackoff((_j = errors.current[(_h = imageRef.current) === null || _h === void 0 ? void 0 : _h.src]) !== null && _j !== void 0 ? _j : 0);
|
|
52
|
+
console.warn(`Could not load image with source ${(_k = imageRef.current) === null || _k === void 0 ? void 0 : _k.src}, retrying again in ${backoff}ms`);
|
|
53
|
+
retryIn(backoff);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
console.error('Error loading image with src:', (_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src, e, 'Handle the event using the onError() prop to make this message disappear.');
|
|
57
|
+
}, [maxRetries, onError, retryIn]);
|
|
58
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
59
|
+
if (process.env.NODE_ENV === 'test') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const newHandle = (0, delay_render_js_1.delayRender)('Loading <Img> with src=' + src);
|
|
63
|
+
const { current } = imageRef;
|
|
64
|
+
const onComplete = () => {
|
|
65
|
+
var _a, _b, _c, _d;
|
|
66
|
+
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
67
|
+
delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
|
|
68
|
+
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
42
69
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
70
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
71
|
+
};
|
|
72
|
+
const didLoad = () => {
|
|
73
|
+
onComplete();
|
|
74
|
+
};
|
|
75
|
+
if (current === null || current === void 0 ? void 0 : current.complete) {
|
|
76
|
+
onComplete();
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
current === null || current === void 0 ? void 0 : current.addEventListener('load', didLoad, { once: true });
|
|
80
|
+
}
|
|
81
|
+
// If tag gets unmounted, clear pending handles because image is not going to load
|
|
82
|
+
return () => {
|
|
83
|
+
current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
|
|
84
|
+
(0, delay_render_js_1.continueRender)(newHandle);
|
|
85
|
+
};
|
|
86
|
+
}, [src]);
|
|
50
87
|
return ((0, jsx_runtime_1.jsx)("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
|
|
51
88
|
};
|
|
52
89
|
/**
|
|
@@ -0,0 +1,289 @@
|
|
|
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
|
+
/**
|
|
144
|
+
* @deprecated New flat config format: You can now replace `Config.Rendering.` with `Config.`
|
|
145
|
+
*/
|
|
146
|
+
readonly Rendering: {
|
|
147
|
+
/**
|
|
148
|
+
* Set a custom location for a .env file.
|
|
149
|
+
* Default: `.env`
|
|
150
|
+
*/
|
|
151
|
+
readonly setDotEnvLocation: (file: string) => void;
|
|
152
|
+
/**
|
|
153
|
+
* Sets how many Puppeteer instances will work on rendering your video in parallel.
|
|
154
|
+
* Default: `null`, meaning half of the threads available on your CPU.
|
|
155
|
+
*/
|
|
156
|
+
readonly setConcurrency: (newConcurrency: Concurrency) => void;
|
|
157
|
+
/**
|
|
158
|
+
* Set the JPEG quality for the frames.
|
|
159
|
+
* Must be between 0 and 100.
|
|
160
|
+
* Must be between 0 and 100.
|
|
161
|
+
* Default: 80
|
|
162
|
+
*/
|
|
163
|
+
readonly setQuality: (q: number | undefined) => void;
|
|
164
|
+
/** Decide in which image format to render. Can be either 'jpeg' or 'png'.
|
|
165
|
+
* PNG is slower, but supports transparency.
|
|
166
|
+
*/
|
|
167
|
+
readonly setImageFormat: (format: 'png' | 'jpeg' | 'none') => void;
|
|
168
|
+
/**
|
|
169
|
+
* Render only a subset of a video.
|
|
170
|
+
* Pass in a tuple [20, 30] to only render frames 20-30 into a video.
|
|
171
|
+
* Pass in a single number `20` to only render a single frame as an image.
|
|
172
|
+
* The frame count starts at 0.
|
|
173
|
+
*/
|
|
174
|
+
readonly setFrameRange: (newFrameRange: FrameRange | null) => void;
|
|
175
|
+
/**
|
|
176
|
+
* Specify local ffmpeg executable.
|
|
177
|
+
* Default: null, which will use ffmpeg available in PATH.
|
|
178
|
+
*/
|
|
179
|
+
readonly setFfmpegExecutable: (ffmpegPath: FfmpegExecutable) => void;
|
|
180
|
+
/**
|
|
181
|
+
* Specify local ffprobe executable.
|
|
182
|
+
* Default: null, which will use ffprobe available in PATH.
|
|
183
|
+
*/
|
|
184
|
+
readonly setFfprobeExecutable: (ffprobePath: FfmpegExecutable) => void;
|
|
185
|
+
/**
|
|
186
|
+
* Scales the output dimensions by a factor.
|
|
187
|
+
* Default: 1.
|
|
188
|
+
*/
|
|
189
|
+
readonly setScale: (newScale: number) => void;
|
|
190
|
+
/**
|
|
191
|
+
* Specify which frames should be picked for rendering a GIF
|
|
192
|
+
* Default: 1, which means every frame
|
|
193
|
+
* https://remotion.dev/docs/render-as-gif
|
|
194
|
+
*/
|
|
195
|
+
readonly setEveryNthFrame: (frame: number) => void;
|
|
196
|
+
/**
|
|
197
|
+
* Specify the number of Loop a GIF should have.
|
|
198
|
+
* Default: null (means GIF will loop infinite)
|
|
199
|
+
*/
|
|
200
|
+
readonly setNumberOfGifLoops: (newLoop: Loop) => void;
|
|
201
|
+
/**
|
|
202
|
+
* Disable audio output.
|
|
203
|
+
* Default: false
|
|
204
|
+
*/
|
|
205
|
+
readonly setMuted: (muted: boolean) => void;
|
|
206
|
+
/**
|
|
207
|
+
* Don't render an audio track if it would be silent.
|
|
208
|
+
* Default: true
|
|
209
|
+
*/
|
|
210
|
+
readonly setEnforceAudioTrack: (enforceAudioTrack: boolean) => void;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* @deprecated New flat config format: You can now replace `Config.Output.` with `Config.`
|
|
214
|
+
*/
|
|
215
|
+
readonly Output: {
|
|
216
|
+
/**
|
|
217
|
+
* Set the output file location string. Default: `out/{composition}.{codec}`
|
|
218
|
+
*/
|
|
219
|
+
readonly setOutputLocation: (newOutputLocation: string) => void;
|
|
220
|
+
/**
|
|
221
|
+
* If the video file already exists, should Remotion overwrite
|
|
222
|
+
* the output? Default: true
|
|
223
|
+
*/
|
|
224
|
+
readonly setOverwriteOutput: (newOverwrite: boolean) => void;
|
|
225
|
+
/**
|
|
226
|
+
* Sets the pixel format in FFMPEG.
|
|
227
|
+
* See https://trac.ffmpeg.org/wiki/Chroma%20Subsampling for an explanation.
|
|
228
|
+
* You can override this using the `--pixel-format` Cli flag.
|
|
229
|
+
*/
|
|
230
|
+
readonly setPixelFormat: (format: 'yuv420p' | 'yuva420p' | 'yuv422p' | 'yuv444p' | 'yuv420p10le' | 'yuv422p10le' | 'yuv444p10le' | 'yuva444p10le') => void;
|
|
231
|
+
/**
|
|
232
|
+
* @deprecated Use setCodec() and setImageSequence() instead.
|
|
233
|
+
* Specify what kind of output you, either `mp4` or `png-sequence`.
|
|
234
|
+
*/
|
|
235
|
+
readonly setOutputFormat: (newLegacyFormat: 'mp4' | 'png-sequence') => void;
|
|
236
|
+
/**
|
|
237
|
+
* Specify the codec for stitching the frames into a video.
|
|
238
|
+
* Can be `h264` (default), `h265`, `vp8` or `vp9`
|
|
239
|
+
*/
|
|
240
|
+
readonly setCodec: (newCodec: CodecOrUndefined) => void;
|
|
241
|
+
/**
|
|
242
|
+
* Set the Constant Rate Factor to pass to FFMPEG.
|
|
243
|
+
* Lower values mean better quality, but be aware that the ranges of
|
|
244
|
+
* possible values greatly differs between codecs.
|
|
245
|
+
*/
|
|
246
|
+
readonly setCrf: (newCrf: Crf) => void;
|
|
247
|
+
/**
|
|
248
|
+
* Set to true if don't want a video but an image sequence as the output.
|
|
249
|
+
*/
|
|
250
|
+
readonly setImageSequence: (newImageSequence: boolean) => void;
|
|
251
|
+
/**
|
|
252
|
+
* Overrides the height of a composition
|
|
253
|
+
*/
|
|
254
|
+
readonly overrideHeight: (newHeight: number) => void;
|
|
255
|
+
/**
|
|
256
|
+
* Overrides the width of a composition
|
|
257
|
+
*/
|
|
258
|
+
readonly overrideWidth: (newWidth: number) => void;
|
|
259
|
+
/**
|
|
260
|
+
* Set the ProRes profile.
|
|
261
|
+
* This method is only valid if the codec has been set to 'prores'.
|
|
262
|
+
* Possible values: 4444-xq, 4444, hq, standard, light, proxy. Default: 'hq'
|
|
263
|
+
* See https://avpres.net/FFmpeg/im_ProRes.html for meaning of possible values.
|
|
264
|
+
*/
|
|
265
|
+
readonly setProResProfile: (profile: '4444-xq' | '4444' | 'hq' | 'standard' | 'light' | 'proxy' | undefined) => void;
|
|
266
|
+
/**
|
|
267
|
+
* Override the arguments that Remotion passes to FFMPEG.
|
|
268
|
+
* Consult https://remotion.dev/docs/renderer/render-media#ffmpegoverride before using this feature.
|
|
269
|
+
*/
|
|
270
|
+
readonly overrideFfmpegCommand: (command: (info: {
|
|
271
|
+
type: 'pre-stitcher' | 'stitcher';
|
|
272
|
+
args: string[];
|
|
273
|
+
}) => string[]) => void;
|
|
274
|
+
/**
|
|
275
|
+
* Set a target audio bitrate to be passed to FFMPEG.
|
|
276
|
+
*/
|
|
277
|
+
readonly setAudioBitrate: (bitrate: string | null) => void;
|
|
278
|
+
/**
|
|
279
|
+
* Set a target video bitrate to be passed to FFMPEG.
|
|
280
|
+
* Mutually exclusive with setCrf().
|
|
281
|
+
*/
|
|
282
|
+
readonly setVideoBitrate: (bitrate: string | null) => void;
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
export declare type ConfigType = RemotionConfigObject & FlatConfig;
|
|
287
|
+
export type { Concurrency };
|
|
288
|
+
export declare const Config: ConfigType;
|
|
289
|
+
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;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ export * from './use-video-config.js';
|
|
|
79
79
|
export * from './version.js';
|
|
80
80
|
export * from './video-config.js';
|
|
81
81
|
export * from './video/index.js';
|
|
82
|
+
export { zColor } from './z-color.js';
|
|
82
83
|
export declare const Experimental: {
|
|
83
84
|
/**
|
|
84
85
|
* @description This is a special component that will cause Remotion to only partially capture the frame of the video.
|
|
@@ -97,3 +98,4 @@ export declare const Experimental: {
|
|
|
97
98
|
Null: import("react").FC<{}>;
|
|
98
99
|
useIsPlayer: () => boolean;
|
|
99
100
|
};
|
|
101
|
+
export declare const Config: {};
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Experimental = exports.useCurrentFrame = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.random = exports.prefetch = exports.Loop = exports.interpolate = exports.interpolateColors = exports.getStaticFiles = exports.delayRender = exports.continueRender = exports.getInputProps = exports.cancelRender = exports.z = void 0;
|
|
17
|
+
exports.Config = exports.Experimental = exports.zColor = exports.useCurrentFrame = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.random = exports.prefetch = exports.Loop = exports.interpolate = exports.interpolateColors = exports.getStaticFiles = exports.delayRender = exports.continueRender = exports.getInputProps = exports.cancelRender = exports.z = void 0;
|
|
18
18
|
require("./asset-types.js");
|
|
19
19
|
const Clipper_js_1 = require("./Clipper.js");
|
|
20
20
|
const is_player_js_1 = require("./is-player.js");
|
|
@@ -67,6 +67,8 @@ __exportStar(require("./use-video-config.js"), exports);
|
|
|
67
67
|
__exportStar(require("./version.js"), exports);
|
|
68
68
|
__exportStar(require("./video-config.js"), exports);
|
|
69
69
|
__exportStar(require("./video/index.js"), exports);
|
|
70
|
+
var z_color_js_1 = require("./z-color.js");
|
|
71
|
+
Object.defineProperty(exports, "zColor", { enumerable: true, get: function () { return z_color_js_1.zColor; } });
|
|
70
72
|
exports.Experimental = {
|
|
71
73
|
/**
|
|
72
74
|
* @description This is a special component that will cause Remotion to only partially capture the frame of the video.
|
|
@@ -80,3 +82,27 @@ exports.Experimental = {
|
|
|
80
82
|
Null: Null_js_1.Null,
|
|
81
83
|
useIsPlayer: is_player_js_1.useIsPlayer,
|
|
82
84
|
};
|
|
85
|
+
const proxyObj = {};
|
|
86
|
+
exports.Config = new Proxy(proxyObj, {
|
|
87
|
+
get(_, prop) {
|
|
88
|
+
if (prop === 'Bundling' ||
|
|
89
|
+
prop === 'Rendering' ||
|
|
90
|
+
prop === 'Log' ||
|
|
91
|
+
prop === 'Puppeteer' ||
|
|
92
|
+
prop === 'Output') {
|
|
93
|
+
return exports.Config;
|
|
94
|
+
}
|
|
95
|
+
return () => {
|
|
96
|
+
console.warn('⚠️ The CLI configuration has been extracted from Remotion Core.');
|
|
97
|
+
console.warn('Update the import from the config file:');
|
|
98
|
+
console.warn();
|
|
99
|
+
console.warn('- Delete:');
|
|
100
|
+
console.warn('import {Config} from "remotion";');
|
|
101
|
+
console.warn('+ Replace:');
|
|
102
|
+
console.warn('import {Config} from "@remotion/cli/config";');
|
|
103
|
+
console.warn();
|
|
104
|
+
console.warn('For more information, see https://v4.remotion.dev/docs/4-0-migration.');
|
|
105
|
+
process.exit(1);
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
});
|
package/dist/cjs/internals.d.ts
CHANGED
|
@@ -107,5 +107,13 @@ export declare const Internals: {
|
|
|
107
107
|
children: import("react").ReactNode;
|
|
108
108
|
}>;
|
|
109
109
|
EditorPropsContext: import("react").Context<import("./EditorProps.js").EditorPropsContextType>;
|
|
110
|
+
usePreload: (src: string) => string;
|
|
111
|
+
REMOTION_COLOR_BRAND: string;
|
|
112
|
+
parseColor: (value: string) => {
|
|
113
|
+
a: number;
|
|
114
|
+
r: number;
|
|
115
|
+
g: number;
|
|
116
|
+
b: number;
|
|
117
|
+
};
|
|
110
118
|
};
|
|
111
119
|
export type { TComposition, Timeline, TCompMetadata, TSequence, TAsset, TimelineContextValue, SetTimelineContextValue, CompProps, CompositionManagerContext, MediaVolumeContextValue, SetMediaVolumeContextValue, RemotionEnvironment, };
|
package/dist/cjs/internals.js
CHANGED
|
@@ -35,6 +35,7 @@ const get_preview_dom_element_js_1 = require("./get-preview-dom-element.js");
|
|
|
35
35
|
const is_player_js_1 = require("./is-player.js");
|
|
36
36
|
const portal_node_js_1 = require("./portal-node.js");
|
|
37
37
|
const prefetch_state_js_1 = require("./prefetch-state.js");
|
|
38
|
+
const prefetch_js_1 = require("./prefetch.js");
|
|
38
39
|
const register_root_js_1 = require("./register-root.js");
|
|
39
40
|
const RemotionRoot_js_1 = require("./RemotionRoot.js");
|
|
40
41
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
@@ -53,6 +54,7 @@ const validate_offthreadvideo_image_format_js_1 = require("./validation/validate
|
|
|
53
54
|
const duration_state_js_1 = require("./video/duration-state.js");
|
|
54
55
|
const volume_position_state_js_1 = require("./volume-position-state.js");
|
|
55
56
|
const wrap_remotion_context_js_1 = require("./wrap-remotion-context.js");
|
|
57
|
+
const z_color_js_1 = require("./z-color.js");
|
|
56
58
|
const Timeline = TimelinePosition;
|
|
57
59
|
// Mark them as Internals so use don't assume this is public
|
|
58
60
|
// API and are less likely to use it
|
|
@@ -99,4 +101,7 @@ exports.Internals = {
|
|
|
99
101
|
validateFrame: validate_frame_js_1.validateFrame,
|
|
100
102
|
EditorPropsProvider: EditorProps_js_1.EditorPropsProvider,
|
|
101
103
|
EditorPropsContext: EditorProps_js_1.EditorPropsContext,
|
|
104
|
+
usePreload: prefetch_js_1.usePreload,
|
|
105
|
+
REMOTION_COLOR_BRAND: z_color_js_1.REMOTION_COLOR_BRAND,
|
|
106
|
+
parseColor: z_color_js_1.parseColor,
|
|
102
107
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copied from:
|
|
3
3
|
* https://github.com/software-mansion/react-native-reanimated/blob/master/src/reanimated2/Colors.ts
|
|
4
4
|
*/
|
|
5
|
+
export declare function processColor(color: string): number;
|
|
5
6
|
/**
|
|
6
7
|
* @description This function allows you to map a range of values to colors using a concise syntax.
|
|
7
8
|
* @see [Documentation](https://www.remotion.dev/docs/interpolate-colors)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* https://github.com/software-mansion/react-native-reanimated/blob/master/src/reanimated2/Colors.ts
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.interpolateColors = void 0;
|
|
7
|
+
exports.interpolateColors = exports.processColor = void 0;
|
|
8
8
|
/* eslint no-bitwise: 0 */
|
|
9
9
|
const interpolate_js_1 = require("./interpolate.js");
|
|
10
10
|
// var INTEGER = '[-+]?\\d+';
|
|
@@ -356,15 +356,11 @@ const blue = (c) => {
|
|
|
356
356
|
const rgbaColor = (r, g, b, alpha) => {
|
|
357
357
|
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
358
358
|
};
|
|
359
|
-
function processColorInitially(color) {
|
|
360
|
-
let normalizedColor = normalizeColor(color);
|
|
361
|
-
normalizedColor = ((normalizedColor << 24) | (normalizedColor >>> 8)) >>> 0; // argb
|
|
362
|
-
return normalizedColor;
|
|
363
|
-
}
|
|
364
359
|
function processColor(color) {
|
|
365
|
-
const normalizedColor =
|
|
366
|
-
return normalizedColor;
|
|
360
|
+
const normalizedColor = normalizeColor(color);
|
|
361
|
+
return ((normalizedColor << 24) | (normalizedColor >>> 8)) >>> 0; // argb
|
|
367
362
|
}
|
|
363
|
+
exports.processColor = processColor;
|
|
368
364
|
const interpolateColorsRGB = (value, inputRange, colors) => {
|
|
369
365
|
const [r, g, b, a] = [red, green, blue, opacity].map((f) => {
|
|
370
366
|
const unrounded = (0, interpolate_js_1.interpolate)(value, inputRange, colors.map((c) => f(c)), {
|
package/dist/cjs/static-file.js
CHANGED
|
@@ -24,6 +24,20 @@ const staticFile = (path) => {
|
|
|
24
24
|
if (path.startsWith('..') || path.startsWith('./')) {
|
|
25
25
|
throw new TypeError(`staticFile() does not support relative paths - got "${path}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);
|
|
26
26
|
}
|
|
27
|
+
if (path.startsWith('/Users') ||
|
|
28
|
+
path.startsWith('/home') ||
|
|
29
|
+
path.startsWith('/tmp') ||
|
|
30
|
+
path.startsWith('/etc') ||
|
|
31
|
+
path.startsWith('/opt') ||
|
|
32
|
+
path.startsWith('/var') ||
|
|
33
|
+
path.startsWith('C:') ||
|
|
34
|
+
path.startsWith('D:') ||
|
|
35
|
+
path.startsWith('E:')) {
|
|
36
|
+
throw new TypeError(`staticFile() does not support absolute paths - got "${path}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);
|
|
37
|
+
}
|
|
38
|
+
if (path.startsWith('public/')) {
|
|
39
|
+
throw new TypeError(`Do not include the public/ prefix when using staticFile() - got "${path}". See: https://remotion.dev/docs/staticfile-relative-paths`);
|
|
40
|
+
}
|
|
27
41
|
const preparsed = inner(path);
|
|
28
42
|
if (!preparsed.startsWith('/')) {
|
|
29
43
|
return `/${preparsed}`;
|
|
@@ -42,7 +42,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
|
|
|
42
42
|
if (typeof volume === 'number') {
|
|
43
43
|
return volume;
|
|
44
44
|
}
|
|
45
|
-
return new Array(Math.max(0, duration + startsAt))
|
|
45
|
+
return new Array(Math.floor(Math.max(0, duration + startsAt)))
|
|
46
46
|
.fill(true)
|
|
47
47
|
.map((_, i) => {
|
|
48
48
|
return (0, volume_prop_js_1.evaluateVolume)({
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.0-alpha.
|
|
1
|
+
export declare const VERSION = "4.0.0-alpha.185+1b8f0e746";
|
package/dist/cjs/version.js
CHANGED
|
@@ -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;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -60,7 +60,7 @@ function truthy(value) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// Automatically generated on publish
|
|
63
|
-
const VERSION = '4.0.0-alpha.
|
|
63
|
+
const VERSION = '4.0.0-alpha.185+1b8f0e746';
|
|
64
64
|
|
|
65
65
|
const checkMultipleRemotionVersions = () => {
|
|
66
66
|
if (typeof globalThis === 'undefined') {
|
|
@@ -990,7 +990,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
|
|
|
990
990
|
if (typeof volume === 'number') {
|
|
991
991
|
return volume;
|
|
992
992
|
}
|
|
993
|
-
return new Array(Math.max(0, duration + startsAt))
|
|
993
|
+
return new Array(Math.floor(Math.max(0, duration + startsAt)))
|
|
994
994
|
.fill(true)
|
|
995
995
|
.map((_, i) => {
|
|
996
996
|
return evaluateVolume({
|
|
@@ -2507,47 +2507,85 @@ const IFrameRefForwarding = ({ onLoad, onError, ...props }, ref) => {
|
|
|
2507
2507
|
*/
|
|
2508
2508
|
const IFrame = forwardRef(IFrameRefForwarding);
|
|
2509
2509
|
|
|
2510
|
-
|
|
2510
|
+
function exponentialBackoff(errorCount) {
|
|
2511
|
+
return 1000 * 2 ** (errorCount - 1);
|
|
2512
|
+
}
|
|
2513
|
+
const ImgRefForwarding = ({ onError, maxRetries = 2, src, ...props }, ref) => {
|
|
2511
2514
|
const imageRef = useRef(null);
|
|
2512
|
-
const
|
|
2515
|
+
const errors = useRef({});
|
|
2513
2516
|
useImperativeHandle(ref, () => {
|
|
2514
2517
|
return imageRef.current;
|
|
2515
2518
|
}, []);
|
|
2516
2519
|
const actualSrc = usePreload(src);
|
|
2517
|
-
const
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
onError(e);
|
|
2521
|
-
}
|
|
2522
|
-
else {
|
|
2523
|
-
console.error('Error loading image with src:', (_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src, e, 'Handle the event using the onError() prop to make this message disappear.');
|
|
2520
|
+
const retryIn = useCallback((timeout) => {
|
|
2521
|
+
if (!imageRef.current) {
|
|
2522
|
+
return;
|
|
2524
2523
|
}
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
if (process.env.NODE_ENV === 'test') {
|
|
2524
|
+
const currentSrc = imageRef.current.src;
|
|
2525
|
+
setTimeout(() => {
|
|
2526
|
+
var _a;
|
|
2527
|
+
if (!imageRef.current) {
|
|
2528
|
+
// Component has been unmounted, do not retry
|
|
2531
2529
|
return;
|
|
2532
2530
|
}
|
|
2533
|
-
const
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
};
|
|
2538
|
-
if (current === null || current === void 0 ? void 0 : current.complete) {
|
|
2539
|
-
continueRender(newHandle);
|
|
2531
|
+
const newSrc = (_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src;
|
|
2532
|
+
if (newSrc !== currentSrc) {
|
|
2533
|
+
// src has changed, do not retry
|
|
2534
|
+
return;
|
|
2540
2535
|
}
|
|
2541
|
-
|
|
2542
|
-
|
|
2536
|
+
imageRef.current.removeAttribute('src');
|
|
2537
|
+
imageRef.current.setAttribute('src', newSrc);
|
|
2538
|
+
}, timeout);
|
|
2539
|
+
}, []);
|
|
2540
|
+
const didGetError = useCallback((e) => {
|
|
2541
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
2542
|
+
if (!errors.current) {
|
|
2543
|
+
return;
|
|
2544
|
+
}
|
|
2545
|
+
errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src] =
|
|
2546
|
+
((_c = errors.current[(_b = imageRef.current) === null || _b === void 0 ? void 0 : _b.src]) !== null && _c !== void 0 ? _c : 0) + 1;
|
|
2547
|
+
if (onError &&
|
|
2548
|
+
((_e = errors.current[(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src]) !== null && _e !== void 0 ? _e : 0) > maxRetries) {
|
|
2549
|
+
onError(e);
|
|
2550
|
+
return;
|
|
2551
|
+
}
|
|
2552
|
+
if (((_g = errors.current[(_f = imageRef.current) === null || _f === void 0 ? void 0 : _f.src]) !== null && _g !== void 0 ? _g : 0) <= maxRetries) {
|
|
2553
|
+
const backoff = exponentialBackoff((_j = errors.current[(_h = imageRef.current) === null || _h === void 0 ? void 0 : _h.src]) !== null && _j !== void 0 ? _j : 0);
|
|
2554
|
+
console.warn(`Could not load image with source ${(_k = imageRef.current) === null || _k === void 0 ? void 0 : _k.src}, retrying again in ${backoff}ms`);
|
|
2555
|
+
retryIn(backoff);
|
|
2556
|
+
return;
|
|
2557
|
+
}
|
|
2558
|
+
console.error('Error loading image with src:', (_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src, e, 'Handle the event using the onError() prop to make this message disappear.');
|
|
2559
|
+
}, [maxRetries, onError, retryIn]);
|
|
2560
|
+
useLayoutEffect(() => {
|
|
2561
|
+
if (process.env.NODE_ENV === 'test') {
|
|
2562
|
+
return;
|
|
2563
|
+
}
|
|
2564
|
+
const newHandle = delayRender('Loading <Img> with src=' + src);
|
|
2565
|
+
const { current } = imageRef;
|
|
2566
|
+
const onComplete = () => {
|
|
2567
|
+
var _a, _b, _c, _d;
|
|
2568
|
+
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
2569
|
+
delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
|
|
2570
|
+
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
2543
2571
|
}
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2572
|
+
continueRender(newHandle);
|
|
2573
|
+
};
|
|
2574
|
+
const didLoad = () => {
|
|
2575
|
+
onComplete();
|
|
2576
|
+
};
|
|
2577
|
+
if (current === null || current === void 0 ? void 0 : current.complete) {
|
|
2578
|
+
onComplete();
|
|
2579
|
+
}
|
|
2580
|
+
else {
|
|
2581
|
+
current === null || current === void 0 ? void 0 : current.addEventListener('load', didLoad, { once: true });
|
|
2582
|
+
}
|
|
2583
|
+
// If tag gets unmounted, clear pending handles because image is not going to load
|
|
2584
|
+
return () => {
|
|
2585
|
+
current === null || current === void 0 ? void 0 : current.removeEventListener('load', didLoad);
|
|
2586
|
+
continueRender(newHandle);
|
|
2587
|
+
};
|
|
2588
|
+
}, [src]);
|
|
2551
2589
|
return (jsx("img", { ...props, ref: imageRef, src: actualSrc, onError: didGetError }));
|
|
2552
2590
|
};
|
|
2553
2591
|
/**
|
|
@@ -2805,54 +2843,6 @@ const RemotionContextProvider = (props) => {
|
|
|
2805
2843
|
return (jsx(CanUseRemotionHooks.Provider, { value: contexts.canUseRemotionHooksContext, children: jsx(NonceContext.Provider, { value: contexts.nonceContext, children: jsx(NativeLayersContext.Provider, { value: contexts.nativeLayersContext, children: jsx(PreloadContext.Provider, { value: contexts.preloadContext, children: jsx(CompositionManager.Provider, { value: contexts.compositionManagerCtx, children: jsx(TimelineContext.Provider, { value: contexts.timelineContext, children: jsx(SetTimelineContext.Provider, { value: contexts.setTimelineContext, children: jsx(SequenceContext.Provider, { value: contexts.sequenceContext, children: children }) }) }) }) }) }) }) }));
|
|
2806
2844
|
};
|
|
2807
2845
|
|
|
2808
|
-
const Timeline = TimelinePosition;
|
|
2809
|
-
// Mark them as Internals so use don't assume this is public
|
|
2810
|
-
// API and are less likely to use it
|
|
2811
|
-
const Internals = {
|
|
2812
|
-
useUnsafeVideoConfig,
|
|
2813
|
-
Timeline,
|
|
2814
|
-
CompositionManager,
|
|
2815
|
-
RemotionRoot,
|
|
2816
|
-
useVideo,
|
|
2817
|
-
getRoot,
|
|
2818
|
-
useMediaVolumeState,
|
|
2819
|
-
useMediaMutedState,
|
|
2820
|
-
useLazyComponent,
|
|
2821
|
-
truthy,
|
|
2822
|
-
SequenceContext,
|
|
2823
|
-
useRemotionContexts,
|
|
2824
|
-
RemotionContextProvider,
|
|
2825
|
-
CSSUtils,
|
|
2826
|
-
setupEnvVariables,
|
|
2827
|
-
ENV_VARIABLES_ENV_NAME,
|
|
2828
|
-
MediaVolumeContext,
|
|
2829
|
-
SetMediaVolumeContext,
|
|
2830
|
-
validateDurationInFrames,
|
|
2831
|
-
validateFps,
|
|
2832
|
-
validateDimension,
|
|
2833
|
-
getRemotionEnvironment,
|
|
2834
|
-
SharedAudioContext,
|
|
2835
|
-
SharedAudioContextProvider,
|
|
2836
|
-
invalidCompositionErrorMessage,
|
|
2837
|
-
isCompositionIdValid,
|
|
2838
|
-
getPreviewDomElement,
|
|
2839
|
-
compositionsRef,
|
|
2840
|
-
DELAY_RENDER_CALLSTACK_TOKEN,
|
|
2841
|
-
portalNode,
|
|
2842
|
-
waitForRoot,
|
|
2843
|
-
validateOffthreadVideoImageFormat,
|
|
2844
|
-
CanUseRemotionHooksProvider,
|
|
2845
|
-
CanUseRemotionHooks,
|
|
2846
|
-
PrefetchProvider,
|
|
2847
|
-
DurationsContextProvider,
|
|
2848
|
-
IsPlayerContextProvider,
|
|
2849
|
-
useIsPlayer,
|
|
2850
|
-
useRemotionEnvironment,
|
|
2851
|
-
validateFrame,
|
|
2852
|
-
EditorPropsProvider,
|
|
2853
|
-
EditorPropsContext,
|
|
2854
|
-
};
|
|
2855
|
-
|
|
2856
2846
|
/**
|
|
2857
2847
|
* Copied from:
|
|
2858
2848
|
* https://github.com/software-mansion/react-native-reanimated/blob/master/src/reanimated2/Colors.ts
|
|
@@ -3206,14 +3196,9 @@ const blue = (c) => {
|
|
|
3206
3196
|
const rgbaColor = (r, g, b, alpha) => {
|
|
3207
3197
|
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
3208
3198
|
};
|
|
3209
|
-
function processColorInitially(color) {
|
|
3210
|
-
let normalizedColor = normalizeColor(color);
|
|
3211
|
-
normalizedColor = ((normalizedColor << 24) | (normalizedColor >>> 8)) >>> 0; // argb
|
|
3212
|
-
return normalizedColor;
|
|
3213
|
-
}
|
|
3214
3199
|
function processColor(color) {
|
|
3215
|
-
const normalizedColor =
|
|
3216
|
-
return normalizedColor;
|
|
3200
|
+
const normalizedColor = normalizeColor(color);
|
|
3201
|
+
return ((normalizedColor << 24) | (normalizedColor >>> 8)) >>> 0; // argb
|
|
3217
3202
|
}
|
|
3218
3203
|
const interpolateColorsRGB = (value, inputRange, colors) => {
|
|
3219
3204
|
const [r, g, b, a] = [red, green, blue, opacity].map((f) => {
|
|
@@ -3253,6 +3238,79 @@ const interpolateColors = (input, inputRange, outputRange) => {
|
|
|
3253
3238
|
return interpolateColorsRGB(input, inputRange, processedOutputRange);
|
|
3254
3239
|
};
|
|
3255
3240
|
|
|
3241
|
+
const REMOTION_COLOR_BRAND = '__remotion-color';
|
|
3242
|
+
const parseColor = (value) => {
|
|
3243
|
+
const colored = processColor(value).toString(16).padStart(8, '0');
|
|
3244
|
+
const opacity = parseInt(colored.slice(0, 2), 16);
|
|
3245
|
+
const r = parseInt(colored.slice(2, 4), 16);
|
|
3246
|
+
const g = parseInt(colored.slice(4, 6), 16);
|
|
3247
|
+
const b = parseInt(colored.slice(6, 8), 16);
|
|
3248
|
+
return { a: opacity, r, g, b };
|
|
3249
|
+
};
|
|
3250
|
+
const zColor = () => z
|
|
3251
|
+
.string()
|
|
3252
|
+
.refine((value) => {
|
|
3253
|
+
try {
|
|
3254
|
+
parseColor(value);
|
|
3255
|
+
return true;
|
|
3256
|
+
}
|
|
3257
|
+
catch (err) {
|
|
3258
|
+
return false;
|
|
3259
|
+
}
|
|
3260
|
+
}, { message: 'Invalid color' })
|
|
3261
|
+
.describe(REMOTION_COLOR_BRAND);
|
|
3262
|
+
|
|
3263
|
+
const Timeline = TimelinePosition;
|
|
3264
|
+
// Mark them as Internals so use don't assume this is public
|
|
3265
|
+
// API and are less likely to use it
|
|
3266
|
+
const Internals = {
|
|
3267
|
+
useUnsafeVideoConfig,
|
|
3268
|
+
Timeline,
|
|
3269
|
+
CompositionManager,
|
|
3270
|
+
RemotionRoot,
|
|
3271
|
+
useVideo,
|
|
3272
|
+
getRoot,
|
|
3273
|
+
useMediaVolumeState,
|
|
3274
|
+
useMediaMutedState,
|
|
3275
|
+
useLazyComponent,
|
|
3276
|
+
truthy,
|
|
3277
|
+
SequenceContext,
|
|
3278
|
+
useRemotionContexts,
|
|
3279
|
+
RemotionContextProvider,
|
|
3280
|
+
CSSUtils,
|
|
3281
|
+
setupEnvVariables,
|
|
3282
|
+
ENV_VARIABLES_ENV_NAME,
|
|
3283
|
+
MediaVolumeContext,
|
|
3284
|
+
SetMediaVolumeContext,
|
|
3285
|
+
validateDurationInFrames,
|
|
3286
|
+
validateFps,
|
|
3287
|
+
validateDimension,
|
|
3288
|
+
getRemotionEnvironment,
|
|
3289
|
+
SharedAudioContext,
|
|
3290
|
+
SharedAudioContextProvider,
|
|
3291
|
+
invalidCompositionErrorMessage,
|
|
3292
|
+
isCompositionIdValid,
|
|
3293
|
+
getPreviewDomElement,
|
|
3294
|
+
compositionsRef,
|
|
3295
|
+
DELAY_RENDER_CALLSTACK_TOKEN,
|
|
3296
|
+
portalNode,
|
|
3297
|
+
waitForRoot,
|
|
3298
|
+
validateOffthreadVideoImageFormat,
|
|
3299
|
+
CanUseRemotionHooksProvider,
|
|
3300
|
+
CanUseRemotionHooks,
|
|
3301
|
+
PrefetchProvider,
|
|
3302
|
+
DurationsContextProvider,
|
|
3303
|
+
IsPlayerContextProvider,
|
|
3304
|
+
useIsPlayer,
|
|
3305
|
+
useRemotionEnvironment,
|
|
3306
|
+
validateFrame,
|
|
3307
|
+
EditorPropsProvider,
|
|
3308
|
+
EditorPropsContext,
|
|
3309
|
+
usePreload,
|
|
3310
|
+
REMOTION_COLOR_BRAND,
|
|
3311
|
+
parseColor,
|
|
3312
|
+
};
|
|
3313
|
+
|
|
3256
3314
|
const flattenChildren = (children) => {
|
|
3257
3315
|
const childrenArray = React.Children.toArray(children);
|
|
3258
3316
|
return childrenArray.reduce((flatChildren, child) => {
|
|
@@ -3575,6 +3633,20 @@ const staticFile = (path) => {
|
|
|
3575
3633
|
if (path.startsWith('..') || path.startsWith('./')) {
|
|
3576
3634
|
throw new TypeError(`staticFile() does not support relative paths - got "${path}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);
|
|
3577
3635
|
}
|
|
3636
|
+
if (path.startsWith('/Users') ||
|
|
3637
|
+
path.startsWith('/home') ||
|
|
3638
|
+
path.startsWith('/tmp') ||
|
|
3639
|
+
path.startsWith('/etc') ||
|
|
3640
|
+
path.startsWith('/opt') ||
|
|
3641
|
+
path.startsWith('/var') ||
|
|
3642
|
+
path.startsWith('C:') ||
|
|
3643
|
+
path.startsWith('D:') ||
|
|
3644
|
+
path.startsWith('E:')) {
|
|
3645
|
+
throw new TypeError(`staticFile() does not support absolute paths - got "${path}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);
|
|
3646
|
+
}
|
|
3647
|
+
if (path.startsWith('public/')) {
|
|
3648
|
+
throw new TypeError(`Do not include the public/ prefix when using staticFile() - got "${path}". See: https://remotion.dev/docs/staticfile-relative-paths`);
|
|
3649
|
+
}
|
|
3578
3650
|
const preparsed = inner(path);
|
|
3579
3651
|
if (!preparsed.startsWith('/')) {
|
|
3580
3652
|
return `/${preparsed}`;
|
|
@@ -4101,5 +4173,29 @@ const Experimental = {
|
|
|
4101
4173
|
Null,
|
|
4102
4174
|
useIsPlayer,
|
|
4103
4175
|
};
|
|
4176
|
+
const proxyObj = {};
|
|
4177
|
+
const Config = new Proxy(proxyObj, {
|
|
4178
|
+
get(_, prop) {
|
|
4179
|
+
if (prop === 'Bundling' ||
|
|
4180
|
+
prop === 'Rendering' ||
|
|
4181
|
+
prop === 'Log' ||
|
|
4182
|
+
prop === 'Puppeteer' ||
|
|
4183
|
+
prop === 'Output') {
|
|
4184
|
+
return Config;
|
|
4185
|
+
}
|
|
4186
|
+
return () => {
|
|
4187
|
+
console.warn('⚠️ The CLI configuration has been extracted from Remotion Core.');
|
|
4188
|
+
console.warn('Update the import from the config file:');
|
|
4189
|
+
console.warn();
|
|
4190
|
+
console.warn('- Delete:');
|
|
4191
|
+
console.warn('import {Config} from "remotion";');
|
|
4192
|
+
console.warn('+ Replace:');
|
|
4193
|
+
console.warn('import {Config} from "@remotion/cli/config";');
|
|
4194
|
+
console.warn();
|
|
4195
|
+
console.warn('For more information, see https://v4.remotion.dev/docs/4-0-migration.');
|
|
4196
|
+
process.exit(1);
|
|
4197
|
+
};
|
|
4198
|
+
},
|
|
4199
|
+
});
|
|
4104
4200
|
|
|
4105
|
-
export { AbsoluteFill, Audio, ClipComposition, Composition, Easing, Experimental, Folder, FolderContext, Freeze, IFrame, Img, Internals, Loop, OffthreadVideo, Sequence, Series, Still, VERSION, Video, cancelRender, continueRender, delayRender, getInputProps, getStaticFiles, interpolate, interpolateColors, measureSpring, prefetch, random, registerRoot, spring, staticFile, useCurrentFrame, useVideoConfig };
|
|
4201
|
+
export { AbsoluteFill, Audio, ClipComposition, Composition, Config, Easing, Experimental, Folder, FolderContext, Freeze, IFrame, Img, Internals, Loop, OffthreadVideo, Sequence, Series, Still, VERSION, Video, cancelRender, continueRender, delayRender, getInputProps, getStaticFiles, interpolate, interpolateColors, measureSpring, prefetch, random, registerRoot, spring, staticFile, useCurrentFrame, useVideoConfig, zColor };
|
package/dist/esm/version.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "remotion",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.185+1b8f0e746",
|
|
4
4
|
"description": "Render videos in React",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"zod": "3.21.4"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "1b8f0e746ea4aa1153c4ecc7bc1063752c405f25"
|
|
84
84
|
}
|