@remotion/renderer 4.0.228 → 4.0.230
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/client.d.ts +2 -2
- package/dist/index.d.ts +3 -37
- package/dist/index.js +0 -2
- package/dist/options/gl.d.ts +1 -1
- package/dist/options/index.d.ts +2 -2
- package/dist/options/metadata.d.ts +1 -1
- package/dist/options/webhook-custom-data.d.ts +1 -1
- package/dist/print-useful-error-message.js +15 -5
- package/package.json +12 -11
- package/dist/example-videos.d.ts +0 -34
- package/dist/example-videos.js +0 -43
- package/dist/take-frame-and-compose.d.ts +0 -22
- package/dist/take-frame-and-compose.js +0 -100
package/dist/client.d.ts
CHANGED
|
@@ -394,7 +394,7 @@ export declare const BrowserSafeApis: {
|
|
|
394
394
|
webhookCustomDataOption: {
|
|
395
395
|
name: string;
|
|
396
396
|
cliFlag: "webhook-custom-data";
|
|
397
|
-
description: (type: "
|
|
397
|
+
description: (type: "ssr" | "cli") => import("react/jsx-runtime").JSX.Element;
|
|
398
398
|
ssrName: "customData";
|
|
399
399
|
docLink: string;
|
|
400
400
|
type: Record<string, unknown> | null;
|
|
@@ -807,7 +807,7 @@ export declare const BrowserSafeApis: {
|
|
|
807
807
|
metadataOption: {
|
|
808
808
|
name: string;
|
|
809
809
|
cliFlag: "metadata";
|
|
810
|
-
description: (mode: "
|
|
810
|
+
description: (mode: "ssr" | "cli") => import("react/jsx-runtime").JSX.Element;
|
|
811
811
|
docLink: string;
|
|
812
812
|
type: import("./options/metadata").Metadata;
|
|
813
813
|
getValue: ({ commandLine }: {
|
package/dist/index.d.ts
CHANGED
|
@@ -139,7 +139,7 @@ export declare const RenderInternals: {
|
|
|
139
139
|
validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
|
|
140
140
|
DEFAULT_BROWSER: "chrome";
|
|
141
141
|
validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
|
|
142
|
-
DEFAULT_OPENGL_RENDERER: "
|
|
142
|
+
DEFAULT_OPENGL_RENDERER: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
|
|
143
143
|
validateOpenGlRenderer: (option: unknown) => import("./options/gl").OpenGlRenderer | null;
|
|
144
144
|
validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "h264-ts", "gif"];
|
|
145
145
|
DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
|
|
@@ -352,8 +352,8 @@ export declare const RenderInternals: {
|
|
|
352
352
|
}) => execa.ExecaChildProcess<string>;
|
|
353
353
|
validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
|
|
354
354
|
validVideoImageFormats: readonly ["png", "jpeg", "none"];
|
|
355
|
-
DEFAULT_STILL_IMAGE_FORMAT: "
|
|
356
|
-
DEFAULT_VIDEO_IMAGE_FORMAT: "
|
|
355
|
+
DEFAULT_STILL_IMAGE_FORMAT: "jpeg" | "png" | "webp" | "pdf";
|
|
356
|
+
DEFAULT_VIDEO_IMAGE_FORMAT: "jpeg" | "png" | "none";
|
|
357
357
|
DEFAULT_JPEG_QUALITY: number;
|
|
358
358
|
chalk: {
|
|
359
359
|
enabled: () => boolean;
|
|
@@ -955,39 +955,5 @@ export declare const RenderInternals: {
|
|
|
955
955
|
setConfig: () => never;
|
|
956
956
|
};
|
|
957
957
|
}>) => Promise<import("./ensure-browser").BrowserStatus>;
|
|
958
|
-
exampleVideos: {
|
|
959
|
-
bigBuckBunny: string;
|
|
960
|
-
transparentWebm: string;
|
|
961
|
-
framerWithoutFileExtension: string;
|
|
962
|
-
corrupted: string;
|
|
963
|
-
customDar: string;
|
|
964
|
-
screenrecording: string;
|
|
965
|
-
nofps: string;
|
|
966
|
-
variablefps: string;
|
|
967
|
-
zerotimestamp: string;
|
|
968
|
-
webcam: string;
|
|
969
|
-
iphonevideo: string;
|
|
970
|
-
av1: string;
|
|
971
|
-
framer24fps: string;
|
|
972
|
-
music: string;
|
|
973
|
-
notavideo: string;
|
|
974
|
-
notafile: string;
|
|
975
|
-
transparentwithdar: string;
|
|
976
|
-
prores: string;
|
|
977
|
-
iphonehevc: string;
|
|
978
|
-
matroskaPcm16: string;
|
|
979
|
-
mp4withmp3: string;
|
|
980
|
-
av1bbb: string;
|
|
981
|
-
av1mp4: string;
|
|
982
|
-
av1mp4WithColr: string;
|
|
983
|
-
vp8Vorbis: string;
|
|
984
|
-
vp9: string;
|
|
985
|
-
stretchedVp8: string;
|
|
986
|
-
matroskaMp3: string;
|
|
987
|
-
matroskaH265Aac: string;
|
|
988
|
-
opusWebm: string;
|
|
989
|
-
avi: string;
|
|
990
|
-
opus51Webm: string;
|
|
991
|
-
};
|
|
992
958
|
printUsefulErrorMessage: (err: Error, logLevel: import("./log-level").LogLevel, indent: boolean) => void;
|
|
993
959
|
};
|
package/dist/index.js
CHANGED
|
@@ -113,7 +113,6 @@ const browser_instances_1 = require("./browser-instances");
|
|
|
113
113
|
const codec_supports_media_1 = require("./codec-supports-media");
|
|
114
114
|
const make_file_executable_1 = require("./compositor/make-file-executable");
|
|
115
115
|
const ensure_browser_2 = require("./ensure-browser");
|
|
116
|
-
const example_videos_1 = require("./example-videos");
|
|
117
116
|
const audio_codec_1 = require("./options/audio-codec");
|
|
118
117
|
const print_useful_error_message_1 = require("./print-useful-error-message");
|
|
119
118
|
const render_has_audio_1 = require("./render-has-audio");
|
|
@@ -205,7 +204,6 @@ exports.RenderInternals = {
|
|
|
205
204
|
codecSupportsMedia: codec_supports_media_1.codecSupportsMedia,
|
|
206
205
|
toMegabytes: to_megabytes_1.toMegabytes,
|
|
207
206
|
internalEnsureBrowser: ensure_browser_2.internalEnsureBrowser,
|
|
208
|
-
exampleVideos: example_videos_1.exampleVideos,
|
|
209
207
|
printUsefulErrorMessage: print_useful_error_message_1.printUsefulErrorMessage,
|
|
210
208
|
};
|
|
211
209
|
// Warn of potential performance issues with Apple Silicon (M1 chip under Rosetta)
|
package/dist/options/gl.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const validOpenGlRenderers: readonly ["swangle", "angle", "egl", "swiftshader", "vulkan", "angle-egl"];
|
|
2
2
|
export type OpenGlRenderer = (typeof validOpenGlRenderers)[number];
|
|
3
3
|
export declare const DEFAULT_OPENGL_RENDERER: OpenGlRenderer | null;
|
|
4
|
-
export declare const getChromiumOpenGlRenderer: () => "
|
|
4
|
+
export declare const getChromiumOpenGlRenderer: () => "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
|
|
5
5
|
export declare const setChromiumOpenGlRenderer: (renderer: OpenGlRenderer) => void;
|
|
6
6
|
export declare const glOption: {
|
|
7
7
|
cliFlag: "gl";
|
package/dist/options/index.d.ts
CHANGED
|
@@ -171,7 +171,7 @@ export declare const allOptions: {
|
|
|
171
171
|
webhookCustomDataOption: {
|
|
172
172
|
name: string;
|
|
173
173
|
cliFlag: "webhook-custom-data";
|
|
174
|
-
description: (type: "
|
|
174
|
+
description: (type: "ssr" | "cli") => import("react/jsx-runtime").JSX.Element;
|
|
175
175
|
ssrName: "customData";
|
|
176
176
|
docLink: string;
|
|
177
177
|
type: Record<string, unknown> | null;
|
|
@@ -584,7 +584,7 @@ export declare const allOptions: {
|
|
|
584
584
|
metadataOption: {
|
|
585
585
|
name: string;
|
|
586
586
|
cliFlag: "metadata";
|
|
587
|
-
description: (mode: "
|
|
587
|
+
description: (mode: "ssr" | "cli") => import("react/jsx-runtime").JSX.Element;
|
|
588
588
|
docLink: string;
|
|
589
589
|
type: import("./metadata").Metadata;
|
|
590
590
|
getValue: ({ commandLine }: {
|
|
@@ -2,7 +2,7 @@ export type Metadata = Record<string, string>;
|
|
|
2
2
|
export declare const metadataOption: {
|
|
3
3
|
name: string;
|
|
4
4
|
cliFlag: "metadata";
|
|
5
|
-
description: (mode: "
|
|
5
|
+
description: (mode: "ssr" | "cli") => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
docLink: string;
|
|
7
7
|
type: Metadata;
|
|
8
8
|
getValue: ({ commandLine }: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const webhookCustomDataOption: {
|
|
2
2
|
name: string;
|
|
3
3
|
cliFlag: "webhook-custom-data";
|
|
4
|
-
description: (type: "
|
|
4
|
+
description: (type: "ssr" | "cli") => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
ssrName: "customData";
|
|
6
6
|
docLink: string;
|
|
7
7
|
type: Record<string, unknown> | null;
|
|
@@ -3,13 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.printUsefulErrorMessage = void 0;
|
|
4
4
|
const logger_1 = require("./logger");
|
|
5
5
|
const truthy_1 = require("./truthy");
|
|
6
|
-
|
|
6
|
+
let alreadyPrintedCache = [];
|
|
7
7
|
const printUsefulErrorMessage = (err, logLevel, indent) => {
|
|
8
8
|
var _a, _b;
|
|
9
|
-
|
|
9
|
+
const errorStack = err.stack;
|
|
10
|
+
if (errorStack && alreadyPrintedCache.includes(errorStack)) {
|
|
10
11
|
return;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
if (errorStack) {
|
|
14
|
+
alreadyPrintedCache.push(errorStack);
|
|
15
|
+
alreadyPrintedCache = alreadyPrintedCache.slice(-10);
|
|
16
|
+
}
|
|
13
17
|
if (err.message.includes('Could not play video with')) {
|
|
14
18
|
logger_1.Log.info({ indent, logLevel });
|
|
15
19
|
logger_1.Log.info({ indent, logLevel }, '💡 Get help for this issue at https://remotion.dev/docs/media-playback-error');
|
|
@@ -44,8 +48,14 @@ const printUsefulErrorMessage = (err, logLevel, indent) => {
|
|
|
44
48
|
}
|
|
45
49
|
if (err.message.includes('Error creating WebGL context')) {
|
|
46
50
|
logger_1.Log.info({ indent, logLevel });
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
logger_1.Log.warn({
|
|
52
|
+
indent,
|
|
53
|
+
logLevel,
|
|
54
|
+
}, '💡 You might need to set the OpenGL renderer to "angle-egl", "angle" (or "swangle" if rendering on lambda). Learn why at https://www.remotion.dev/docs/three');
|
|
55
|
+
logger_1.Log.warn({
|
|
56
|
+
indent,
|
|
57
|
+
logLevel,
|
|
58
|
+
}, "💡 Check how it's done at https://www.remotion.dev/docs/chromium-flags#--gl");
|
|
49
59
|
}
|
|
50
60
|
if (err.message.includes('The bucket does not allow ACLs')) {
|
|
51
61
|
logger_1.Log.info({ indent, logLevel });
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/renderer"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/renderer",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.230",
|
|
7
7
|
"description": "Render Remotion videos using Node.js or Bun",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"extract-zip": "2.0.1",
|
|
19
19
|
"source-map": "^0.8.0-beta.0",
|
|
20
20
|
"ws": "8.17.1",
|
|
21
|
-
"remotion": "4.0.
|
|
22
|
-
"@remotion/streaming": "4.0.
|
|
21
|
+
"remotion": "4.0.230",
|
|
22
|
+
"@remotion/streaming": "4.0.230"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": ">=16.8.0",
|
|
@@ -33,16 +33,17 @@
|
|
|
33
33
|
"react-dom": "18.3.1",
|
|
34
34
|
"@types/ws": "8.5.10",
|
|
35
35
|
"eslint": "9.14.0",
|
|
36
|
-
"@remotion/
|
|
36
|
+
"@remotion/example-videos": "4.0.230",
|
|
37
|
+
"@remotion/eslint-config-internal": "4.0.230"
|
|
37
38
|
},
|
|
38
39
|
"optionalDependencies": {
|
|
39
|
-
"@remotion/compositor-
|
|
40
|
-
"@remotion/compositor-linux-
|
|
41
|
-
"@remotion/compositor-linux-arm64-musl": "4.0.
|
|
42
|
-
"@remotion/compositor-
|
|
43
|
-
"@remotion/compositor-linux-x64-
|
|
44
|
-
"@remotion/compositor-
|
|
45
|
-
"@remotion/compositor-darwin-
|
|
40
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.230",
|
|
41
|
+
"@remotion/compositor-linux-x64-musl": "4.0.230",
|
|
42
|
+
"@remotion/compositor-linux-arm64-musl": "4.0.230",
|
|
43
|
+
"@remotion/compositor-win32-x64-msvc": "4.0.230",
|
|
44
|
+
"@remotion/compositor-linux-x64-gnu": "4.0.230",
|
|
45
|
+
"@remotion/compositor-darwin-arm64": "4.0.230",
|
|
46
|
+
"@remotion/compositor-darwin-x64": "4.0.230"
|
|
46
47
|
},
|
|
47
48
|
"keywords": [
|
|
48
49
|
"remotion",
|
package/dist/example-videos.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export declare const exampleVideos: {
|
|
2
|
-
bigBuckBunny: string;
|
|
3
|
-
transparentWebm: string;
|
|
4
|
-
framerWithoutFileExtension: string;
|
|
5
|
-
corrupted: string;
|
|
6
|
-
customDar: string;
|
|
7
|
-
screenrecording: string;
|
|
8
|
-
nofps: string;
|
|
9
|
-
variablefps: string;
|
|
10
|
-
zerotimestamp: string;
|
|
11
|
-
webcam: string;
|
|
12
|
-
iphonevideo: string;
|
|
13
|
-
av1: string;
|
|
14
|
-
framer24fps: string;
|
|
15
|
-
music: string;
|
|
16
|
-
notavideo: string;
|
|
17
|
-
notafile: string;
|
|
18
|
-
transparentwithdar: string;
|
|
19
|
-
prores: string;
|
|
20
|
-
iphonehevc: string;
|
|
21
|
-
matroskaPcm16: string;
|
|
22
|
-
mp4withmp3: string;
|
|
23
|
-
av1bbb: string;
|
|
24
|
-
av1mp4: string;
|
|
25
|
-
av1mp4WithColr: string;
|
|
26
|
-
vp8Vorbis: string;
|
|
27
|
-
vp9: string;
|
|
28
|
-
stretchedVp8: string;
|
|
29
|
-
matroskaMp3: string;
|
|
30
|
-
matroskaH265Aac: string;
|
|
31
|
-
opusWebm: string;
|
|
32
|
-
avi: string;
|
|
33
|
-
opus51Webm: string;
|
|
34
|
-
};
|
package/dist/example-videos.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.exampleVideos = void 0;
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const examplePackage = node_path_1.default.join(__dirname, '..', '..', 'example');
|
|
9
|
-
const docsPackage = node_path_1.default.join(__dirname, '..', '..', 'docs');
|
|
10
|
-
exports.exampleVideos = {
|
|
11
|
-
bigBuckBunny: node_path_1.default.join(examplePackage, 'public/bigbuckbunny.mp4'),
|
|
12
|
-
transparentWebm: node_path_1.default.join(docsPackage, '/static/img/transparent-video.webm'),
|
|
13
|
-
framerWithoutFileExtension: node_path_1.default.join(examplePackage, 'public', 'framermp4withoutfileextension'),
|
|
14
|
-
corrupted: node_path_1.default.join(examplePackage, 'public', 'corrupted.mp4'),
|
|
15
|
-
customDar: node_path_1.default.join(examplePackage, 'public', 'custom-dar.mp4'),
|
|
16
|
-
screenrecording: node_path_1.default.join(examplePackage, 'public', 'quick.mov'),
|
|
17
|
-
nofps: node_path_1.default.join(examplePackage, 'public', 'nofps.webm'),
|
|
18
|
-
variablefps: node_path_1.default.join(examplePackage, 'public', 'variablefps.webm'),
|
|
19
|
-
zerotimestamp: node_path_1.default.join(examplePackage, 'public', 'zero-timestamp.mp4'),
|
|
20
|
-
webcam: node_path_1.default.join(examplePackage, 'public', 'webcam.webm'),
|
|
21
|
-
iphonevideo: node_path_1.default.join(examplePackage, 'public', 'iphonevideo.mov'),
|
|
22
|
-
av1: node_path_1.default.join(examplePackage, 'public', 'av1.webm'),
|
|
23
|
-
framer24fps: node_path_1.default.join(examplePackage, 'src', 'resources', 'framer-24fps.mp4'),
|
|
24
|
-
music: node_path_1.default.join(examplePackage, 'public', 'music.mp3'),
|
|
25
|
-
notavideo: node_path_1.default.join(examplePackage, 'public', 'giphy.gif'),
|
|
26
|
-
notafile: node_path_1.default.join(examplePackage, 'public', 'doesnotexist'),
|
|
27
|
-
transparentwithdar: node_path_1.default.join(examplePackage, 'public', 'transparent-with-dar.webm'),
|
|
28
|
-
prores: node_path_1.default.join(examplePackage, 'public', 'prores.mov'),
|
|
29
|
-
iphonehevc: node_path_1.default.join(examplePackage, 'public', 'iphone-hevc.mov'),
|
|
30
|
-
matroskaPcm16: node_path_1.default.join(examplePackage, 'public', 'matroska-pcm16.mkv'),
|
|
31
|
-
mp4withmp3: node_path_1.default.join(examplePackage, 'public', 'mp4-mp3.mp4'),
|
|
32
|
-
av1bbb: node_path_1.default.join(examplePackage, 'public', 'av1-bbb.webm'),
|
|
33
|
-
av1mp4: node_path_1.default.join(examplePackage, 'public', 'av1-bbb.mp4'),
|
|
34
|
-
av1mp4WithColr: node_path_1.default.join(examplePackage, 'public', 'av1.mp4'),
|
|
35
|
-
vp8Vorbis: node_path_1.default.join(examplePackage, 'public', 'vp8-vorbis.webm'),
|
|
36
|
-
vp9: node_path_1.default.join(examplePackage, 'public', 'vp9.webm'),
|
|
37
|
-
stretchedVp8: node_path_1.default.join(examplePackage, 'public', 'stretched-vp8.webm'),
|
|
38
|
-
matroskaMp3: node_path_1.default.join(examplePackage, 'public', 'matroska-mp3.mkv'),
|
|
39
|
-
matroskaH265Aac: node_path_1.default.join(examplePackage, 'public', 'matroska-h265-aac.mkv'),
|
|
40
|
-
opusWebm: node_path_1.default.join(examplePackage, 'public', 'opus.webm'),
|
|
41
|
-
avi: node_path_1.default.join(examplePackage, 'public', 'example.avi'),
|
|
42
|
-
opus51Webm: node_path_1.default.join(examplePackage, 'public', 'vp8-opus-5-1-channels.webm'),
|
|
43
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { TRenderAsset } from 'remotion/no-react';
|
|
2
|
-
import type { DownloadMap } from './assets/download-map';
|
|
3
|
-
import type { Page } from './browser/BrowserPage';
|
|
4
|
-
import type { Compositor } from './compositor/compositor';
|
|
5
|
-
import type { StillImageFormat, VideoImageFormat } from './image-format';
|
|
6
|
-
export declare const takeFrameAndCompose: ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, downloadMap, wantsBuffer, compositor, timeoutInMilliseconds, }: {
|
|
7
|
-
freePage: Page;
|
|
8
|
-
imageFormat: VideoImageFormat | StillImageFormat;
|
|
9
|
-
jpegQuality: number | undefined;
|
|
10
|
-
frame: number;
|
|
11
|
-
height: number;
|
|
12
|
-
width: number;
|
|
13
|
-
output: string | null;
|
|
14
|
-
scale: number;
|
|
15
|
-
downloadMap: DownloadMap;
|
|
16
|
-
wantsBuffer: boolean;
|
|
17
|
-
compositor: Compositor;
|
|
18
|
-
timeoutInMilliseconds: number;
|
|
19
|
-
}) => Promise<{
|
|
20
|
-
buffer: Buffer | null;
|
|
21
|
-
collectedAssets: TRenderAsset[];
|
|
22
|
-
}>;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.takeFrameAndCompose = void 0;
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const collect_assets_1 = require("./collect-assets");
|
|
10
|
-
const compose_1 = require("./compositor/compose");
|
|
11
|
-
const provide_screenshot_1 = require("./provide-screenshot");
|
|
12
|
-
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
13
|
-
const truthy_1 = require("./truthy");
|
|
14
|
-
const takeFrameAndCompose = async ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, downloadMap, wantsBuffer, compositor, timeoutInMilliseconds, }) => {
|
|
15
|
-
var _a;
|
|
16
|
-
const [{ value: clipRegion }, collectedAssets] = await Promise.all([
|
|
17
|
-
(0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
18
|
-
pageFunction: () => {
|
|
19
|
-
if (typeof window.remotion_getClipRegion === 'undefined') {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
return window.remotion_getClipRegion();
|
|
23
|
-
},
|
|
24
|
-
args: [],
|
|
25
|
-
frame,
|
|
26
|
-
page: freePage,
|
|
27
|
-
timeoutInMilliseconds,
|
|
28
|
-
}),
|
|
29
|
-
(0, collect_assets_1.collectAssets)({ frame, freePage, timeoutInMilliseconds }),
|
|
30
|
-
]);
|
|
31
|
-
if (imageFormat === 'none') {
|
|
32
|
-
return { buffer: null, collectedAssets };
|
|
33
|
-
}
|
|
34
|
-
const needsComposing = clipRegion === null
|
|
35
|
-
? null
|
|
36
|
-
: {
|
|
37
|
-
tmpFile: node_path_1.default.join(downloadMap.compositingDir, `${frame}.${imageFormat}`),
|
|
38
|
-
finalOutFile: output !== null && output !== void 0 ? output : node_path_1.default.join(downloadMap.compositingDir, `${frame}-final.${imageFormat}`),
|
|
39
|
-
clipRegion: clipRegion,
|
|
40
|
-
};
|
|
41
|
-
if (clipRegion !== 'hide') {
|
|
42
|
-
const shouldMakeBuffer = wantsBuffer && !needsComposing;
|
|
43
|
-
const buf = await (0, provide_screenshot_1.provideScreenshot)({
|
|
44
|
-
page: freePage,
|
|
45
|
-
imageFormat,
|
|
46
|
-
jpegQuality,
|
|
47
|
-
options: {
|
|
48
|
-
frame,
|
|
49
|
-
output: shouldMakeBuffer ? null : ((_a = needsComposing === null || needsComposing === void 0 ? void 0 : needsComposing.tmpFile) !== null && _a !== void 0 ? _a : output),
|
|
50
|
-
},
|
|
51
|
-
height,
|
|
52
|
-
width,
|
|
53
|
-
clipRegion,
|
|
54
|
-
timeoutInMilliseconds,
|
|
55
|
-
scale,
|
|
56
|
-
});
|
|
57
|
-
if (shouldMakeBuffer) {
|
|
58
|
-
return { buffer: buf, collectedAssets };
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (needsComposing) {
|
|
62
|
-
if (imageFormat === 'pdf') {
|
|
63
|
-
throw new Error("You cannot use Rust APIs (like <Clipper>) if `imageFormat` is 'pdf'.");
|
|
64
|
-
}
|
|
65
|
-
if (imageFormat === 'webp') {
|
|
66
|
-
throw new Error("You cannot use Rust APIs (like <Clipper>) if `imageFormat` is 'webp'.");
|
|
67
|
-
}
|
|
68
|
-
await (0, compose_1.compose)({
|
|
69
|
-
height: height * scale,
|
|
70
|
-
width: width * scale,
|
|
71
|
-
layers: [
|
|
72
|
-
needsComposing.clipRegion === 'hide'
|
|
73
|
-
? null
|
|
74
|
-
: {
|
|
75
|
-
type: imageFormat === 'jpeg'
|
|
76
|
-
? 'JpgImage'
|
|
77
|
-
: 'PngImage',
|
|
78
|
-
params: {
|
|
79
|
-
height: needsComposing.clipRegion.height * scale,
|
|
80
|
-
width: needsComposing.clipRegion.width * scale,
|
|
81
|
-
src: needsComposing.tmpFile,
|
|
82
|
-
x: needsComposing.clipRegion.x * scale,
|
|
83
|
-
y: needsComposing.clipRegion.y * scale,
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
].filter(truthy_1.truthy),
|
|
87
|
-
output: needsComposing.finalOutFile,
|
|
88
|
-
downloadMap,
|
|
89
|
-
imageFormat: imageFormat === 'jpeg' ? 'Jpeg' : 'Png',
|
|
90
|
-
compositor,
|
|
91
|
-
});
|
|
92
|
-
if (wantsBuffer) {
|
|
93
|
-
const buffer = await node_fs_1.default.promises.readFile(needsComposing.finalOutFile);
|
|
94
|
-
await node_fs_1.default.promises.unlink(needsComposing.finalOutFile);
|
|
95
|
-
return { buffer, collectedAssets };
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return { buffer: null, collectedAssets };
|
|
99
|
-
};
|
|
100
|
-
exports.takeFrameAndCompose = takeFrameAndCompose;
|