@remotion/renderer 4.0.254 → 4.0.256
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/browser/Browser.d.ts +23 -6
- package/dist/browser/Browser.js +22 -12
- package/dist/browser/BrowserConnector.d.ts +19 -0
- package/dist/browser/BrowserConnector.js +17 -0
- package/dist/browser/BrowserPage.d.ts +5 -2
- package/dist/browser/BrowserPage.js +4 -2
- package/dist/browser/Launcher.js +1 -1
- package/dist/browser/PuppeteerNode.d.ts +30 -0
- package/dist/browser/PuppeteerNode.js +52 -0
- package/dist/browser/Target.d.ts +7 -1
- package/dist/browser/Target.js +6 -1
- package/dist/browser/mitt/index.js +3 -3
- package/dist/browser/node.d.ts +2 -0
- package/dist/browser/node.js +5 -0
- package/dist/browser-instances.js +1 -1
- package/dist/can-use-parallel-encoding.d.ts +1 -0
- package/dist/can-use-parallel-encoding.js +9 -1
- package/dist/client.d.ts +2 -2
- package/dist/copy-to-clipboard.d.ts +2 -0
- package/dist/copy-to-clipboard.js +18 -0
- package/dist/cycle-browser-tabs.d.ts +6 -1
- package/dist/cycle-browser-tabs.js +2 -2
- package/dist/example-videos.d.ts +34 -0
- package/dist/example-videos.js +43 -0
- package/dist/get-browser-instance.d.ts +2 -1
- package/dist/get-browser-instance.js +14 -4
- package/dist/get-codec-name.d.ts +1 -1
- package/dist/get-compositions.js +1 -0
- package/dist/get-local-browser.d.ts +1 -0
- package/dist/get-local-browser.js +19 -0
- package/dist/index.d.ts +3 -3
- package/dist/make-page.d.ts +27 -0
- package/dist/make-page.js +71 -0
- package/dist/next-frame-to-render.d.ts +10 -0
- package/dist/next-frame-to-render.js +35 -0
- package/dist/open-browser.js +3 -3
- 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/pool.d.ts +7 -6
- package/dist/render-frame-and-retry-target-close.d.ts +50 -0
- package/dist/render-frame-and-retry-target-close.js +165 -0
- package/dist/render-frame-with-option-to-reject.d.ts +43 -0
- package/dist/render-frame-with-option-to-reject.js +136 -0
- package/dist/render-frame.d.ts +43 -0
- package/dist/render-frame.js +46 -0
- package/dist/render-frames.js +86 -312
- package/dist/render-partitions.d.ts +7 -0
- package/dist/render-partitions.js +50 -0
- package/dist/render-still.js +7 -2
- package/dist/replace-browser.js +1 -1
- package/dist/select-composition.js +1 -0
- package/dist/take-frame-and-compose.d.ts +22 -0
- package/dist/take-frame-and-compose.js +100 -0
- package/dist/test-gpu.js +1 -0
- package/ensure-browser.mjs +458 -514
- package/package.json +12 -12
|
@@ -0,0 +1,100 @@
|
|
|
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;
|
package/dist/test-gpu.js
CHANGED
|
@@ -13,6 +13,7 @@ const getChromiumGpuInformation = async ({ browserExecutable, indent, logLevel,
|
|
|
13
13
|
logLevel,
|
|
14
14
|
onBrowserDownload,
|
|
15
15
|
chromeMode,
|
|
16
|
+
pageIndex: 0,
|
|
16
17
|
});
|
|
17
18
|
await page.goto({ url: 'chrome://gpu', timeout: 12000 });
|
|
18
19
|
const { value } = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|