@remotion/lambda 3.2.39 → 3.2.40
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/api/render-media-on-lambda.d.ts +4 -2
- package/dist/api/render-media-on-lambda.js +3 -1
- package/dist/api/render-still-on-lambda.d.ts +3 -1
- package/dist/api/render-still-on-lambda.js +3 -1
- package/dist/cli/commands/render/render.js +4 -2
- package/dist/cli/commands/sites/create.d.ts +1 -1
- package/dist/cli/commands/sites/create.js +6 -4
- package/dist/cli/commands/sites/index.d.ts +1 -1
- package/dist/cli/commands/sites/index.js +2 -2
- package/dist/cli/commands/still.js +3 -2
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +7 -6
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +1 -4
- package/dist/functions/helpers/validate-composition.d.ts +3 -1
- package/dist/functions/helpers/validate-composition.js +6 -2
- package/dist/functions/launch.js +2 -0
- package/dist/functions/progress.js +2 -2
- package/dist/functions/start.js +4 -2
- package/dist/functions/still.js +7 -3
- package/dist/internals.d.ts +1 -1
- package/dist/shared/constants.d.ts +6 -0
- package/package.json +7 -7
- package/remotionlambda.zip +0 -0
- package/dist/functions/chunk-optimization/can-use-optimization.d.ts +0 -6
- package/dist/functions/chunk-optimization/can-use-optimization.js +0 -23
- package/dist/functions/chunk-optimization/collect-data.d.ts +0 -9
- package/dist/functions/chunk-optimization/collect-data.js +0 -27
- package/dist/functions/chunk-optimization/get-frame-ranges-from-profile.d.ts +0 -3
- package/dist/functions/chunk-optimization/get-frame-ranges-from-profile.js +0 -11
- package/dist/functions/chunk-optimization/get-profile-duration.d.ts +0 -3
- package/dist/functions/chunk-optimization/get-profile-duration.js +0 -18
- package/dist/functions/chunk-optimization/is-valid-profile.d.ts +0 -2
- package/dist/functions/chunk-optimization/is-valid-profile.js +0 -12
- package/dist/functions/chunk-optimization/optimize-invocation-order.d.ts +0 -2
- package/dist/functions/chunk-optimization/optimize-invocation-order.js +0 -19
- package/dist/functions/chunk-optimization/optimize-profile.d.ts +0 -9
- package/dist/functions/chunk-optimization/optimize-profile.js +0 -74
- package/dist/functions/chunk-optimization/s3-optimization-file.d.ts +0 -17
- package/dist/functions/chunk-optimization/s3-optimization-file.js +0 -47
- package/dist/functions/chunk-optimization/simulate-frame-ranges.d.ts +0 -7
- package/dist/functions/chunk-optimization/simulate-frame-ranges.js +0 -47
- package/dist/functions/chunk-optimization/sort-by-duration.d.ts +0 -2
- package/dist/functions/chunk-optimization/sort-by-duration.js +0 -25
|
@@ -37,6 +37,8 @@ export declare type RenderMediaOnLambdaInput = {
|
|
|
37
37
|
url: string;
|
|
38
38
|
secret: string | null;
|
|
39
39
|
};
|
|
40
|
+
forceWidth?: number | null;
|
|
41
|
+
forceHeight?: number | null;
|
|
40
42
|
};
|
|
41
43
|
export declare type RenderMediaOnLambdaOutput = {
|
|
42
44
|
renderId: string;
|
|
@@ -62,8 +64,8 @@ export declare type RenderMediaOnLambdaOutput = {
|
|
|
62
64
|
* @param params.webhook Configuration for webhook called upon completion or timeout of the render.
|
|
63
65
|
* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
|
|
64
66
|
*/
|
|
65
|
-
export declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
67
|
+
export declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
66
68
|
/**
|
|
67
69
|
* @deprecated Renamed to renderMediaOnLambda()
|
|
68
70
|
*/
|
|
69
|
-
export declare const renderVideoOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
71
|
+
export declare const renderVideoOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
@@ -30,7 +30,7 @@ const validate_serveurl_1 = require("../shared/validate-serveurl");
|
|
|
30
30
|
* @param params.webhook Configuration for webhook called upon completion or timeout of the render.
|
|
31
31
|
* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
|
|
32
32
|
*/
|
|
33
|
-
const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, }) => {
|
|
33
|
+
const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, }) => {
|
|
34
34
|
var _a;
|
|
35
35
|
const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
|
|
36
36
|
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
@@ -81,6 +81,8 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
|
|
|
81
81
|
audioBitrate: audioBitrate !== null && audioBitrate !== void 0 ? audioBitrate : null,
|
|
82
82
|
videoBitrate: videoBitrate !== null && videoBitrate !== void 0 ? videoBitrate : null,
|
|
83
83
|
webhook: webhook !== null && webhook !== void 0 ? webhook : null,
|
|
84
|
+
forceHeight: forceHeight !== null && forceHeight !== void 0 ? forceHeight : null,
|
|
85
|
+
forceWidth: forceWidth !== null && forceWidth !== void 0 ? forceWidth : null,
|
|
84
86
|
},
|
|
85
87
|
region,
|
|
86
88
|
});
|
|
@@ -20,6 +20,8 @@ export declare type RenderStillOnLambdaInput = {
|
|
|
20
20
|
chromiumOptions?: ChromiumOptions;
|
|
21
21
|
scale?: number;
|
|
22
22
|
downloadBehavior?: DownloadBehavior;
|
|
23
|
+
forceWidth?: number | null;
|
|
24
|
+
forceHeight?: number | null;
|
|
23
25
|
};
|
|
24
26
|
export declare type RenderStillOnLambdaOutput = {
|
|
25
27
|
estimatedPrice: CostsInfo;
|
|
@@ -45,4 +47,4 @@ export declare type RenderStillOnLambdaOutput = {
|
|
|
45
47
|
* @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`
|
|
46
48
|
* @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
|
|
47
49
|
*/
|
|
48
|
-
export declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
|
|
50
|
+
export declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
|
|
@@ -23,7 +23,7 @@ const serialize_input_props_1 = require("../shared/serialize-input-props");
|
|
|
23
23
|
* @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`
|
|
24
24
|
* @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
|
|
25
25
|
*/
|
|
26
|
-
const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, }) => {
|
|
26
|
+
const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, }) => {
|
|
27
27
|
var _a;
|
|
28
28
|
const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
|
|
29
29
|
const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
|
|
@@ -53,6 +53,8 @@ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFo
|
|
|
53
53
|
scale: scale !== null && scale !== void 0 ? scale : 1,
|
|
54
54
|
downloadBehavior: downloadBehavior !== null && downloadBehavior !== void 0 ? downloadBehavior : { type: 'play-in-browser' },
|
|
55
55
|
version: version_1.VERSION,
|
|
56
|
+
forceHeight: forceHeight !== null && forceHeight !== void 0 ? forceHeight : null,
|
|
57
|
+
forceWidth: forceWidth !== null && forceWidth !== void 0 ? forceWidth : null,
|
|
56
58
|
},
|
|
57
59
|
region,
|
|
58
60
|
});
|
|
@@ -46,11 +46,11 @@ const renderCommand = async (args) => {
|
|
|
46
46
|
downloadName,
|
|
47
47
|
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
48
48
|
});
|
|
49
|
-
const { chromiumOptions, crf, envVariables, frameRange,
|
|
49
|
+
const { chromiumOptions, crf, envVariables, frameRange, inputProps, logLevel, pixelFormat, proResProfile, puppeteerTimeout, quality, scale, everyNthFrame, numberOfGifLoops, muted, overwrite, audioBitrate, videoBitrate, height, width, } = await cli_1.CliInternals.getCliOptions({
|
|
50
50
|
type: 'series',
|
|
51
51
|
isLambda: true,
|
|
52
|
-
codec,
|
|
53
52
|
});
|
|
53
|
+
const imageFormat = cli_1.CliInternals.getImageFormat(codec);
|
|
54
54
|
const functionName = await (0, find_function_name_1.findFunctionName)();
|
|
55
55
|
const maxRetries = (_b = args_1.parsedLambdaCli['max-retries']) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_MAX_RETRIES;
|
|
56
56
|
(0, validate_retries_1.validateMaxRetries)(maxRetries);
|
|
@@ -87,6 +87,8 @@ const renderCommand = async (args) => {
|
|
|
87
87
|
overwrite,
|
|
88
88
|
audioBitrate,
|
|
89
89
|
videoBitrate,
|
|
90
|
+
forceHeight: height,
|
|
91
|
+
forceWidth: width,
|
|
90
92
|
webhook: args_1.parsedLambdaCli.webhook
|
|
91
93
|
? {
|
|
92
94
|
url: args_1.parsedLambdaCli.webhook,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const SITES_CREATE_SUBCOMMAND = "create";
|
|
2
|
-
export declare const sitesCreateSubcommand: (args: string[]) => Promise<void>;
|
|
2
|
+
export declare const sitesCreateSubcommand: (args: string[], remotionRoot: string) => Promise<void>;
|
|
@@ -17,17 +17,19 @@ const progress_bar_1 = require("../../helpers/progress-bar");
|
|
|
17
17
|
const quit_1 = require("../../helpers/quit");
|
|
18
18
|
const log_1 = require("../../log");
|
|
19
19
|
exports.SITES_CREATE_SUBCOMMAND = 'create';
|
|
20
|
-
const sitesCreateSubcommand = async (args) => {
|
|
20
|
+
const sitesCreateSubcommand = async (args, remotionRoot) => {
|
|
21
21
|
var _a, _b;
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
22
|
+
const { file, reason } = cli_1.CliInternals.findEntryPoint(args, remotionRoot);
|
|
23
|
+
if (!file) {
|
|
24
24
|
log_1.Log.error('No entry file passed.');
|
|
25
25
|
log_1.Log.info('Pass an additional argument specifying the entry file of your Remotion project:');
|
|
26
26
|
log_1.Log.info();
|
|
27
27
|
log_1.Log.info(`${constants_1.BINARY_NAME} deploy <entry-file.ts>`);
|
|
28
28
|
(0, quit_1.quit)(1);
|
|
29
|
+
return;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
log_1.Log.verbose('Entry point:', file, 'Reason:', reason);
|
|
32
|
+
const absoluteFile = path_1.default.join(process.cwd(), file);
|
|
31
33
|
if (!(0, fs_1.existsSync)(absoluteFile)) {
|
|
32
34
|
log_1.Log.error(`No file exists at ${absoluteFile}. Make sure the path exists and try again.`);
|
|
33
35
|
(0, quit_1.quit)(1);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const SITES_COMMAND = "sites";
|
|
2
|
-
export declare const sitesCommand: (args: string[]) => Promise<void> | undefined;
|
|
2
|
+
export declare const sitesCommand: (args: string[], remotionRoot: string) => Promise<void> | undefined;
|
|
@@ -24,7 +24,7 @@ const printSitesHelp = () => {
|
|
|
24
24
|
log_1.Log.info(`${constants_1.BINARY_NAME} ${exports.SITES_COMMAND} ${rm_1.SITES_RM_COMMAND} <site-id>`);
|
|
25
25
|
log_1.Log.info(cli_1.CliInternals.chalk.gray('Remove a site from the S3 bucket.'));
|
|
26
26
|
};
|
|
27
|
-
const sitesCommand = (args) => {
|
|
27
|
+
const sitesCommand = (args, remotionRoot) => {
|
|
28
28
|
if (args[0] === ls_1.SITES_LS_SUBCOMMAND) {
|
|
29
29
|
return (0, ls_1.sitesLsSubcommand)();
|
|
30
30
|
}
|
|
@@ -35,7 +35,7 @@ const sitesCommand = (args) => {
|
|
|
35
35
|
return (0, rmall_1.sitesRmallSubcommand)();
|
|
36
36
|
}
|
|
37
37
|
if (args[0] === create_1.SITES_CREATE_SUBCOMMAND) {
|
|
38
|
-
return (0, create_1.sitesCreateSubcommand)(args.slice(1));
|
|
38
|
+
return (0, create_1.sitesCreateSubcommand)(args.slice(1), remotionRoot);
|
|
39
39
|
}
|
|
40
40
|
if (args[0]) {
|
|
41
41
|
log_1.Log.error(`Subcommand ${args[0]} not found.`);
|
|
@@ -40,10 +40,9 @@ const stillCommand = async (args) => {
|
|
|
40
40
|
}
|
|
41
41
|
const downloadName = (_a = args[2]) !== null && _a !== void 0 ? _a : null;
|
|
42
42
|
const outName = args_1.parsedLambdaCli['out-name'];
|
|
43
|
-
const { chromiumOptions, envVariables, inputProps, logLevel, puppeteerTimeout, quality, stillFrame, scale, } = await cli_1.CliInternals.getCliOptions({
|
|
43
|
+
const { chromiumOptions, envVariables, inputProps, logLevel, puppeteerTimeout, quality, stillFrame, scale, height, width, } = await cli_1.CliInternals.getCliOptions({
|
|
44
44
|
type: 'still',
|
|
45
45
|
isLambda: true,
|
|
46
|
-
codec: 'h264',
|
|
47
46
|
});
|
|
48
47
|
const functionName = await (0, find_function_name_1.findFunctionName)();
|
|
49
48
|
const maxRetries = (_b = args_1.parsedLambdaCli['max-retries']) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_MAX_RETRIES;
|
|
@@ -76,6 +75,8 @@ const stillCommand = async (args) => {
|
|
|
76
75
|
chromiumOptions,
|
|
77
76
|
timeoutInMilliseconds: puppeteerTimeout,
|
|
78
77
|
scale,
|
|
78
|
+
forceHeight: height,
|
|
79
|
+
forceWidth: width,
|
|
79
80
|
});
|
|
80
81
|
log_1.Log.info(cli_1.CliInternals.chalk.gray(`Bucket = ${res.bucketName}, renderId = ${res.renderId}`));
|
|
81
82
|
log_1.Log.verbose(`CloudWatch logs (if enabled): ${res.cloudWatchLogs}`);
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const executeCommand: (args: string[]) => Promise<void>;
|
|
1
|
+
export declare const executeCommand: (args: string[], remotionRoot: string) => Promise<void>;
|
|
2
2
|
export declare const cli: () => Promise<void>;
|
package/dist/cli/index.js
CHANGED
|
@@ -34,7 +34,7 @@ const requiresCredentials = (args) => {
|
|
|
34
34
|
}
|
|
35
35
|
return true;
|
|
36
36
|
};
|
|
37
|
-
const matchCommand = (args) => {
|
|
37
|
+
const matchCommand = (args, remotionRoot) => {
|
|
38
38
|
if (args_1.parsedLambdaCli.help || args.length === 0) {
|
|
39
39
|
(0, help_1.printHelp)();
|
|
40
40
|
(0, quit_1.quit)(0);
|
|
@@ -61,7 +61,7 @@ const matchCommand = (args) => {
|
|
|
61
61
|
return (0, regions_1.regionsCommand)();
|
|
62
62
|
}
|
|
63
63
|
if (args[0] === sites_1.SITES_COMMAND) {
|
|
64
|
-
return (0, sites_1.sitesCommand)(args.slice(1));
|
|
64
|
+
return (0, sites_1.sitesCommand)(args.slice(1), remotionRoot);
|
|
65
65
|
}
|
|
66
66
|
if (args[0] === 'upload') {
|
|
67
67
|
log_1.Log.info('The command has been renamed.');
|
|
@@ -91,11 +91,11 @@ const matchCommand = (args) => {
|
|
|
91
91
|
(0, help_1.printHelp)();
|
|
92
92
|
(0, quit_1.quit)(1);
|
|
93
93
|
};
|
|
94
|
-
const executeCommand = async (args) => {
|
|
94
|
+
const executeCommand = async (args, remotionRoot) => {
|
|
95
95
|
var _a, _b;
|
|
96
96
|
try {
|
|
97
97
|
(0, is_cli_1.setIsCli)(true);
|
|
98
|
-
await matchCommand(args);
|
|
98
|
+
await matchCommand(args, remotionRoot);
|
|
99
99
|
}
|
|
100
100
|
catch (err) {
|
|
101
101
|
const error = err;
|
|
@@ -133,7 +133,8 @@ AWS returned an "TooManyRequestsException" error message which could mean you re
|
|
|
133
133
|
};
|
|
134
134
|
exports.executeCommand = executeCommand;
|
|
135
135
|
const cli = async () => {
|
|
136
|
-
|
|
137
|
-
await
|
|
136
|
+
const remotionRoot = cli_1.CliInternals.findRemotionRoot();
|
|
137
|
+
await cli_1.CliInternals.initializeCli(remotionRoot);
|
|
138
|
+
await (0, exports.executeCommand)(args_1.parsedLambdaCli._, remotionRoot);
|
|
138
139
|
};
|
|
139
140
|
exports.cli = cli;
|
|
@@ -13,6 +13,8 @@ declare type ValidateCompositionOptions = {
|
|
|
13
13
|
chromiumOptions: ChromiumOptions;
|
|
14
14
|
port: number | null;
|
|
15
15
|
downloadMap: DownloadMap;
|
|
16
|
+
forceHeight: number | null;
|
|
17
|
+
forceWidth: number | null;
|
|
16
18
|
};
|
|
17
|
-
export declare const validateComposition: ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, ffmpegExecutable, ffprobeExecutable, chromiumOptions, port, downloadMap, }: ValidateCompositionOptions) => Promise<TCompMetadata>;
|
|
19
|
+
export declare const validateComposition: ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, ffmpegExecutable, ffprobeExecutable, chromiumOptions, port, downloadMap, forceHeight, forceWidth, }: ValidateCompositionOptions) => Promise<TCompMetadata>;
|
|
18
20
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateComposition = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
-
const validateComposition = async ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, ffmpegExecutable, ffprobeExecutable, chromiumOptions, port, downloadMap, }) => {
|
|
5
|
+
const validateComposition = async ({ serveUrl, composition, browserInstance, inputProps, envVariables, timeoutInMilliseconds, ffmpegExecutable, ffprobeExecutable, chromiumOptions, port, downloadMap, forceHeight, forceWidth, }) => {
|
|
6
6
|
const compositions = await (0, renderer_1.getCompositions)(serveUrl, {
|
|
7
7
|
puppeteerInstance: browserInstance,
|
|
8
8
|
inputProps: inputProps,
|
|
@@ -20,6 +20,10 @@ const validateComposition = async ({ serveUrl, composition, browserInstance, inp
|
|
|
20
20
|
.map((c) => c.id)
|
|
21
21
|
.join(', ')}`);
|
|
22
22
|
}
|
|
23
|
-
return
|
|
23
|
+
return {
|
|
24
|
+
...found,
|
|
25
|
+
height: forceHeight !== null && forceHeight !== void 0 ? forceHeight : found.height,
|
|
26
|
+
width: forceWidth !== null && forceWidth !== void 0 ? forceWidth : found.width,
|
|
27
|
+
};
|
|
24
28
|
};
|
|
25
29
|
exports.validateComposition = validateComposition;
|
package/dist/functions/launch.js
CHANGED
|
@@ -128,6 +128,8 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
128
128
|
chromiumOptions: params.chromiumOptions,
|
|
129
129
|
port: null,
|
|
130
130
|
downloadMap,
|
|
131
|
+
forceHeight: params.forceHeight,
|
|
132
|
+
forceWidth: params.forceWidth,
|
|
131
133
|
});
|
|
132
134
|
remotion_1.Internals.validateDurationInFrames(comp.durationInFrames, 'passed to a Lambda render');
|
|
133
135
|
remotion_1.Internals.validateFps(comp.fps, 'passed to a Lambda render', false);
|
|
@@ -12,9 +12,9 @@ const progressHandler = (lambdaParams, options) => {
|
|
|
12
12
|
}
|
|
13
13
|
if (lambdaParams.version !== version_1.VERSION) {
|
|
14
14
|
if (!lambdaParams.version) {
|
|
15
|
-
throw new Error(`Version mismatch: When calling
|
|
15
|
+
throw new Error(`Version mismatch: When calling renderStillOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${version_1.VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call renderStillOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
16
16
|
}
|
|
17
|
-
throw new Error(`Version mismatch: When calling
|
|
17
|
+
throw new Error(`Version mismatch: When calling renderStillOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call renderStillOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
18
18
|
}
|
|
19
19
|
return (0, get_progress_1.getProgress)({
|
|
20
20
|
bucketName: lambdaParams.bucketName,
|
package/dist/functions/start.js
CHANGED
|
@@ -16,9 +16,9 @@ const startHandler = async (params, options) => {
|
|
|
16
16
|
}
|
|
17
17
|
if (params.version !== version_1.VERSION) {
|
|
18
18
|
if (!params.version) {
|
|
19
|
-
throw new Error(`Version mismatch: When calling renderMediaOnLambda(),
|
|
19
|
+
throw new Error(`Version mismatch: When calling renderMediaOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${version_1.VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
20
20
|
}
|
|
21
|
-
throw new Error(`Version mismatch: When calling renderMediaOnLambda(),
|
|
21
|
+
throw new Error(`Version mismatch: When calling renderMediaOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${params.version}. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
22
22
|
}
|
|
23
23
|
const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
|
|
24
24
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
@@ -66,6 +66,8 @@ const startHandler = async (params, options) => {
|
|
|
66
66
|
webhook: params.webhook,
|
|
67
67
|
audioBitrate: params.audioBitrate,
|
|
68
68
|
videoBitrate: params.videoBitrate,
|
|
69
|
+
forceHeight: params.forceHeight,
|
|
70
|
+
forceWidth: params.forceWidth,
|
|
69
71
|
};
|
|
70
72
|
await (0, aws_clients_1.getLambdaClient)((0, get_current_region_1.getCurrentRegionInFunction)()).send(new client_lambda_1.InvokeCommand({
|
|
71
73
|
FunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
package/dist/functions/still.js
CHANGED
|
@@ -35,10 +35,12 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
35
35
|
throw new TypeError('Expected still type');
|
|
36
36
|
}
|
|
37
37
|
if (lambdaParams.version !== version_1.VERSION) {
|
|
38
|
-
if (
|
|
39
|
-
|
|
38
|
+
if (lambdaParams.version !== version_1.VERSION) {
|
|
39
|
+
if (!lambdaParams.version) {
|
|
40
|
+
throw new Error(`Version mismatch: When calling renderMediaOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${version_1.VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
41
|
+
}
|
|
42
|
+
throw new Error(`Version mismatch: When calling renderMediaOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
40
43
|
}
|
|
41
|
-
throw new Error(`Version mismatch: When calling renderStillOnLambda(), get deployed Lambda function had version ${version_1.VERSION} and the @remotion/lambda package has version ${lambdaParams.version}. Align the versions.`);
|
|
42
44
|
}
|
|
43
45
|
(0, validate_download_behavior_1.validateDownloadBehavior)(lambdaParams.downloadBehavior);
|
|
44
46
|
(0, validate_privacy_1.validatePrivacy)(lambdaParams.privacy);
|
|
@@ -71,6 +73,8 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
71
73
|
timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
|
|
72
74
|
port: null,
|
|
73
75
|
downloadMap,
|
|
76
|
+
forceHeight: lambdaParams.forceHeight,
|
|
77
|
+
forceWidth: lambdaParams.forceWidth,
|
|
74
78
|
});
|
|
75
79
|
const renderMetadata = {
|
|
76
80
|
startedDate: Date.now(),
|
package/dist/internals.d.ts
CHANGED
|
@@ -139,6 +139,8 @@ export declare type LambdaPayloads = {
|
|
|
139
139
|
audioBitrate: string | null;
|
|
140
140
|
videoBitrate: string | null;
|
|
141
141
|
webhook: WebhookOption;
|
|
142
|
+
forceHeight: number | null;
|
|
143
|
+
forceWidth: number | null;
|
|
142
144
|
};
|
|
143
145
|
launch: {
|
|
144
146
|
type: LambdaRoutines.launch;
|
|
@@ -172,6 +174,8 @@ export declare type LambdaPayloads = {
|
|
|
172
174
|
audioBitrate: string | null;
|
|
173
175
|
videoBitrate: string | null;
|
|
174
176
|
webhook: WebhookOption;
|
|
177
|
+
forceHeight: number | null;
|
|
178
|
+
forceWidth: number | null;
|
|
175
179
|
};
|
|
176
180
|
status: {
|
|
177
181
|
type: LambdaRoutines.status;
|
|
@@ -232,6 +236,8 @@ export declare type LambdaPayloads = {
|
|
|
232
236
|
scale: number;
|
|
233
237
|
downloadBehavior: DownloadBehavior | null;
|
|
234
238
|
version: string;
|
|
239
|
+
forceHeight: number | null;
|
|
240
|
+
forceWidth: number | null;
|
|
235
241
|
};
|
|
236
242
|
};
|
|
237
243
|
export declare type LambdaPayload = LambdaPayloads[LambdaRoutines];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.40",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"build": "tsc -d && pnpm run buildlambda",
|
|
16
16
|
"buildlambda": "ts-node src/admin/bundle-lambda.ts",
|
|
17
17
|
"start": "ts-node src/run.ts",
|
|
18
|
-
"
|
|
18
|
+
"prepublishOnly": "ts-node src/admin/bundle-lambda.ts && node ensure-version-match.js"
|
|
19
19
|
},
|
|
20
20
|
"author": "",
|
|
21
21
|
"license": "MIT",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"@aws-sdk/client-service-quotas": "3.190.0",
|
|
32
32
|
"@aws-sdk/lib-storage": "3.190.0",
|
|
33
33
|
"@aws-sdk/s3-request-presigner": "3.190.0",
|
|
34
|
-
"@remotion/bundler": "3.2.
|
|
35
|
-
"@remotion/cli": "3.2.
|
|
36
|
-
"@remotion/renderer": "3.2.
|
|
34
|
+
"@remotion/bundler": "3.2.40",
|
|
35
|
+
"@remotion/cli": "3.2.40",
|
|
36
|
+
"@remotion/renderer": "3.2.40",
|
|
37
37
|
"aws-policies": "^1.0.1",
|
|
38
38
|
"mime-types": "2.1.34",
|
|
39
|
-
"remotion": "3.2.
|
|
39
|
+
"remotion": "3.2.40"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=16.8.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "dd204bb0a42d4c6c2988957d399c898e5eba4eba"
|
|
63
63
|
}
|
package/remotionlambda.zip
CHANGED
|
Binary file
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.canUseOptimization = void 0;
|
|
4
|
-
const version_1 = require("remotion/version");
|
|
5
|
-
const canUseOptimization = ({ optimization, framesPerLambda, frameRange, }) => {
|
|
6
|
-
if (!optimization) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
if (optimization.framesPerLambda !== framesPerLambda) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
if (optimization.lambdaVersion !== version_1.VERSION) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
if (optimization.frameRange[0] !== frameRange[0]) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
if (optimization.frameRange[1] !== frameRange[1]) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
return true;
|
|
22
|
-
};
|
|
23
|
-
exports.canUseOptimization = canUseOptimization;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
2
|
-
export declare const collectChunkInformation: ({ bucketName, renderId, region, expectedBucketOwner, }: {
|
|
3
|
-
bucketName: string;
|
|
4
|
-
renderId: string;
|
|
5
|
-
region: AwsRegion;
|
|
6
|
-
expectedBucketOwner: string;
|
|
7
|
-
}) => Promise<(Omit<import("./types").ObjectChunkTimingData, "timings"> & {
|
|
8
|
-
timings: number[];
|
|
9
|
-
})[]>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.collectChunkInformation = void 0;
|
|
4
|
-
const constants_1 = require("../../shared/constants");
|
|
5
|
-
const stream_to_string_1 = require("../../shared/stream-to-string");
|
|
6
|
-
const io_1 = require("../helpers/io");
|
|
7
|
-
const collectChunkInformation = async ({ bucketName, renderId, region, expectedBucketOwner, }) => {
|
|
8
|
-
const prefix = (0, constants_1.lambdaTimingsPrefix)(renderId);
|
|
9
|
-
const timingFiles = await (0, io_1.lambdaLs)({
|
|
10
|
-
bucketName,
|
|
11
|
-
prefix,
|
|
12
|
-
region,
|
|
13
|
-
expectedBucketOwner,
|
|
14
|
-
});
|
|
15
|
-
const timingFileContents = await Promise.all(timingFiles.map(async (file) => {
|
|
16
|
-
const contents = await (0, io_1.lambdaReadFile)({
|
|
17
|
-
bucketName,
|
|
18
|
-
key: file.Key,
|
|
19
|
-
region,
|
|
20
|
-
expectedBucketOwner,
|
|
21
|
-
});
|
|
22
|
-
const string = await (0, stream_to_string_1.streamToString)(contents);
|
|
23
|
-
return JSON.parse(string);
|
|
24
|
-
}));
|
|
25
|
-
return timingFileContents;
|
|
26
|
-
};
|
|
27
|
-
exports.collectChunkInformation = collectChunkInformation;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sortProfileByFrameRanges = exports.getFrameRangesFromProfile = void 0;
|
|
4
|
-
const getFrameRangesFromProfile = (profile) => {
|
|
5
|
-
return profile.map((p) => p.frameRange);
|
|
6
|
-
};
|
|
7
|
-
exports.getFrameRangesFromProfile = getFrameRangesFromProfile;
|
|
8
|
-
const sortProfileByFrameRanges = (profile) => {
|
|
9
|
-
return profile.slice().sort((a, b) => a.frameRange[0] - b.frameRange[0]);
|
|
10
|
-
};
|
|
11
|
-
exports.sortProfileByFrameRanges = sortProfileByFrameRanges;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProfileDuration = exports.getTimingEndTimestamps = void 0;
|
|
4
|
-
const getTimingEndTimestamps = (chunk) => {
|
|
5
|
-
return chunk.timings.map((timing) => chunk.startDate + timing);
|
|
6
|
-
};
|
|
7
|
-
exports.getTimingEndTimestamps = getTimingEndTimestamps;
|
|
8
|
-
const getProfileTimestamps = (chunks) => {
|
|
9
|
-
return chunks.map((c) => (0, exports.getTimingEndTimestamps)(c));
|
|
10
|
-
};
|
|
11
|
-
const getProfileDuration = (chunks) => {
|
|
12
|
-
const startTimeStamps = chunks.map((c) => c.startDate).flat(1);
|
|
13
|
-
const endTimestamps = getProfileTimestamps(chunks).flat(1);
|
|
14
|
-
const earliest = Math.min(...startTimeStamps);
|
|
15
|
-
const latest = Math.max(...endTimestamps);
|
|
16
|
-
return latest - earliest;
|
|
17
|
-
};
|
|
18
|
-
exports.getProfileDuration = getProfileDuration;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isValidOptimizationProfile = void 0;
|
|
4
|
-
const renderer_1 = require("@remotion/renderer");
|
|
5
|
-
const isValidOptimizationProfile = (profile) => {
|
|
6
|
-
return profile.every((timing) => {
|
|
7
|
-
const frames = renderer_1.RenderInternals.getFramesToRender(timing.frameRange, 1);
|
|
8
|
-
const values = Object.values(timing.timings);
|
|
9
|
-
return frames.length === values.length && values.every((v) => v > 0);
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
exports.isValidOptimizationProfile = isValidOptimizationProfile;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.optimizeInvocationOrder = void 0;
|
|
4
|
-
const sort_by_duration_1 = require("./sort-by-duration");
|
|
5
|
-
const optimizeInvocationOrder = (profile) => {
|
|
6
|
-
const sortedByDuration = (0, sort_by_duration_1.sortProfileByDuration)(profile).reverse();
|
|
7
|
-
const sortedByStartTime = profile
|
|
8
|
-
.slice()
|
|
9
|
-
.map((a) => a.startDate)
|
|
10
|
-
.sort((a, b) => a - b);
|
|
11
|
-
const result = sortedByStartTime.map((prof, i) => {
|
|
12
|
-
return {
|
|
13
|
-
...sortedByDuration[i],
|
|
14
|
-
startDate: prof,
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
return result;
|
|
18
|
-
};
|
|
19
|
-
exports.optimizeInvocationOrder = optimizeInvocationOrder;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { TimingProfile } from './types';
|
|
2
|
-
export declare const assignFrameToOther: ({ frameRanges, fromChunk, toChunk, framesToShift, }: {
|
|
3
|
-
frameRanges: [number, number][];
|
|
4
|
-
fromChunk: number;
|
|
5
|
-
toChunk: number;
|
|
6
|
-
framesToShift: number;
|
|
7
|
-
}) => [number, number][];
|
|
8
|
-
export declare const optimizeProfile: (_profile: TimingProfile) => TimingProfile;
|
|
9
|
-
export declare const optimizeProfileRecursively: (profile: TimingProfile, amount: number) => TimingProfile;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.optimizeProfileRecursively = exports.optimizeProfile = exports.assignFrameToOther = void 0;
|
|
4
|
-
const get_frame_ranges_from_profile_1 = require("./get-frame-ranges-from-profile");
|
|
5
|
-
const simulate_frame_ranges_1 = require("./simulate-frame-ranges");
|
|
6
|
-
const sort_by_duration_1 = require("./sort-by-duration");
|
|
7
|
-
const assignFrameToOther = ({ frameRanges, fromChunk, toChunk, framesToShift, }) => {
|
|
8
|
-
if (fromChunk < toChunk) {
|
|
9
|
-
return frameRanges.map((frameRange, i) => {
|
|
10
|
-
if (i === fromChunk) {
|
|
11
|
-
return [frameRange[0], frameRange[1] - framesToShift];
|
|
12
|
-
}
|
|
13
|
-
if (i === toChunk) {
|
|
14
|
-
return [frameRange[0] - framesToShift, frameRange[1]];
|
|
15
|
-
}
|
|
16
|
-
if (i > fromChunk && i < toChunk) {
|
|
17
|
-
return [frameRange[0] - framesToShift, frameRange[1] - framesToShift];
|
|
18
|
-
}
|
|
19
|
-
return frameRange;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return frameRanges.map((frameRange, i) => {
|
|
23
|
-
if (i === fromChunk) {
|
|
24
|
-
return [frameRange[0] + framesToShift, frameRange[1]];
|
|
25
|
-
}
|
|
26
|
-
if (i === toChunk) {
|
|
27
|
-
return [frameRange[0], frameRange[1] + framesToShift];
|
|
28
|
-
}
|
|
29
|
-
if (i > toChunk && i < fromChunk) {
|
|
30
|
-
return [frameRange[0] + framesToShift, frameRange[1] + framesToShift];
|
|
31
|
-
}
|
|
32
|
-
return frameRange;
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
exports.assignFrameToOther = assignFrameToOther;
|
|
36
|
-
const optimizeProfile = (_profile) => {
|
|
37
|
-
const sortedByStart = _profile
|
|
38
|
-
.slice()
|
|
39
|
-
.sort((a, b) => a.frameRange[0] - b.frameRange[0]);
|
|
40
|
-
const sortedByDuration = (0, sort_by_duration_1.sortProfileByDuration)(sortedByStart);
|
|
41
|
-
const indexOfFastest = sortedByStart.indexOf(sortedByDuration[0]);
|
|
42
|
-
if (indexOfFastest === -1) {
|
|
43
|
-
throw new Error('invalid timing profile: ' + JSON.stringify(_profile));
|
|
44
|
-
}
|
|
45
|
-
const slowest = sortedByDuration[sortedByDuration.length - 1];
|
|
46
|
-
const indexOfSlowest = sortedByStart.indexOf(slowest);
|
|
47
|
-
if (indexOfSlowest === -1) {
|
|
48
|
-
throw new Error('invalid timing profile: ' + JSON.stringify(_profile));
|
|
49
|
-
}
|
|
50
|
-
const frameRanges = (0, get_frame_ranges_from_profile_1.getFrameRangesFromProfile)(sortedByStart);
|
|
51
|
-
if (indexOfFastest === indexOfSlowest) {
|
|
52
|
-
return _profile;
|
|
53
|
-
}
|
|
54
|
-
const newFrameRanges = (0, exports.assignFrameToOther)({
|
|
55
|
-
frameRanges,
|
|
56
|
-
fromChunk: indexOfSlowest,
|
|
57
|
-
toChunk: indexOfFastest,
|
|
58
|
-
framesToShift: Math.max(1, Math.min(2, Math.floor(slowest.timings.length / 3))),
|
|
59
|
-
});
|
|
60
|
-
const simulated = (0, simulate_frame_ranges_1.simulateFrameRanges)({
|
|
61
|
-
profile: sortedByStart,
|
|
62
|
-
newFrameRanges,
|
|
63
|
-
});
|
|
64
|
-
return simulated;
|
|
65
|
-
};
|
|
66
|
-
exports.optimizeProfile = optimizeProfile;
|
|
67
|
-
const optimizeProfileRecursively = (profile, amount) => {
|
|
68
|
-
let optimized = profile;
|
|
69
|
-
for (let i = 0; i < amount; i++) {
|
|
70
|
-
optimized = (0, exports.optimizeProfile)(optimized);
|
|
71
|
-
}
|
|
72
|
-
return optimized;
|
|
73
|
-
};
|
|
74
|
-
exports.optimizeProfileRecursively = optimizeProfileRecursively;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
2
|
-
import type { OptimizationProfile } from './types';
|
|
3
|
-
export declare const writeOptimization: ({ bucketName, optimization, compositionId, siteId, region, expectedBucketOwner, }: {
|
|
4
|
-
bucketName: string;
|
|
5
|
-
optimization: OptimizationProfile;
|
|
6
|
-
compositionId: string;
|
|
7
|
-
siteId: string;
|
|
8
|
-
region: AwsRegion;
|
|
9
|
-
expectedBucketOwner: string;
|
|
10
|
-
}) => Promise<void>;
|
|
11
|
-
export declare const getOptimization: ({ siteId, compositionId, bucketName, region, expectedBucketOwner, }: {
|
|
12
|
-
bucketName: string;
|
|
13
|
-
siteId: string;
|
|
14
|
-
compositionId: string;
|
|
15
|
-
region: AwsRegion;
|
|
16
|
-
expectedBucketOwner: string;
|
|
17
|
-
}) => Promise<OptimizationProfile | null>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOptimization = exports.writeOptimization = void 0;
|
|
4
|
-
const constants_1 = require("../../shared/constants");
|
|
5
|
-
const stream_to_string_1 = require("../../shared/stream-to-string");
|
|
6
|
-
const io_1 = require("../helpers/io");
|
|
7
|
-
const writeOptimization = async ({ bucketName, optimization, compositionId, siteId, region, expectedBucketOwner, }) => {
|
|
8
|
-
await (0, io_1.lambdaWriteFile)({
|
|
9
|
-
bucketName,
|
|
10
|
-
body: JSON.stringify(optimization),
|
|
11
|
-
key: (0, constants_1.optimizationProfile)(siteId, compositionId) + '.json',
|
|
12
|
-
region,
|
|
13
|
-
privacy: 'private',
|
|
14
|
-
expectedBucketOwner,
|
|
15
|
-
downloadBehavior: null,
|
|
16
|
-
customCredentials: null,
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
exports.writeOptimization = writeOptimization;
|
|
20
|
-
const getOptimization = async ({ siteId, compositionId, bucketName, region, expectedBucketOwner, }) => {
|
|
21
|
-
const prefix = (0, constants_1.optimizationProfile)(siteId, compositionId);
|
|
22
|
-
const dir = await (0, io_1.lambdaLs)({
|
|
23
|
-
bucketName,
|
|
24
|
-
prefix,
|
|
25
|
-
region,
|
|
26
|
-
expectedBucketOwner,
|
|
27
|
-
});
|
|
28
|
-
const files = dir
|
|
29
|
-
.sort((a, b) => {
|
|
30
|
-
var _a, _b;
|
|
31
|
-
return ((_a = a.LastModified) === null || _a === void 0 ? void 0 : _a.getTime()) -
|
|
32
|
-
((_b = b.LastModified) === null || _b === void 0 ? void 0 : _b.getTime());
|
|
33
|
-
})
|
|
34
|
-
.reverse();
|
|
35
|
-
if (files.length === 0) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
const body = await (0, io_1.lambdaReadFile)({
|
|
39
|
-
bucketName,
|
|
40
|
-
key: files[0].Key,
|
|
41
|
-
region,
|
|
42
|
-
expectedBucketOwner,
|
|
43
|
-
});
|
|
44
|
-
const str = await (0, stream_to_string_1.streamToString)(body);
|
|
45
|
-
return JSON.parse(str);
|
|
46
|
-
};
|
|
47
|
-
exports.getOptimization = getOptimization;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ChunkTimingData, TimingProfile } from './types';
|
|
2
|
-
export declare const getTimingForFrame: (profile: TimingProfile, frame: number) => number;
|
|
3
|
-
export declare const getSimulatedTimingForFrameRange: (profile: TimingProfile, frameRange: [number, number]) => ChunkTimingData['timings'];
|
|
4
|
-
export declare const simulateFrameRanges: ({ profile, newFrameRanges, }: {
|
|
5
|
-
profile: TimingProfile;
|
|
6
|
-
newFrameRanges: [number, number][];
|
|
7
|
-
}) => TimingProfile;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.simulateFrameRanges = exports.getSimulatedTimingForFrameRange = exports.getTimingForFrame = void 0;
|
|
4
|
-
const getTimingForFrame = (profile, frame) => {
|
|
5
|
-
for (const timingInfo of profile) {
|
|
6
|
-
if (timingInfo.frameRange[0] > frame || timingInfo.frameRange[1] < frame) {
|
|
7
|
-
continue;
|
|
8
|
-
}
|
|
9
|
-
let lastTime = timingInfo.startDate;
|
|
10
|
-
for (let i = 0; i < timingInfo.timings.length; i++) {
|
|
11
|
-
const actualFrame = i + timingInfo.frameRange[0];
|
|
12
|
-
const timing = timingInfo.timings[i];
|
|
13
|
-
const absolute = timing + timingInfo.startDate;
|
|
14
|
-
if (actualFrame === frame) {
|
|
15
|
-
return absolute - lastTime;
|
|
16
|
-
}
|
|
17
|
-
lastTime = absolute;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
throw new Error(`Frame ${frame} was not rendered`);
|
|
21
|
-
};
|
|
22
|
-
exports.getTimingForFrame = getTimingForFrame;
|
|
23
|
-
const getSimulatedTimingForFrameRange = (profile, frameRange) => {
|
|
24
|
-
const timings = [];
|
|
25
|
-
let totalDuration = 0;
|
|
26
|
-
for (let i = frameRange[0]; i <= frameRange[1]; i++) {
|
|
27
|
-
const timingForFrame = (0, exports.getTimingForFrame)(profile, i);
|
|
28
|
-
timings.push(timingForFrame + totalDuration);
|
|
29
|
-
totalDuration += timingForFrame;
|
|
30
|
-
}
|
|
31
|
-
return timings;
|
|
32
|
-
};
|
|
33
|
-
exports.getSimulatedTimingForFrameRange = getSimulatedTimingForFrameRange;
|
|
34
|
-
const simulateFrameRanges = ({ profile, newFrameRanges, }) => {
|
|
35
|
-
if (profile.length !== newFrameRanges.length) {
|
|
36
|
-
throw new Error('Expected previous and new frame ranges to be equal');
|
|
37
|
-
}
|
|
38
|
-
return newFrameRanges.map((range, i) => {
|
|
39
|
-
return {
|
|
40
|
-
timings: (0, exports.getSimulatedTimingForFrameRange)(profile, range),
|
|
41
|
-
chunk: i,
|
|
42
|
-
frameRange: range,
|
|
43
|
-
startDate: profile[i].startDate,
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
exports.simulateFrameRanges = simulateFrameRanges;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sortProfileByDuration = void 0;
|
|
4
|
-
const get_profile_duration_1 = require("./get-profile-duration");
|
|
5
|
-
const durationCache = new Map();
|
|
6
|
-
const getChunkDuration = (chunk) => {
|
|
7
|
-
const inCache = durationCache.get(chunk);
|
|
8
|
-
if (inCache) {
|
|
9
|
-
return inCache;
|
|
10
|
-
}
|
|
11
|
-
const timestamps = (0, get_profile_duration_1.getTimingEndTimestamps)(chunk);
|
|
12
|
-
const duration = Math.max(...timestamps) - chunk.startDate;
|
|
13
|
-
durationCache.set(chunk, duration);
|
|
14
|
-
return duration;
|
|
15
|
-
};
|
|
16
|
-
const sortProfileByDuration = (profile) => {
|
|
17
|
-
const sortedByDuration = profile.slice().sort((a, b) => {
|
|
18
|
-
const aDuration = getChunkDuration(a);
|
|
19
|
-
const bDuration = getChunkDuration(b);
|
|
20
|
-
return aDuration - bDuration;
|
|
21
|
-
});
|
|
22
|
-
durationCache.clear();
|
|
23
|
-
return sortedByDuration;
|
|
24
|
-
};
|
|
25
|
-
exports.sortProfileByDuration = sortProfileByDuration;
|