@remotion/renderer 4.1.0-alpha7 → 4.1.0-alpha9
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/assets/download-and-map-assets-to-file.d.ts +2 -4
- package/dist/assets/download-and-map-assets-to-file.js +14 -10
- package/dist/assets/download-map.d.ts +4 -0
- package/dist/assets/download-map.js +3 -0
- package/dist/create-ffmpeg-complex-filter.d.ts +4 -1
- package/dist/get-compositions.d.ts +3 -3
- package/dist/get-compositions.js +14 -5
- package/dist/index.d.ts +12 -13
- package/dist/logger.d.ts +1 -1
- package/dist/offthread-video-server.d.ts +0 -1
- package/dist/offthread-video-server.js +2 -4
- package/dist/prepare-server.d.ts +0 -2
- package/dist/prepare-server.js +6 -8
- package/dist/render-frames.d.ts +4 -3
- package/dist/render-frames.js +23 -9
- package/dist/render-media.d.ts +4 -3
- package/dist/render-media.js +13 -3
- package/dist/render-still.d.ts +2 -1
- package/dist/render-still.js +17 -6
- package/dist/select-composition.d.ts +3 -3
- package/dist/select-composition.js +26 -6
- package/dist/serialize-props.d.ts +6 -0
- package/dist/serialize-props.js +36 -0
- package/dist/serve-handler/index.js +1 -1
- package/dist/serve-static.d.ts +0 -2
- package/dist/serve-static.js +2 -2
- package/dist/set-props-and-env.d.ts +4 -1
- package/dist/set-props-and-env.js +34 -16
- package/dist/stitch-frames-to-video.d.ts +0 -1
- package/dist/take-frame-and-compose.d.ts +0 -1
- package/package.json +9 -9
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { TAsset } from 'remotion';
|
|
2
|
-
import { OffthreadVideoServerEmitter } from '../offthread-video-server';
|
|
3
2
|
import type { DownloadMap } from './download-map';
|
|
4
3
|
export type RenderMediaOnDownload = (src: string) => ((progress: {
|
|
5
4
|
percent: number | null;
|
|
6
5
|
downloaded: number;
|
|
7
6
|
totalSize: number | null;
|
|
8
7
|
}) => void) | undefined | void;
|
|
9
|
-
export declare const downloadAsset: ({ src, downloadMap,
|
|
8
|
+
export declare const downloadAsset: ({ src, downloadMap, }: {
|
|
10
9
|
src: string;
|
|
11
|
-
emitter: OffthreadVideoServerEmitter;
|
|
12
10
|
downloadMap: DownloadMap;
|
|
13
11
|
}) => Promise<string>;
|
|
14
12
|
export declare const markAllAssetsAsDownloaded: (downloadMap: DownloadMap) => void;
|
|
@@ -23,4 +21,4 @@ export declare const downloadAndMapAssetsToFileUrl: ({ asset, onDownload, downlo
|
|
|
23
21
|
onDownload: RenderMediaOnDownload | null;
|
|
24
22
|
downloadMap: DownloadMap;
|
|
25
23
|
}) => Promise<TAsset>;
|
|
26
|
-
export declare const attachDownloadListenerToEmitter: (
|
|
24
|
+
export declare const attachDownloadListenerToEmitter: (downloadMap: DownloadMap, onDownload: RenderMediaOnDownload | null) => () => void;
|
|
@@ -33,7 +33,6 @@ const remotion_1 = require("remotion");
|
|
|
33
33
|
const compress_assets_1 = require("../compress-assets");
|
|
34
34
|
const ensure_output_directory_1 = require("../ensure-output-directory");
|
|
35
35
|
const mime_types_1 = require("../mime-types");
|
|
36
|
-
const offthread_video_server_1 = require("../offthread-video-server");
|
|
37
36
|
const download_file_1 = require("./download-file");
|
|
38
37
|
const sanitize_filepath_1 = require("./sanitize-filepath");
|
|
39
38
|
const waitForAssetToBeDownloaded = ({ src, downloadDir, downloadMap, }) => {
|
|
@@ -116,7 +115,7 @@ function validateBufferEncoding(potentialEncoding, dataUrl) {
|
|
|
116
115
|
throw new TypeError(errMessage);
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
|
-
const downloadAsset = async ({ src, downloadMap,
|
|
118
|
+
const downloadAsset = async ({ src, downloadMap, }) => {
|
|
120
119
|
var _a, _b, _c;
|
|
121
120
|
if ((0, compress_assets_1.isAssetCompressed)(src)) {
|
|
122
121
|
return src;
|
|
@@ -146,7 +145,7 @@ const downloadAsset = async ({ src, downloadMap, emitter, }) => {
|
|
|
146
145
|
if (process.env.NODE_ENV === 'test') {
|
|
147
146
|
console.log('Actually downloading asset', src);
|
|
148
147
|
}
|
|
149
|
-
emitter.dispatchDownload(src);
|
|
148
|
+
downloadMap.emitter.dispatchDownload(src);
|
|
150
149
|
if (src.startsWith('data:')) {
|
|
151
150
|
const [assetDetails, assetData] = src.substring('data:'.length).split(',');
|
|
152
151
|
if (!assetDetails.includes(';')) {
|
|
@@ -176,7 +175,7 @@ const downloadAsset = async ({ src, downloadMap, emitter, }) => {
|
|
|
176
175
|
const { to } = await (0, download_file_1.downloadFile)({
|
|
177
176
|
url: src,
|
|
178
177
|
onProgress: (progress) => {
|
|
179
|
-
emitter.dispatchDownloadProgress(src, progress.percent, progress.downloaded, progress.totalSize);
|
|
178
|
+
downloadMap.emitter.dispatchDownloadProgress(src, progress.percent, progress.downloaded, progress.totalSize);
|
|
180
179
|
},
|
|
181
180
|
to: (contentDisposition, contentType) => (0, exports.getSanitizedFilenameForAssetUrl)({
|
|
182
181
|
contentDisposition,
|
|
@@ -243,11 +242,9 @@ const getSanitizedFilenameForAssetUrl = ({ src, downloadDir, contentDisposition,
|
|
|
243
242
|
};
|
|
244
243
|
exports.getSanitizedFilenameForAssetUrl = getSanitizedFilenameForAssetUrl;
|
|
245
244
|
const downloadAndMapAssetsToFileUrl = async ({ asset, onDownload, downloadMap, }) => {
|
|
246
|
-
const
|
|
247
|
-
const cleanup = (0, exports.attachDownloadListenerToEmitter)(emitter, onDownload);
|
|
245
|
+
const cleanup = (0, exports.attachDownloadListenerToEmitter)(downloadMap, onDownload);
|
|
248
246
|
const newSrc = await (0, exports.downloadAsset)({
|
|
249
247
|
src: asset.src,
|
|
250
|
-
emitter,
|
|
251
248
|
downloadMap,
|
|
252
249
|
});
|
|
253
250
|
cleanup();
|
|
@@ -257,14 +254,21 @@ const downloadAndMapAssetsToFileUrl = async ({ asset, onDownload, downloadMap, }
|
|
|
257
254
|
};
|
|
258
255
|
};
|
|
259
256
|
exports.downloadAndMapAssetsToFileUrl = downloadAndMapAssetsToFileUrl;
|
|
260
|
-
const attachDownloadListenerToEmitter = (
|
|
257
|
+
const attachDownloadListenerToEmitter = (downloadMap, onDownload) => {
|
|
261
258
|
const cleanup = [];
|
|
262
259
|
if (!onDownload) {
|
|
263
260
|
return () => undefined;
|
|
264
261
|
}
|
|
265
|
-
|
|
262
|
+
if (downloadMap.downloadListeners.includes(onDownload)) {
|
|
263
|
+
return () => undefined;
|
|
264
|
+
}
|
|
265
|
+
downloadMap.downloadListeners.push(onDownload);
|
|
266
|
+
cleanup.push(() => {
|
|
267
|
+
downloadMap.downloadListeners = downloadMap.downloadListeners.filter((l) => l !== onDownload);
|
|
268
|
+
});
|
|
269
|
+
const a = downloadMap.emitter.addEventListener('download', ({ detail: { src: initialSrc } }) => {
|
|
266
270
|
const progress = onDownload(initialSrc);
|
|
267
|
-
const b = emitter.addEventListener('progress', ({ detail: { downloaded, percent, src: progressSrc, totalSize } }) => {
|
|
271
|
+
const b = downloadMap.emitter.addEventListener('progress', ({ detail: { downloaded, percent, src: progressSrc, totalSize } }) => {
|
|
268
272
|
if (initialSrc === progressSrc) {
|
|
269
273
|
progress === null || progress === void 0 ? void 0 : progress({ downloaded, percent, totalSize });
|
|
270
274
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { TAsset } from 'remotion';
|
|
2
|
+
import { OffthreadVideoServerEmitter } from '../offthread-video-server';
|
|
3
|
+
import type { RenderMediaOnDownload } from './download-and-map-assets-to-file';
|
|
2
4
|
export type AudioChannelsAndDurationResultCache = {
|
|
3
5
|
channels: number;
|
|
4
6
|
duration: number | null;
|
|
5
7
|
};
|
|
6
8
|
export type DownloadMap = {
|
|
7
9
|
id: string;
|
|
10
|
+
emitter: OffthreadVideoServerEmitter;
|
|
11
|
+
downloadListeners: RenderMediaOnDownload[];
|
|
8
12
|
isDownloadingMap: {
|
|
9
13
|
[src: string]: {
|
|
10
14
|
[downloadDir: string]: boolean;
|
|
@@ -31,6 +31,7 @@ const node_fs_1 = __importStar(require("node:fs"));
|
|
|
31
31
|
const node_path_1 = __importDefault(require("node:path"));
|
|
32
32
|
const delete_directory_1 = require("../delete-directory");
|
|
33
33
|
const tmp_dir_1 = require("../tmp-dir");
|
|
34
|
+
const offthread_video_server_1 = require("../offthread-video-server");
|
|
34
35
|
const makeAndReturn = (dir, name) => {
|
|
35
36
|
const p = node_path_1.default.join(dir, name);
|
|
36
37
|
(0, node_fs_1.mkdirSync)(p);
|
|
@@ -51,6 +52,7 @@ const makeDownloadMap = () => {
|
|
|
51
52
|
durationOfAssetCache: {},
|
|
52
53
|
id: String(Math.random()),
|
|
53
54
|
assetDir: dir,
|
|
55
|
+
downloadListeners: [],
|
|
54
56
|
downloadDir: makeAndReturn(dir, 'remotion-assets-dir'),
|
|
55
57
|
complexFilter: makeAndReturn(dir, 'remotion-complex-filter'),
|
|
56
58
|
preEncode: makeAndReturn(dir, 'pre-encode'),
|
|
@@ -59,6 +61,7 @@ const makeDownloadMap = () => {
|
|
|
59
61
|
stitchFrames: makeAndReturn(dir, 'remotion-stitch-temp-dir'),
|
|
60
62
|
compositingDir: makeAndReturn(dir, 'remotion-compositing-temp-dir'),
|
|
61
63
|
compositorCache: {},
|
|
64
|
+
emitter: new offthread_video_server_1.OffthreadVideoServerEmitter(),
|
|
62
65
|
};
|
|
63
66
|
};
|
|
64
67
|
exports.makeDownloadMap = makeDownloadMap;
|
|
@@ -4,6 +4,9 @@ export declare const createFfmpegComplexFilter: ({ filters, downloadMap, }: {
|
|
|
4
4
|
filters: PreprocessedAudioTrack[];
|
|
5
5
|
downloadMap: DownloadMap;
|
|
6
6
|
}) => Promise<{
|
|
7
|
-
complexFilterFlag: [
|
|
7
|
+
complexFilterFlag: [
|
|
8
|
+
string,
|
|
9
|
+
string
|
|
10
|
+
] | null;
|
|
8
11
|
cleanup: () => void;
|
|
9
12
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type VideoConfig } from 'remotion';
|
|
2
2
|
import type { BrowserExecutable } from './browser-executable';
|
|
3
3
|
import type { BrowserLog } from './browser-log';
|
|
4
4
|
import type { HeadlessBrowser } from './browser/Browser';
|
|
@@ -6,7 +6,7 @@ import type { ChromiumOptions } from './open-browser';
|
|
|
6
6
|
import type { RemotionServer } from './prepare-server';
|
|
7
7
|
import { type LogLevel } from './log-level';
|
|
8
8
|
type InternalGetCompositionsOptions = {
|
|
9
|
-
|
|
9
|
+
serializedInputPropsWithCustomSchema: string;
|
|
10
10
|
envVariables: Record<string, string>;
|
|
11
11
|
puppeteerInstance: HeadlessBrowser | undefined;
|
|
12
12
|
onBrowserLog: null | ((log: BrowserLog) => void);
|
|
@@ -30,7 +30,7 @@ export type GetCompositionsOptions = {
|
|
|
30
30
|
port?: number | null;
|
|
31
31
|
logLevel?: LogLevel;
|
|
32
32
|
};
|
|
33
|
-
export declare const internalGetCompositions: ({ browserExecutable, chromiumOptions, envVariables, indent,
|
|
33
|
+
export declare const internalGetCompositions: ({ browserExecutable, chromiumOptions, envVariables, indent, serializedInputPropsWithCustomSchema, onBrowserLog, port, puppeteerInstance, serveUrlOrWebpackUrl, server, timeoutInMilliseconds, logLevel, }: InternalGetCompositionsOptions) => Promise<VideoConfig[]>;
|
|
34
34
|
/**
|
|
35
35
|
* @description Gets the compositions defined in a Remotion project based on a Webpack bundle.
|
|
36
36
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/get-compositions)
|
package/dist/get-compositions.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCompositions = exports.internalGetCompositions = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
4
5
|
const TimeoutSettings_1 = require("./browser/TimeoutSettings");
|
|
5
6
|
const handle_javascript_exception_1 = require("./error-handling/handle-javascript-exception");
|
|
6
7
|
const find_closest_package_json_1 = require("./find-closest-package-json");
|
|
@@ -11,7 +12,7 @@ const seek_to_frame_1 = require("./seek-to-frame");
|
|
|
11
12
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
12
13
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
13
14
|
const logger_1 = require("./logger");
|
|
14
|
-
const innerGetCompositions = async ({ envVariables,
|
|
15
|
+
const innerGetCompositions = async ({ envVariables, serializedInputPropsWithCustomSchema, onBrowserLog, page, proxyPort, serveUrl, timeoutInMilliseconds, indent, logLevel, }) => {
|
|
15
16
|
if (onBrowserLog) {
|
|
16
17
|
page.on('console', (log) => {
|
|
17
18
|
onBrowserLog({
|
|
@@ -23,7 +24,7 @@ const innerGetCompositions = async ({ envVariables, inputProps, onBrowserLog, pa
|
|
|
23
24
|
}
|
|
24
25
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
|
|
25
26
|
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
26
|
-
|
|
27
|
+
serializedInputPropsWithCustomSchema,
|
|
27
28
|
envVariables,
|
|
28
29
|
page,
|
|
29
30
|
serveUrl,
|
|
@@ -33,6 +34,8 @@ const innerGetCompositions = async ({ envVariables, inputProps, onBrowserLog, pa
|
|
|
33
34
|
retriesRemaining: 2,
|
|
34
35
|
audioEnabled: false,
|
|
35
36
|
videoEnabled: false,
|
|
37
|
+
indent,
|
|
38
|
+
logLevel,
|
|
36
39
|
});
|
|
37
40
|
await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
38
41
|
page,
|
|
@@ -55,7 +58,7 @@ const innerGetCompositions = async ({ envVariables, inputProps, onBrowserLog, pa
|
|
|
55
58
|
});
|
|
56
59
|
return result;
|
|
57
60
|
};
|
|
58
|
-
const internalGetCompositions = async ({ browserExecutable, chromiumOptions, envVariables, indent,
|
|
61
|
+
const internalGetCompositions = async ({ browserExecutable, chromiumOptions, envVariables, indent, serializedInputPropsWithCustomSchema, onBrowserLog, port, puppeteerInstance, serveUrlOrWebpackUrl, server, timeoutInMilliseconds, logLevel, }) => {
|
|
59
62
|
const { page, cleanup: cleanupPage } = await (0, get_browser_instance_1.getPageAndCleanupFn)({
|
|
60
63
|
passedInInstance: puppeteerInstance,
|
|
61
64
|
browserExecutable,
|
|
@@ -89,12 +92,14 @@ const internalGetCompositions = async ({ browserExecutable, chromiumOptions, env
|
|
|
89
92
|
cleanup.push(() => cleanupServer(true));
|
|
90
93
|
return innerGetCompositions({
|
|
91
94
|
envVariables,
|
|
92
|
-
|
|
95
|
+
serializedInputPropsWithCustomSchema,
|
|
93
96
|
onBrowserLog,
|
|
94
97
|
page,
|
|
95
98
|
proxyPort: offthreadPort,
|
|
96
99
|
serveUrl,
|
|
97
100
|
timeoutInMilliseconds,
|
|
101
|
+
indent,
|
|
102
|
+
logLevel,
|
|
98
103
|
});
|
|
99
104
|
})
|
|
100
105
|
.then((comp) => {
|
|
@@ -121,7 +126,11 @@ const getCompositions = (serveUrlOrWebpackUrl, config) => {
|
|
|
121
126
|
browserExecutable: browserExecutable !== null && browserExecutable !== void 0 ? browserExecutable : null,
|
|
122
127
|
chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
|
|
123
128
|
envVariables: envVariables !== null && envVariables !== void 0 ? envVariables : {},
|
|
124
|
-
|
|
129
|
+
serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
130
|
+
data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
131
|
+
indent: undefined,
|
|
132
|
+
staticBase: null,
|
|
133
|
+
}).serializedString,
|
|
125
134
|
indent: false,
|
|
126
135
|
onBrowserLog: onBrowserLog !== null && onBrowserLog !== void 0 ? onBrowserLog : null,
|
|
127
136
|
port: port !== null && port !== void 0 ? port : null,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import execa from 'execa';
|
|
3
2
|
import { HeadlessBrowser } from './browser/Browser';
|
|
4
3
|
import { SymbolicateableError } from './error-handling/symbolicateable-error';
|
|
@@ -49,7 +48,6 @@ export declare const RenderInternals: {
|
|
|
49
48
|
port: number;
|
|
50
49
|
close: () => Promise<void>;
|
|
51
50
|
compositor: import("./compositor/compositor").Compositor;
|
|
52
|
-
events: import("./offthread-video-server").OffthreadVideoServerEmitter;
|
|
53
51
|
}>;
|
|
54
52
|
validateEvenDimensionsWithCodec: ({ width, height, codec, scale, }: {
|
|
55
53
|
width: number;
|
|
@@ -114,8 +112,8 @@ export declare const RenderInternals: {
|
|
|
114
112
|
validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
|
|
115
113
|
DEFAULT_BROWSER: import("./browser").Browser;
|
|
116
114
|
validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
|
|
117
|
-
DEFAULT_OPENGL_RENDERER: "
|
|
118
|
-
validateOpenGlRenderer: (option: "
|
|
115
|
+
DEFAULT_OPENGL_RENDERER: "swangle" | "angle" | "egl" | "swiftshader" | null;
|
|
116
|
+
validateOpenGlRenderer: (option: "swangle" | "angle" | "egl" | "swiftshader" | null) => "swangle" | "angle" | "egl" | "swiftshader" | null;
|
|
119
117
|
validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
|
|
120
118
|
DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
|
|
121
119
|
validateJpegQuality: (q: number | undefined) => void;
|
|
@@ -300,8 +298,8 @@ export declare const RenderInternals: {
|
|
|
300
298
|
};
|
|
301
299
|
validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
|
|
302
300
|
validVideoImageFormats: readonly ["png", "jpeg", "none"];
|
|
303
|
-
DEFAULT_STILL_IMAGE_FORMAT: "
|
|
304
|
-
DEFAULT_VIDEO_IMAGE_FORMAT: "
|
|
301
|
+
DEFAULT_STILL_IMAGE_FORMAT: "png" | "jpeg" | "pdf" | "webp";
|
|
302
|
+
DEFAULT_VIDEO_IMAGE_FORMAT: "png" | "jpeg" | "none";
|
|
305
303
|
DEFAULT_JPEG_QUALITY: number;
|
|
306
304
|
chalk: {
|
|
307
305
|
enabled: () => boolean;
|
|
@@ -404,8 +402,9 @@ export declare const RenderInternals: {
|
|
|
404
402
|
composition: import("remotion").VideoConfig;
|
|
405
403
|
output: string | null;
|
|
406
404
|
frame: number;
|
|
407
|
-
|
|
408
|
-
|
|
405
|
+
serializedInputPropsWithCustomSchema: string;
|
|
406
|
+
serializedResolvedPropsWithCustomSchema: string;
|
|
407
|
+
imageFormat: "png" | "jpeg" | "pdf" | "webp";
|
|
409
408
|
jpegQuality: number;
|
|
410
409
|
puppeteerInstance: HeadlessBrowser | null;
|
|
411
410
|
envVariables: Record<string, string>;
|
|
@@ -435,7 +434,7 @@ export declare const RenderInternals: {
|
|
|
435
434
|
logLevel: "error" | "verbose" | "info" | "warn";
|
|
436
435
|
}) => Promise<HeadlessBrowser>;
|
|
437
436
|
internalSelectComposition: (options: {
|
|
438
|
-
|
|
437
|
+
serializedInputPropsWithCustomSchema: string;
|
|
439
438
|
envVariables: Record<string, string>;
|
|
440
439
|
puppeteerInstance: HeadlessBrowser | undefined;
|
|
441
440
|
onBrowserLog: ((log: import("./browser-log").BrowserLog) => void) | null;
|
|
@@ -452,8 +451,8 @@ export declare const RenderInternals: {
|
|
|
452
451
|
metadata: import("remotion").VideoConfig;
|
|
453
452
|
propsSize: number;
|
|
454
453
|
}>;
|
|
455
|
-
internalGetCompositions: ({ browserExecutable, chromiumOptions, envVariables, indent,
|
|
456
|
-
|
|
454
|
+
internalGetCompositions: ({ browserExecutable, chromiumOptions, envVariables, indent, serializedInputPropsWithCustomSchema, onBrowserLog, port, puppeteerInstance, serveUrlOrWebpackUrl, server, timeoutInMilliseconds, logLevel, }: {
|
|
455
|
+
serializedInputPropsWithCustomSchema: string;
|
|
457
456
|
envVariables: Record<string, string>;
|
|
458
457
|
puppeteerInstance: HeadlessBrowser | undefined;
|
|
459
458
|
onBrowserLog: ((log: import("./browser-log").BrowserLog) => void) | null;
|
|
@@ -466,8 +465,8 @@ export declare const RenderInternals: {
|
|
|
466
465
|
logLevel: "error" | "verbose" | "info" | "warn";
|
|
467
466
|
serveUrlOrWebpackUrl: string;
|
|
468
467
|
}) => Promise<import("remotion").VideoConfig[]>;
|
|
469
|
-
internalRenderFrames: ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent,
|
|
470
|
-
internalRenderMedia: ({ proResProfile, crf, composition,
|
|
468
|
+
internalRenderFrames: ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, onFrameUpdate, onStart, outputDir, port, puppeteerInstance, scale, server, timeoutInMilliseconds, logLevel, webpackBundleOrServeUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, }: import("./render-frames").InternalRenderFramesOptions) => Promise<import("./types").RenderFramesOutput>;
|
|
469
|
+
internalRenderMedia: ({ proResProfile, crf, composition, serializedInputPropsWithCustomSchema, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, audioCodec, concurrency, disallowParallelEncoding, everyNthFrame, imageFormat: provisionalImageFormat, indent, jpegQuality, numberOfGifLoops, onCtrlCExit, preferLossless, serveUrl, server: reusedServer, logLevel, serializedResolvedPropsWithCustomSchema, }: import("./render-media").InternalRenderMediaOptions) => Promise<{
|
|
471
470
|
buffer: Buffer | null;
|
|
472
471
|
slowestFrames: import("./render-media").SlowFrame[];
|
|
473
472
|
}>;
|
package/dist/logger.d.ts
CHANGED
|
@@ -18,6 +18,6 @@ export declare const Log: {
|
|
|
18
18
|
warnAdvanced: (options: LogOptions, message?: any, ...optionalParams: any[]) => void;
|
|
19
19
|
error: (message?: any, ...optionalParams: any[]) => void;
|
|
20
20
|
};
|
|
21
|
-
export declare const getLogLevel: () => "
|
|
21
|
+
export declare const getLogLevel: () => "verbose" | "info" | "warn" | "error";
|
|
22
22
|
export declare const setLogLevel: (newLogLevel: LogLevel) => void;
|
|
23
23
|
export {};
|
|
@@ -16,7 +16,6 @@ export declare const startOffthreadVideoServer: ({ downloadMap, concurrency, log
|
|
|
16
16
|
listener: RequestListener;
|
|
17
17
|
close: () => Promise<void>;
|
|
18
18
|
compositor: Compositor;
|
|
19
|
-
events: OffthreadVideoServerEmitter;
|
|
20
19
|
};
|
|
21
20
|
type DownloadEventPayload = {
|
|
22
21
|
src: string;
|
|
@@ -30,7 +30,6 @@ const extractUrlAndSourceFromUrl = (url) => {
|
|
|
30
30
|
};
|
|
31
31
|
exports.extractUrlAndSourceFromUrl = extractUrlAndSourceFromUrl;
|
|
32
32
|
const startOffthreadVideoServer = ({ downloadMap, concurrency, logLevel, indent, }) => {
|
|
33
|
-
const events = new OffthreadVideoServerEmitter();
|
|
34
33
|
const compositor = (0, compositor_1.startCompositor)('StartLongRunningProcess', {
|
|
35
34
|
concurrency,
|
|
36
35
|
maximum_frame_cache_items: (0, compositor_1.getIdealMaximumFrameCacheItems)(),
|
|
@@ -70,7 +69,7 @@ const startOffthreadVideoServer = ({ downloadMap, concurrency, logLevel, indent,
|
|
|
70
69
|
return;
|
|
71
70
|
}
|
|
72
71
|
let extractStart = Date.now();
|
|
73
|
-
(0, download_and_map_assets_to_file_1.downloadAsset)({ src,
|
|
72
|
+
(0, download_and_map_assets_to_file_1.downloadAsset)({ src, downloadMap })
|
|
74
73
|
.then((to) => {
|
|
75
74
|
extractStart = Date.now();
|
|
76
75
|
return compositor.executeCommand('ExtractFrame', {
|
|
@@ -95,12 +94,11 @@ const startOffthreadVideoServer = ({ downloadMap, concurrency, logLevel, indent,
|
|
|
95
94
|
.catch((err) => {
|
|
96
95
|
res.writeHead(500);
|
|
97
96
|
res.end();
|
|
98
|
-
|
|
97
|
+
downloadMap.emitter.dispatchError(err);
|
|
99
98
|
console.log('Error occurred', err);
|
|
100
99
|
});
|
|
101
100
|
},
|
|
102
101
|
compositor,
|
|
103
|
-
events,
|
|
104
102
|
};
|
|
105
103
|
};
|
|
106
104
|
exports.startOffthreadVideoServer = startOffthreadVideoServer;
|
package/dist/prepare-server.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
2
2
|
import type { DownloadMap } from './assets/download-map';
|
|
3
3
|
import type { Compositor } from './compositor/compositor';
|
|
4
|
-
import type { OffthreadVideoServerEmitter } from './offthread-video-server';
|
|
5
4
|
import type { AnySourceMapConsumer } from './symbolicate-stacktrace';
|
|
6
5
|
import type { LogLevel } from './log-level';
|
|
7
6
|
export type RemotionServer = {
|
|
@@ -10,7 +9,6 @@ export type RemotionServer = {
|
|
|
10
9
|
offthreadPort: number;
|
|
11
10
|
compositor: Compositor;
|
|
12
11
|
sourceMap: AnySourceMapConsumer | null;
|
|
13
|
-
events: OffthreadVideoServerEmitter;
|
|
14
12
|
downloadMap: DownloadMap;
|
|
15
13
|
};
|
|
16
14
|
type PrepareServerOptions = {
|
package/dist/prepare-server.js
CHANGED
|
@@ -18,7 +18,7 @@ const prepareServer = async ({ webpackConfigOrServeUrl, port, remotionRoot, conc
|
|
|
18
18
|
const downloadMap = (0, download_map_1.makeDownloadMap)();
|
|
19
19
|
logger_1.Log.verboseAdvanced({ indent, logLevel }, 'Created directory for temporary files', downloadMap.assetDir);
|
|
20
20
|
if ((0, is_serve_url_1.isServeUrl)(webpackConfigOrServeUrl)) {
|
|
21
|
-
const { port: offthreadPort, close: closeProxy, compositor: comp,
|
|
21
|
+
const { port: offthreadPort, close: closeProxy, compositor: comp, } = await (0, serve_static_1.serveStatic)(null, {
|
|
22
22
|
port,
|
|
23
23
|
downloadMap,
|
|
24
24
|
remotionRoot,
|
|
@@ -35,7 +35,6 @@ const prepareServer = async ({ webpackConfigOrServeUrl, port, remotionRoot, conc
|
|
|
35
35
|
offthreadPort,
|
|
36
36
|
compositor: comp,
|
|
37
37
|
sourceMap: null,
|
|
38
|
-
events,
|
|
39
38
|
downloadMap,
|
|
40
39
|
});
|
|
41
40
|
}
|
|
@@ -46,7 +45,7 @@ const prepareServer = async ({ webpackConfigOrServeUrl, port, remotionRoot, conc
|
|
|
46
45
|
throw new Error(`Tried to serve the Webpack bundle on a HTTP server, but the file ${indexFile} does not exist. Is this a valid path to a Webpack bundle?`);
|
|
47
46
|
}
|
|
48
47
|
const sourceMap = (0, symbolicate_stacktrace_1.getSourceMapFromLocalFile)(node_path_1.default.join(webpackConfigOrServeUrl, remotion_1.Internals.bundleName));
|
|
49
|
-
const { port: serverPort, close, compositor,
|
|
48
|
+
const { port: serverPort, close, compositor, } = await (0, serve_static_1.serveStatic)(webpackConfigOrServeUrl, {
|
|
50
49
|
port,
|
|
51
50
|
downloadMap,
|
|
52
51
|
remotionRoot,
|
|
@@ -67,15 +66,14 @@ const prepareServer = async ({ webpackConfigOrServeUrl, port, remotionRoot, conc
|
|
|
67
66
|
offthreadPort: serverPort,
|
|
68
67
|
compositor,
|
|
69
68
|
sourceMap: await sourceMap,
|
|
70
|
-
events: newEvents,
|
|
71
69
|
downloadMap,
|
|
72
70
|
});
|
|
73
71
|
};
|
|
74
72
|
exports.prepareServer = prepareServer;
|
|
75
73
|
const makeOrReuseServer = async (server, config, { onDownload, onError, }) => {
|
|
76
74
|
if (server) {
|
|
77
|
-
const cleanupOnDownload = (0, download_and_map_assets_to_file_1.attachDownloadListenerToEmitter)(server.
|
|
78
|
-
const cleanupError = server.
|
|
75
|
+
const cleanupOnDownload = (0, download_and_map_assets_to_file_1.attachDownloadListenerToEmitter)(server.downloadMap, onDownload);
|
|
76
|
+
const cleanupError = server.downloadMap.emitter.addEventListener('error', ({ detail: { error } }) => {
|
|
79
77
|
onError(error);
|
|
80
78
|
});
|
|
81
79
|
return {
|
|
@@ -88,8 +86,8 @@ const makeOrReuseServer = async (server, config, { onDownload, onError, }) => {
|
|
|
88
86
|
};
|
|
89
87
|
}
|
|
90
88
|
const newServer = await (0, exports.prepareServer)(config);
|
|
91
|
-
const cleanupOnDownloadNew = (0, download_and_map_assets_to_file_1.attachDownloadListenerToEmitter)(newServer.
|
|
92
|
-
const cleanupErrorNew = newServer.
|
|
89
|
+
const cleanupOnDownloadNew = (0, download_and_map_assets_to_file_1.attachDownloadListenerToEmitter)(newServer.downloadMap, onDownload);
|
|
90
|
+
const cleanupErrorNew = newServer.downloadMap.emitter.addEventListener('error', ({ detail: { error } }) => {
|
|
93
91
|
onError(error);
|
|
94
92
|
});
|
|
95
93
|
return {
|
package/dist/render-frames.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export type InternalRenderFramesOptions = {
|
|
|
15
15
|
onStart: null | ((data: OnStartData) => void);
|
|
16
16
|
onFrameUpdate: null | ((framesRendered: number, frameIndex: number, timeToRenderInMilliseconds: number) => void);
|
|
17
17
|
outputDir: string | null;
|
|
18
|
-
inputProps: Record<string, unknown>;
|
|
19
18
|
envVariables: Record<string, string>;
|
|
20
19
|
imageFormat: VideoImageFormat;
|
|
21
20
|
jpegQuality: number;
|
|
@@ -31,13 +30,15 @@ export type InternalRenderFramesOptions = {
|
|
|
31
30
|
scale: number;
|
|
32
31
|
port: number | null;
|
|
33
32
|
cancelSignal: CancelSignal | undefined;
|
|
34
|
-
composition: VideoConfig
|
|
33
|
+
composition: Omit<VideoConfig, 'props' | 'defaultProps'>;
|
|
35
34
|
indent: boolean;
|
|
36
35
|
server: RemotionServer | undefined;
|
|
37
36
|
muted: boolean;
|
|
38
37
|
concurrency: number | string | null;
|
|
39
38
|
webpackBundleOrServeUrl: string;
|
|
40
39
|
logLevel: LogLevel;
|
|
40
|
+
serializedInputPropsWithCustomSchema: string;
|
|
41
|
+
serializedResolvedPropsWithCustomSchema: string;
|
|
41
42
|
};
|
|
42
43
|
export type RenderFramesOptions = {
|
|
43
44
|
onStart: (data: OnStartData) => void;
|
|
@@ -77,7 +78,7 @@ export type RenderFramesOptions = {
|
|
|
77
78
|
concurrency?: number | string | null;
|
|
78
79
|
serveUrl: string;
|
|
79
80
|
};
|
|
80
|
-
export declare const internalRenderFrames: ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent,
|
|
81
|
+
export declare const internalRenderFrames: ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, onFrameUpdate, onStart, outputDir, port, puppeteerInstance, scale, server, timeoutInMilliseconds, logLevel, webpackBundleOrServeUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, }: InternalRenderFramesOptions) => Promise<RenderFramesOutput>;
|
|
81
82
|
/**
|
|
82
83
|
* @description Renders a series of images using Puppeteer and computes information for mixing audio.
|
|
83
84
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/render-frames)
|
package/dist/render-frames.js
CHANGED
|
@@ -35,7 +35,7 @@ const truthy_1 = require("./truthy");
|
|
|
35
35
|
const validate_scale_1 = require("./validate-scale");
|
|
36
36
|
const logger_1 = require("./logger");
|
|
37
37
|
const MAX_RETRIES_PER_FRAME = 1;
|
|
38
|
-
const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart,
|
|
38
|
+
const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, jpegQuality, imageFormat, frameRange, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale, actualConcurrency, everyNthFrame, proxyPort, cancelSignal, downloadMap, muted, makeBrowser, browserReplacer, compositor, sourcemapContext, logLevel, indent, }) => {
|
|
39
39
|
if (outputDir) {
|
|
40
40
|
if (!node_fs_1.default.existsSync(outputDir)) {
|
|
41
41
|
node_fs_1.default.mkdirSync(outputDir, {
|
|
@@ -69,7 +69,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, inputProps
|
|
|
69
69
|
}
|
|
70
70
|
const initialFrame = realFrameRange[0];
|
|
71
71
|
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
72
|
-
|
|
72
|
+
serializedInputPropsWithCustomSchema,
|
|
73
73
|
envVariables,
|
|
74
74
|
page,
|
|
75
75
|
serveUrl,
|
|
@@ -79,6 +79,8 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, inputProps
|
|
|
79
79
|
retriesRemaining: 2,
|
|
80
80
|
audioEnabled: !muted,
|
|
81
81
|
videoEnabled: imageFormat !== 'none',
|
|
82
|
+
indent,
|
|
83
|
+
logLevel,
|
|
82
84
|
});
|
|
83
85
|
await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
84
86
|
// eslint-disable-next-line max-params
|
|
@@ -86,7 +88,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, inputProps
|
|
|
86
88
|
window.remotion_setBundleMode({
|
|
87
89
|
type: 'composition',
|
|
88
90
|
compositionName: id,
|
|
89
|
-
props,
|
|
91
|
+
serializedResolvedPropsWithSchema: props,
|
|
90
92
|
compositionDurationInFrames: durationInFrames,
|
|
91
93
|
compositionFps: fps,
|
|
92
94
|
compositionHeight: height,
|
|
@@ -95,7 +97,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, inputProps
|
|
|
95
97
|
},
|
|
96
98
|
args: [
|
|
97
99
|
composition.id,
|
|
98
|
-
|
|
100
|
+
serializedResolvedPropsWithCustomSchema,
|
|
99
101
|
composition.durationInFrames,
|
|
100
102
|
composition.fps,
|
|
101
103
|
composition.height,
|
|
@@ -292,7 +294,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, inputProps
|
|
|
292
294
|
await Promise.all(downloadPromises);
|
|
293
295
|
return result;
|
|
294
296
|
};
|
|
295
|
-
const internalRenderFrames = ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent,
|
|
297
|
+
const internalRenderFrames = ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, onFrameUpdate, onStart, outputDir, port, puppeteerInstance, scale, server, timeoutInMilliseconds, logLevel, webpackBundleOrServeUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, }) => {
|
|
296
298
|
remotion_1.Internals.validateDimension(composition.height, 'height', 'in the `config` object passed to `renderFrames()`');
|
|
297
299
|
remotion_1.Internals.validateDimension(composition.width, 'width', 'in the `config` object passed to `renderFrames()`');
|
|
298
300
|
remotion_1.Internals.validateFps(composition.fps, 'in the `config` object of `renderFrames()`', false);
|
|
@@ -338,9 +340,11 @@ const internalRenderFrames = ({ browserExecutable, cancelSignal, chromiumOptions
|
|
|
338
340
|
onError,
|
|
339
341
|
}),
|
|
340
342
|
browserInstance,
|
|
341
|
-
]).then(([{ server:
|
|
343
|
+
]).then(([{ server: openedServer, cleanupServer }, pInstance]) => {
|
|
344
|
+
const { serveUrl, offthreadPort, compositor, sourceMap, downloadMap } = openedServer;
|
|
342
345
|
const browserReplacer = (0, replace_browser_1.handleBrowserCrash)(pInstance, logLevel, indent);
|
|
343
|
-
cleanup.push((0, cycle_browser_tabs_1.cycleBrowserTabs)(browserReplacer, actualConcurrency, logLevel, indent)
|
|
346
|
+
cleanup.push((0, cycle_browser_tabs_1.cycleBrowserTabs)(browserReplacer, actualConcurrency, logLevel, indent)
|
|
347
|
+
.stopCycling);
|
|
344
348
|
cleanup.push(() => cleanupServer(false));
|
|
345
349
|
return innerRenderFrames({
|
|
346
350
|
onError,
|
|
@@ -360,7 +364,6 @@ const internalRenderFrames = ({ browserExecutable, cancelSignal, chromiumOptions
|
|
|
360
364
|
everyNthFrame,
|
|
361
365
|
frameRange,
|
|
362
366
|
imageFormat,
|
|
363
|
-
inputProps,
|
|
364
367
|
jpegQuality,
|
|
365
368
|
muted,
|
|
366
369
|
onBrowserLog,
|
|
@@ -372,6 +375,8 @@ const internalRenderFrames = ({ browserExecutable, cancelSignal, chromiumOptions
|
|
|
372
375
|
timeoutInMilliseconds,
|
|
373
376
|
logLevel,
|
|
374
377
|
indent,
|
|
378
|
+
serializedInputPropsWithCustomSchema,
|
|
379
|
+
serializedResolvedPropsWithCustomSchema,
|
|
375
380
|
});
|
|
376
381
|
}),
|
|
377
382
|
])
|
|
@@ -438,7 +443,16 @@ const renderFrames = (options) => {
|
|
|
438
443
|
indent: false,
|
|
439
444
|
jpegQuality: jpegQuality !== null && jpegQuality !== void 0 ? jpegQuality : jpeg_quality_1.DEFAULT_JPEG_QUALITY,
|
|
440
445
|
onDownload: onDownload !== null && onDownload !== void 0 ? onDownload : null,
|
|
441
|
-
|
|
446
|
+
serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
447
|
+
indent: undefined,
|
|
448
|
+
staticBase: null,
|
|
449
|
+
data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
450
|
+
}).serializedString,
|
|
451
|
+
serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
452
|
+
indent: undefined,
|
|
453
|
+
staticBase: null,
|
|
454
|
+
data: composition.props,
|
|
455
|
+
}).serializedString,
|
|
442
456
|
puppeteerInstance,
|
|
443
457
|
muted: muted !== null && muted !== void 0 ? muted : false,
|
|
444
458
|
onBrowserLog: onBrowserLog !== null && onBrowserLog !== void 0 ? onBrowserLog : null,
|
package/dist/render-media.d.ts
CHANGED
|
@@ -32,8 +32,9 @@ export type RenderMediaOnProgress = (progress: {
|
|
|
32
32
|
export type InternalRenderMediaOptions = {
|
|
33
33
|
outputLocation: string | null;
|
|
34
34
|
codec: Codec;
|
|
35
|
-
composition: VideoConfig
|
|
36
|
-
|
|
35
|
+
composition: Omit<VideoConfig, 'props' | 'defaultProps'>;
|
|
36
|
+
serializedInputPropsWithCustomSchema: string;
|
|
37
|
+
serializedResolvedPropsWithCustomSchema: string;
|
|
37
38
|
crf: number | null;
|
|
38
39
|
imageFormat: VideoImageFormat;
|
|
39
40
|
pixelFormat: PixelFormat;
|
|
@@ -124,7 +125,7 @@ type RenderMediaResult = {
|
|
|
124
125
|
buffer: Buffer | null;
|
|
125
126
|
slowestFrames: SlowFrame[];
|
|
126
127
|
};
|
|
127
|
-
export declare const internalRenderMedia: ({ proResProfile, crf, composition,
|
|
128
|
+
export declare const internalRenderMedia: ({ proResProfile, crf, composition, serializedInputPropsWithCustomSchema, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, audioCodec, concurrency, disallowParallelEncoding, everyNthFrame, imageFormat: provisionalImageFormat, indent, jpegQuality, numberOfGifLoops, onCtrlCExit, preferLossless, serveUrl, server: reusedServer, logLevel, serializedResolvedPropsWithCustomSchema, }: InternalRenderMediaOptions) => Promise<RenderMediaResult>;
|
|
128
129
|
/**
|
|
129
130
|
*
|
|
130
131
|
* @description Render a video from a composition
|
package/dist/render-media.js
CHANGED
|
@@ -43,7 +43,7 @@ const validate_output_filename_1 = require("./validate-output-filename");
|
|
|
43
43
|
const validate_scale_1 = require("./validate-scale");
|
|
44
44
|
const validate_videobitrate_1 = require("./validate-videobitrate");
|
|
45
45
|
const SLOWEST_FRAME_COUNT = 10;
|
|
46
|
-
const internalRenderMedia = ({ proResProfile, crf, composition,
|
|
46
|
+
const internalRenderMedia = ({ proResProfile, crf, composition, serializedInputPropsWithCustomSchema, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, audioCodec, concurrency, disallowParallelEncoding, everyNthFrame, imageFormat: provisionalImageFormat, indent, jpegQuality, numberOfGifLoops, onCtrlCExit, preferLossless, serveUrl, server: reusedServer, logLevel, serializedResolvedPropsWithCustomSchema, }) => {
|
|
47
47
|
(0, jpeg_quality_1.validateJpegQuality)(jpegQuality);
|
|
48
48
|
(0, crf_1.validateQualitySettings)({ crf, codec, videoBitrate });
|
|
49
49
|
(0, validate_videobitrate_1.validateBitrate)(audioBitrate, 'audioBitrate');
|
|
@@ -250,7 +250,7 @@ const internalRenderMedia = ({ proResProfile, crf, composition, inputProps, pixe
|
|
|
250
250
|
callUpdate();
|
|
251
251
|
onStart === null || onStart === void 0 ? void 0 : onStart(data);
|
|
252
252
|
},
|
|
253
|
-
|
|
253
|
+
serializedInputPropsWithCustomSchema,
|
|
254
254
|
envVariables,
|
|
255
255
|
imageFormat,
|
|
256
256
|
jpegQuality,
|
|
@@ -290,6 +290,7 @@ const internalRenderMedia = ({ proResProfile, crf, composition, inputProps, pixe
|
|
|
290
290
|
logLevel,
|
|
291
291
|
indent,
|
|
292
292
|
server,
|
|
293
|
+
serializedResolvedPropsWithCustomSchema,
|
|
293
294
|
});
|
|
294
295
|
return renderFramesProc;
|
|
295
296
|
})
|
|
@@ -426,7 +427,11 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
426
427
|
ffmpegOverride: ffmpegOverride !== null && ffmpegOverride !== void 0 ? ffmpegOverride : undefined,
|
|
427
428
|
frameRange: frameRange !== null && frameRange !== void 0 ? frameRange : null,
|
|
428
429
|
imageFormat: imageFormat !== null && imageFormat !== void 0 ? imageFormat : image_format_1.DEFAULT_VIDEO_IMAGE_FORMAT,
|
|
429
|
-
|
|
430
|
+
serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
431
|
+
indent: undefined,
|
|
432
|
+
staticBase: null,
|
|
433
|
+
data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
434
|
+
}).serializedString,
|
|
430
435
|
jpegQuality: (_a = jpegQuality !== null && jpegQuality !== void 0 ? jpegQuality : quality) !== null && _a !== void 0 ? _a : jpeg_quality_1.DEFAULT_JPEG_QUALITY,
|
|
431
436
|
muted: muted !== null && muted !== void 0 ? muted : false,
|
|
432
437
|
numberOfGifLoops: numberOfGifLoops !== null && numberOfGifLoops !== void 0 ? numberOfGifLoops : null,
|
|
@@ -447,6 +452,11 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
447
452
|
indent: false,
|
|
448
453
|
onCtrlCExit: () => undefined,
|
|
449
454
|
server: undefined,
|
|
455
|
+
serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
456
|
+
indent: undefined,
|
|
457
|
+
staticBase: null,
|
|
458
|
+
data: composition.props,
|
|
459
|
+
}).serializedString,
|
|
450
460
|
});
|
|
451
461
|
};
|
|
452
462
|
exports.renderMedia = renderMedia;
|
package/dist/render-still.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ type InternalRenderStillOptions = {
|
|
|
13
13
|
composition: VideoConfig;
|
|
14
14
|
output: string | null;
|
|
15
15
|
frame: number;
|
|
16
|
-
|
|
16
|
+
serializedInputPropsWithCustomSchema: string;
|
|
17
|
+
serializedResolvedPropsWithCustomSchema: string;
|
|
17
18
|
imageFormat: StillImageFormat;
|
|
18
19
|
jpegQuality: number;
|
|
19
20
|
puppeteerInstance: HeadlessBrowser | null;
|
package/dist/render-still.js
CHANGED
|
@@ -49,7 +49,7 @@ const take_frame_and_compose_1 = require("./take-frame-and-compose");
|
|
|
49
49
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
50
50
|
const validate_scale_1 = require("./validate-scale");
|
|
51
51
|
const logger_1 = require("./logger");
|
|
52
|
-
const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFAULT_STILL_IMAGE_FORMAT, serveUrl, puppeteerInstance, onError,
|
|
52
|
+
const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFAULT_STILL_IMAGE_FORMAT, serveUrl, puppeteerInstance, onError, serializedInputPropsWithCustomSchema, envVariables, output, frame = 0, overwrite, browserExecutable, timeoutInMilliseconds, chromiumOptions, scale, proxyPort, cancelSignal, jpegQuality, onBrowserLog, compositor, sourceMapContext, downloadMap, logLevel, indent, serializedResolvedPropsWithCustomSchema, }) => {
|
|
53
53
|
remotion_1.Internals.validateDimension(composition.height, 'height', 'in the `config` object passed to `renderStill()`');
|
|
54
54
|
remotion_1.Internals.validateDimension(composition.width, 'width', 'in the `config` object passed to `renderStill()`');
|
|
55
55
|
remotion_1.Internals.validateFps(composition.fps, 'in the `config` object of `renderStill()`', false);
|
|
@@ -134,7 +134,7 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
|
|
|
134
134
|
page.on('console', logCallback);
|
|
135
135
|
}
|
|
136
136
|
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
137
|
-
|
|
137
|
+
serializedInputPropsWithCustomSchema,
|
|
138
138
|
envVariables,
|
|
139
139
|
page,
|
|
140
140
|
serveUrl,
|
|
@@ -144,6 +144,8 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
|
|
|
144
144
|
retriesRemaining: 2,
|
|
145
145
|
audioEnabled: false,
|
|
146
146
|
videoEnabled: true,
|
|
147
|
+
indent,
|
|
148
|
+
logLevel,
|
|
147
149
|
});
|
|
148
150
|
await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
149
151
|
// eslint-disable-next-line max-params
|
|
@@ -151,7 +153,7 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
|
|
|
151
153
|
window.remotion_setBundleMode({
|
|
152
154
|
type: 'composition',
|
|
153
155
|
compositionName: id,
|
|
154
|
-
props,
|
|
156
|
+
serializedResolvedPropsWithSchema: props,
|
|
155
157
|
compositionDurationInFrames: durationInFrames,
|
|
156
158
|
compositionFps: fps,
|
|
157
159
|
compositionHeight: height,
|
|
@@ -160,7 +162,7 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
|
|
|
160
162
|
},
|
|
161
163
|
args: [
|
|
162
164
|
composition.id,
|
|
163
|
-
|
|
165
|
+
serializedResolvedPropsWithCustomSchema,
|
|
164
166
|
composition.durationInFrames,
|
|
165
167
|
composition.fps,
|
|
166
168
|
composition.height,
|
|
@@ -239,7 +241,7 @@ exports.internalRenderStill = internalRenderStill;
|
|
|
239
241
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/render-still)
|
|
240
242
|
*/
|
|
241
243
|
const renderStill = (options) => {
|
|
242
|
-
var _a;
|
|
244
|
+
var _a, _b;
|
|
243
245
|
const { composition, serveUrl, browserExecutable, cancelSignal, chromiumOptions, dumpBrowserLogs, envVariables, frame, imageFormat, inputProps, jpegQuality, onBrowserLog, onDownload, output, overwrite, port, puppeteerInstance, scale, timeoutInMilliseconds, verbose, quality, } = options;
|
|
244
246
|
if (typeof jpegQuality !== 'undefined' && imageFormat !== 'jpeg') {
|
|
245
247
|
throw new Error("You can only pass the `quality` option if `imageFormat` is 'jpeg'.");
|
|
@@ -256,7 +258,11 @@ const renderStill = (options) => {
|
|
|
256
258
|
frame: frame !== null && frame !== void 0 ? frame : 0,
|
|
257
259
|
imageFormat: imageFormat !== null && imageFormat !== void 0 ? imageFormat : image_format_1.DEFAULT_STILL_IMAGE_FORMAT,
|
|
258
260
|
indent: false,
|
|
259
|
-
|
|
261
|
+
serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
262
|
+
staticBase: null,
|
|
263
|
+
indent: undefined,
|
|
264
|
+
data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
265
|
+
}).serializedString,
|
|
260
266
|
jpegQuality: (_a = jpegQuality !== null && jpegQuality !== void 0 ? jpegQuality : quality) !== null && _a !== void 0 ? _a : jpeg_quality_1.DEFAULT_JPEG_QUALITY,
|
|
261
267
|
onBrowserLog: onBrowserLog !== null && onBrowserLog !== void 0 ? onBrowserLog : null,
|
|
262
268
|
onDownload: onDownload !== null && onDownload !== void 0 ? onDownload : null,
|
|
@@ -269,6 +275,11 @@ const renderStill = (options) => {
|
|
|
269
275
|
serveUrl,
|
|
270
276
|
timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : TimeoutSettings_1.DEFAULT_TIMEOUT,
|
|
271
277
|
logLevel: verbose || dumpBrowserLogs ? 'verbose' : (0, logger_1.getLogLevel)(),
|
|
278
|
+
serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
279
|
+
indent: undefined,
|
|
280
|
+
staticBase: null,
|
|
281
|
+
data: (_b = composition.props) !== null && _b !== void 0 ? _b : {},
|
|
282
|
+
}).serializedString,
|
|
272
283
|
});
|
|
273
284
|
};
|
|
274
285
|
exports.renderStill = renderStill;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type VideoConfig } from 'remotion';
|
|
2
2
|
import type { BrowserExecutable } from './browser-executable';
|
|
3
3
|
import type { BrowserLog } from './browser-log';
|
|
4
4
|
import type { HeadlessBrowser } from './browser/Browser';
|
|
@@ -6,7 +6,7 @@ import type { ChromiumOptions } from './open-browser';
|
|
|
6
6
|
import type { RemotionServer } from './prepare-server';
|
|
7
7
|
import { type LogLevel } from './log-level';
|
|
8
8
|
type InternalSelectCompositionsConfig = {
|
|
9
|
-
|
|
9
|
+
serializedInputPropsWithCustomSchema: string;
|
|
10
10
|
envVariables: Record<string, string>;
|
|
11
11
|
puppeteerInstance: HeadlessBrowser | undefined;
|
|
12
12
|
onBrowserLog: null | ((log: BrowserLog) => void);
|
|
@@ -42,5 +42,5 @@ export declare const internalSelectComposition: (options: InternalSelectComposit
|
|
|
42
42
|
* @description Gets a composition defined in a Remotion project based on a Webpack bundle.
|
|
43
43
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/select-composition)
|
|
44
44
|
*/
|
|
45
|
-
export declare const selectComposition: (options: SelectCompositionOptions) => Promise<VideoConfig
|
|
45
|
+
export declare const selectComposition: (options: SelectCompositionOptions) => Promise<Omit<VideoConfig, 'defaultProps'>>;
|
|
46
46
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.selectComposition = exports.internalSelectComposition = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
4
5
|
const TimeoutSettings_1 = require("./browser/TimeoutSettings");
|
|
5
6
|
const handle_javascript_exception_1 = require("./error-handling/handle-javascript-exception");
|
|
6
7
|
const find_closest_package_json_1 = require("./find-closest-package-json");
|
|
@@ -11,7 +12,7 @@ const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
|
11
12
|
const seek_to_frame_1 = require("./seek-to-frame");
|
|
12
13
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
13
14
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
14
|
-
const innerSelectComposition = async ({ page, onBrowserLog,
|
|
15
|
+
const innerSelectComposition = async ({ page, onBrowserLog, serializedInputPropsWithCustomSchema, envVariables, serveUrl, timeoutInMilliseconds, port, id, indent, logLevel, }) => {
|
|
15
16
|
if (onBrowserLog) {
|
|
16
17
|
page.on('console', (log) => {
|
|
17
18
|
onBrowserLog({
|
|
@@ -23,7 +24,7 @@ const innerSelectComposition = async ({ page, onBrowserLog, inputProps, envVaria
|
|
|
23
24
|
}
|
|
24
25
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
|
|
25
26
|
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
26
|
-
|
|
27
|
+
serializedInputPropsWithCustomSchema,
|
|
27
28
|
envVariables,
|
|
28
29
|
page,
|
|
29
30
|
serveUrl,
|
|
@@ -33,6 +34,8 @@ const innerSelectComposition = async ({ page, onBrowserLog, inputProps, envVaria
|
|
|
33
34
|
retriesRemaining: 2,
|
|
34
35
|
audioEnabled: false,
|
|
35
36
|
videoEnabled: false,
|
|
37
|
+
indent,
|
|
38
|
+
logLevel,
|
|
36
39
|
});
|
|
37
40
|
await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
38
41
|
page,
|
|
@@ -64,11 +67,24 @@ const innerSelectComposition = async ({ page, onBrowserLog, inputProps, envVaria
|
|
|
64
67
|
tag: 'selectComposition()',
|
|
65
68
|
logLevel,
|
|
66
69
|
}, `calculateMetadata() took ${Date.now() - time}ms`);
|
|
67
|
-
|
|
70
|
+
const res = result;
|
|
71
|
+
const { width, durationInFrames, fps, height } = res;
|
|
72
|
+
return {
|
|
73
|
+
metadata: {
|
|
74
|
+
id,
|
|
75
|
+
width,
|
|
76
|
+
height,
|
|
77
|
+
fps,
|
|
78
|
+
durationInFrames,
|
|
79
|
+
props: remotion_1.Internals.deserializeJSONWithCustomFields(res.serializedResolvedPropsWithCustomSchema),
|
|
80
|
+
defaultProps: remotion_1.Internals.deserializeJSONWithCustomFields(res.serializedDefaultPropsWithCustomSchema),
|
|
81
|
+
},
|
|
82
|
+
propsSize: size,
|
|
83
|
+
};
|
|
68
84
|
};
|
|
69
85
|
const internalSelectComposition = async (options) => {
|
|
70
86
|
const cleanup = [];
|
|
71
|
-
const { puppeteerInstance, browserExecutable, chromiumOptions, serveUrl: serveUrlOrWebpackUrl, logLevel, indent, port, envVariables, id,
|
|
87
|
+
const { puppeteerInstance, browserExecutable, chromiumOptions, serveUrl: serveUrlOrWebpackUrl, logLevel, indent, port, envVariables, id, serializedInputPropsWithCustomSchema, onBrowserLog, server, timeoutInMilliseconds, } = options;
|
|
72
88
|
const { page, cleanup: cleanupPage } = await (0, get_browser_instance_1.getPageAndCleanupFn)({
|
|
73
89
|
passedInInstance: puppeteerInstance,
|
|
74
90
|
browserExecutable,
|
|
@@ -108,7 +124,7 @@ const internalSelectComposition = async (options) => {
|
|
|
108
124
|
chromiumOptions,
|
|
109
125
|
envVariables,
|
|
110
126
|
id,
|
|
111
|
-
|
|
127
|
+
serializedInputPropsWithCustomSchema,
|
|
112
128
|
onBrowserLog,
|
|
113
129
|
timeoutInMilliseconds,
|
|
114
130
|
logLevel,
|
|
@@ -143,7 +159,11 @@ const selectComposition = async (options) => {
|
|
|
143
159
|
browserExecutable: browserExecutable !== null && browserExecutable !== void 0 ? browserExecutable : null,
|
|
144
160
|
chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
|
|
145
161
|
envVariables: envVariables !== null && envVariables !== void 0 ? envVariables : {},
|
|
146
|
-
|
|
162
|
+
serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
163
|
+
indent: undefined,
|
|
164
|
+
staticBase: null,
|
|
165
|
+
data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
166
|
+
}).serializedString,
|
|
147
167
|
onBrowserLog: onBrowserLog !== null && onBrowserLog !== void 0 ? onBrowserLog : null,
|
|
148
168
|
port: port !== null && port !== void 0 ? port : null,
|
|
149
169
|
puppeteerInstance,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SerializedJSONWithCustomFields } from 'remotion';
|
|
2
|
+
export declare const serializeJSONWithDate: ({ data, indent, staticBase, }: {
|
|
3
|
+
data: Record<string, unknown>;
|
|
4
|
+
indent: number | undefined;
|
|
5
|
+
staticBase: string | null;
|
|
6
|
+
}) => SerializedJSONWithCustomFields;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeJSONWithDate = void 0;
|
|
4
|
+
// Keep in sync with /packages/core/src/input-props-serialization.ts
|
|
5
|
+
const DATE_TOKEN = 'remotion-date:';
|
|
6
|
+
const FILE_TOKEN = 'remotion-file:';
|
|
7
|
+
const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
|
|
8
|
+
let customDateUsed = false;
|
|
9
|
+
let customFileUsed = false;
|
|
10
|
+
let mapUsed = false;
|
|
11
|
+
let setUsed = false;
|
|
12
|
+
const serializedString = JSON.stringify(data, function (key, value) {
|
|
13
|
+
const item = this[key];
|
|
14
|
+
if (item instanceof Date) {
|
|
15
|
+
customDateUsed = true;
|
|
16
|
+
return `${DATE_TOKEN}${item.toISOString()}`;
|
|
17
|
+
}
|
|
18
|
+
if (item instanceof Map) {
|
|
19
|
+
mapUsed = true;
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
if (item instanceof Set) {
|
|
23
|
+
setUsed = true;
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
if (typeof item === 'string' &&
|
|
27
|
+
staticBase !== null &&
|
|
28
|
+
item.startsWith(staticBase)) {
|
|
29
|
+
customFileUsed = true;
|
|
30
|
+
return `${FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}, indent);
|
|
34
|
+
return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
|
|
35
|
+
};
|
|
36
|
+
exports.serializeJSONWithDate = serializeJSONWithDate;
|
|
@@ -169,7 +169,7 @@ const serveHandler = async (request, response, config) => {
|
|
|
169
169
|
return sendError(absolutePath, response, {
|
|
170
170
|
statusCode: 404,
|
|
171
171
|
code: 'not_found',
|
|
172
|
-
message: 'The requested path could not be found',
|
|
172
|
+
message: 'The requested path (' + absolutePath + ') could not be found',
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
let streamOpts = null;
|
package/dist/serve-static.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { DownloadMap } from './assets/download-map';
|
|
2
2
|
import type { Compositor } from './compositor/compositor';
|
|
3
|
-
import type { OffthreadVideoServerEmitter } from './offthread-video-server';
|
|
4
3
|
import type { LogLevel } from './log-level';
|
|
5
4
|
export declare const serveStatic: (path: string | null, options: {
|
|
6
5
|
port: number | null;
|
|
@@ -13,5 +12,4 @@ export declare const serveStatic: (path: string | null, options: {
|
|
|
13
12
|
port: number;
|
|
14
13
|
close: () => Promise<void>;
|
|
15
14
|
compositor: Compositor;
|
|
16
|
-
events: OffthreadVideoServerEmitter;
|
|
17
15
|
}>;
|
package/dist/serve-static.js
CHANGED
|
@@ -9,7 +9,7 @@ const get_port_1 = require("./get-port");
|
|
|
9
9
|
const offthread_video_server_1 = require("./offthread-video-server");
|
|
10
10
|
const serve_handler_1 = require("./serve-handler");
|
|
11
11
|
const serveStatic = async (path, options) => {
|
|
12
|
-
const { listener: offthreadRequest, close: closeCompositor, compositor,
|
|
12
|
+
const { listener: offthreadRequest, close: closeCompositor, compositor, } = (0, offthread_video_server_1.startOffthreadVideoServer)({
|
|
13
13
|
downloadMap: options.downloadMap,
|
|
14
14
|
concurrency: options.concurrency,
|
|
15
15
|
logLevel: options.logLevel,
|
|
@@ -85,7 +85,7 @@ const serveStatic = async (path, options) => {
|
|
|
85
85
|
}),
|
|
86
86
|
]);
|
|
87
87
|
};
|
|
88
|
-
return { port: selectedPort, close, compositor
|
|
88
|
+
return { port: selectedPort, close, compositor };
|
|
89
89
|
}
|
|
90
90
|
catch (err) {
|
|
91
91
|
if (!(err instanceof Error)) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Page } from './browser/BrowserPage';
|
|
2
|
+
import type { LogLevel } from './log-level';
|
|
2
3
|
type SetPropsAndEnv = {
|
|
3
|
-
|
|
4
|
+
serializedInputPropsWithCustomSchema: string;
|
|
4
5
|
envVariables: Record<string, string> | undefined;
|
|
5
6
|
page: Page;
|
|
6
7
|
serveUrl: string;
|
|
@@ -10,6 +11,8 @@ type SetPropsAndEnv = {
|
|
|
10
11
|
retriesRemaining: number;
|
|
11
12
|
audioEnabled: boolean;
|
|
12
13
|
videoEnabled: boolean;
|
|
14
|
+
indent: boolean;
|
|
15
|
+
logLevel: LogLevel;
|
|
13
16
|
};
|
|
14
17
|
export declare const setPropsAndEnv: (params: SetPropsAndEnv) => Promise<unknown>;
|
|
15
18
|
export {};
|
|
@@ -8,7 +8,7 @@ const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
|
8
8
|
const redirect_status_codes_1 = require("./redirect-status-codes");
|
|
9
9
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
10
10
|
const logger_1 = require("./logger");
|
|
11
|
-
const innerSetPropsAndEnv = async ({
|
|
11
|
+
const innerSetPropsAndEnv = async ({ serializedInputPropsWithCustomSchema, envVariables, page, serveUrl, initialFrame, timeoutInMilliseconds, proxyPort, retriesRemaining, audioEnabled, videoEnabled, indent, logLevel, }) => {
|
|
12
12
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
|
|
13
13
|
const actualTimeout = timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : TimeoutSettings_1.DEFAULT_TIMEOUT;
|
|
14
14
|
page.setDefaultTimeout(actualTimeout);
|
|
@@ -17,14 +17,9 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
|
|
|
17
17
|
await page.evaluateOnNewDocument((timeout) => {
|
|
18
18
|
window.remotion_puppeteerTimeout = timeout;
|
|
19
19
|
}, actualTimeout);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
if (inputProps) {
|
|
24
|
-
await page.evaluateOnNewDocument((input) => {
|
|
25
|
-
window.remotion_inputProps = input;
|
|
26
|
-
}, JSON.stringify(inputProps));
|
|
27
|
-
}
|
|
20
|
+
await page.evaluateOnNewDocument((input) => {
|
|
21
|
+
window.remotion_inputProps = input;
|
|
22
|
+
}, serializedInputPropsWithCustomSchema);
|
|
28
23
|
if (envVariables) {
|
|
29
24
|
await page.evaluateOnNewDocument((input) => {
|
|
30
25
|
window.remotion_envVariables = input;
|
|
@@ -58,7 +53,7 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
|
|
|
58
53
|
return innerSetPropsAndEnv({
|
|
59
54
|
envVariables,
|
|
60
55
|
initialFrame,
|
|
61
|
-
|
|
56
|
+
serializedInputPropsWithCustomSchema,
|
|
62
57
|
page,
|
|
63
58
|
proxyPort,
|
|
64
59
|
retriesRemaining: retriesRemaining - 1,
|
|
@@ -66,12 +61,14 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
|
|
|
66
61
|
timeoutInMilliseconds,
|
|
67
62
|
audioEnabled,
|
|
68
63
|
videoEnabled,
|
|
64
|
+
indent,
|
|
65
|
+
logLevel,
|
|
69
66
|
});
|
|
70
67
|
}
|
|
71
68
|
if (!redirect_status_codes_1.redirectStatusCodes.every((code) => code !== status)) {
|
|
72
69
|
throw new Error(`Error while getting compositions: Tried to go to ${urlToVisit} but the status code was ${status} instead of 200. Does the site you specified exist?`);
|
|
73
70
|
}
|
|
74
|
-
const isRemotionFn = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
71
|
+
const { value: isRemotionFn } = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
75
72
|
pageFunction: () => {
|
|
76
73
|
return window.getStaticCompositions;
|
|
77
74
|
},
|
|
@@ -79,8 +76,23 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
|
|
|
79
76
|
frame: null,
|
|
80
77
|
page,
|
|
81
78
|
});
|
|
82
|
-
if (isRemotionFn === undefined) {
|
|
83
|
-
|
|
79
|
+
if (typeof isRemotionFn === 'undefined') {
|
|
80
|
+
const { value: body } = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
81
|
+
pageFunction: () => {
|
|
82
|
+
return document.body.innerHTML;
|
|
83
|
+
},
|
|
84
|
+
args: [],
|
|
85
|
+
frame: null,
|
|
86
|
+
page,
|
|
87
|
+
});
|
|
88
|
+
const errorMessage = [
|
|
89
|
+
`Error while getting compositions: Tried to go to ${urlToVisit} and verify that it is a Remotion project by checking if window.getStaticCompositions is defined.`,
|
|
90
|
+
'However, the function was undefined, which indicates that this is not a valid Remotion project. Please check the URL you passed.',
|
|
91
|
+
'The page loaded contained the following markup:',
|
|
92
|
+
body.substring(0, 500) + (body.length > 500 ? '...' : ''),
|
|
93
|
+
'Does this look like a foreign page? If so, try to stop this server.',
|
|
94
|
+
].join('\n');
|
|
95
|
+
throw new Error(errorMessage);
|
|
84
96
|
}
|
|
85
97
|
const { value: siteVersion } = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
86
98
|
pageFunction: () => {
|
|
@@ -98,16 +110,22 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
|
|
|
98
110
|
frame: null,
|
|
99
111
|
page,
|
|
100
112
|
});
|
|
101
|
-
const requiredVersion = '
|
|
113
|
+
const requiredVersion = '8';
|
|
102
114
|
if (siteVersion !== requiredVersion) {
|
|
103
115
|
throw new Error(`Incompatible site: When visiting ${urlToVisit}, a bundle was found, but one that is not compatible with this version of Remotion. Found version: ${siteVersion} - Required version: ${requiredVersion}. To resolve this error, please bundle and deploy again.`);
|
|
104
116
|
}
|
|
105
117
|
if (remotionVersion !== version_1.VERSION && process.env.NODE_ENV !== 'test') {
|
|
106
118
|
if (remotionVersion) {
|
|
107
|
-
logger_1.Log.
|
|
119
|
+
logger_1.Log.warnAdvanced({
|
|
120
|
+
indent,
|
|
121
|
+
logLevel,
|
|
122
|
+
}, `The site was bundled with version ${remotionVersion} of @remotion/bundler, while @remotion/renderer is on version ${version_1.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`);
|
|
108
123
|
}
|
|
109
124
|
else {
|
|
110
|
-
logger_1.Log.
|
|
125
|
+
logger_1.Log.warnAdvanced({
|
|
126
|
+
indent,
|
|
127
|
+
logLevel,
|
|
128
|
+
}, `The site was bundled with an old version of Remotion, while @remotion/renderer is on version ${version_1.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`);
|
|
111
129
|
}
|
|
112
130
|
}
|
|
113
131
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "4.1.0-
|
|
3
|
+
"version": "4.1.0-alpha9",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"extract-zip": "2.0.1",
|
|
19
19
|
"source-map": "^0.8.0-beta.0",
|
|
20
20
|
"ws": "8.7.0",
|
|
21
|
-
"remotion": "4.1.0-
|
|
21
|
+
"remotion": "4.1.0-alpha9"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": ">=16.8.0",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"zod": "^3.21.4"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"@remotion/compositor-darwin-
|
|
46
|
-
"@remotion/compositor-
|
|
47
|
-
"@remotion/compositor-linux-
|
|
48
|
-
"@remotion/compositor-
|
|
49
|
-
"@remotion/compositor-linux-
|
|
50
|
-
"@remotion/compositor-
|
|
51
|
-
"@remotion/compositor-linux-x64-
|
|
45
|
+
"@remotion/compositor-darwin-x64": "4.1.0-alpha9",
|
|
46
|
+
"@remotion/compositor-darwin-arm64": "4.1.0-alpha9",
|
|
47
|
+
"@remotion/compositor-linux-x64-gnu": "4.1.0-alpha9",
|
|
48
|
+
"@remotion/compositor-linux-arm64-musl": "4.1.0-alpha9",
|
|
49
|
+
"@remotion/compositor-linux-arm64-gnu": "4.1.0-alpha9",
|
|
50
|
+
"@remotion/compositor-win32-x64-msvc": "4.1.0-alpha9",
|
|
51
|
+
"@remotion/compositor-linux-x64-musl": "4.1.0-alpha9"
|
|
52
52
|
},
|
|
53
53
|
"keywords": [
|
|
54
54
|
"remotion",
|