@remotion/cloudrun 4.0.174 → 4.0.176
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-test.log +20 -0
- package/dist/api/render-media-on-cloudrun.d.ts +5 -3
- package/dist/api/render-media-on-cloudrun.js +6 -2
- package/dist/api/render-still-on-cloudrun.d.ts +2 -0
- package/dist/api/render-still-on-cloudrun.js +4 -2
- package/dist/cli/commands/render/index.js +1 -0
- package/dist/functions/helpers/get-download-behavior-setting.d.ts +2 -0
- package/dist/functions/helpers/get-download-behavior-setting.js +48 -0
- package/dist/functions/helpers/payloads.d.ts +73 -0
- package/dist/functions/helpers/payloads.js +11 -0
- package/dist/functions/render-media-single-thread.js +6 -0
- package/dist/functions/render-still-single-thread.js +5 -0
- package/dist/index.d.ts +1 -1
- package/package.json +11 -11
package/.turbo/turbo-build.log
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
> @remotion/cloudrun@4.0.163 test /Users/jonathanburger/remotion/packages/cloudrun
|
|
3
|
+
> vitest --run
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[7m[1m[36m RUN [39m[22m[27m [36mv0.31.1[39m [90m/Users/jonathanburger/remotion/packages/cloudrun[39m
|
|
7
|
+
|
|
8
|
+
[?25l [32m✓[39m [2msrc/api/test/[22mservice-names[2m.test.ts[22m[2m (1)[22m
|
|
9
|
+
[32m✓[39m [2msrc/api/test/[22mmake-console[2m.test.ts[22m[2m (2)[22m
|
|
10
|
+
[32m✓[39m [2msrc/api/test/[22mrunning-in-what-server[2m.test.ts[22m[2m (4)[22m
|
|
11
|
+
[2K[1A[2K[1A[2K[1A[2K[G [32m✓[39m [2msrc/api/test/[22mservice-names[2m.test.ts[22m[2m (1)[22m
|
|
12
|
+
[32m✓[39m [2msrc/api/test/[22mmake-console[2m.test.ts[22m[2m (2)[22m
|
|
13
|
+
[32m✓[39m [2msrc/api/test/[22mrunning-in-what-server[2m.test.ts[22m[2m (4)[22m
|
|
14
|
+
|
|
15
|
+
[2m Test Files [22m [1m[32m3 passed[39m[22m[90m (3)[39m
|
|
16
|
+
[2m Tests [22m [1m[32m7 passed[39m[22m[90m (7)[39m
|
|
17
|
+
[2m Start at [22m 19:38:46
|
|
18
|
+
[2m Duration [22m 887ms[2m (transform 278ms, setup 0ms, collect 429ms, tests 5ms, environment 0ms, prepare 109ms)[22m
|
|
19
|
+
|
|
20
|
+
[?25h
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AudioCodec, ChromiumOptions, FrameRange, LogLevel, PixelFormat, ProResProfile, ToOptions, VideoImageFormat } from '@remotion/renderer';
|
|
2
2
|
import type { BrowserSafeApis } from '@remotion/renderer/client';
|
|
3
|
-
import type { CloudRunCrashResponse, RenderMediaOnCloudrunOutput } from '../functions/helpers/payloads';
|
|
3
|
+
import type { CloudRunCrashResponse, DownloadBehavior, RenderMediaOnCloudrunOutput } from '../functions/helpers/payloads';
|
|
4
4
|
import type { GcpRegion } from '../pricing/gcp-regions';
|
|
5
5
|
import type { CloudrunCodec } from '../shared/validate-gcp-codec';
|
|
6
6
|
type InternalRenderMediaOnCloudrun = {
|
|
@@ -30,6 +30,7 @@ type InternalRenderMediaOnCloudrun = {
|
|
|
30
30
|
preferLossless: boolean | undefined;
|
|
31
31
|
indent: boolean;
|
|
32
32
|
logLevel: LogLevel;
|
|
33
|
+
downloadBehavior: DownloadBehavior;
|
|
33
34
|
} & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnCloudRun>>;
|
|
34
35
|
export type RenderMediaOnCloudrunInput = {
|
|
35
36
|
cloudRunUrl?: string;
|
|
@@ -57,8 +58,9 @@ export type RenderMediaOnCloudrunInput = {
|
|
|
57
58
|
forceHeight?: number | null;
|
|
58
59
|
concurrency?: number | string | null;
|
|
59
60
|
preferLossless?: boolean;
|
|
61
|
+
downloadBehavior?: DownloadBehavior;
|
|
60
62
|
} & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnCloudRun>>;
|
|
61
|
-
export declare const internalRenderMediaOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, colorSpace, }: InternalRenderMediaOnCloudrun) => Promise<RenderMediaOnCloudrunOutput | CloudRunCrashResponse>;
|
|
63
|
+
export declare const internalRenderMediaOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, colorSpace, downloadBehavior, }: InternalRenderMediaOnCloudrun) => Promise<RenderMediaOnCloudrunOutput | CloudRunCrashResponse>;
|
|
62
64
|
/**
|
|
63
65
|
* @description Triggers a render on a GCP Cloud Run service given a composition and a Cloud Run URL.
|
|
64
66
|
* @see [Documentation](https://remotion.dev/docs/cloudrun/renderMediaOnGcp)
|
|
@@ -100,5 +102,5 @@ export declare const internalRenderMediaOnCloudrun: ({ cloudRunUrl, serviceName,
|
|
|
100
102
|
* @param params.preferLossless Uses a lossless audio codec, if one is available for the codec. If you set audioCodec, it takes priority over preferLossless.
|
|
101
103
|
* @returns {Promise<RenderMediaOnCloudrunOutput>} See documentation for detailed structure
|
|
102
104
|
*/
|
|
103
|
-
export declare const renderMediaOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, colorSpace, }: RenderMediaOnCloudrunInput) => Promise<RenderMediaOnCloudrunOutput | CloudRunCrashResponse>;
|
|
105
|
+
export declare const renderMediaOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, colorSpace, downloadBehavior, }: RenderMediaOnCloudrunInput) => Promise<RenderMediaOnCloudrunOutput | CloudRunCrashResponse>;
|
|
104
106
|
export {};
|
|
@@ -10,7 +10,7 @@ const validate_serveurl_1 = require("../shared/validate-serveurl");
|
|
|
10
10
|
const get_or_create_bucket_1 = require("./get-or-create-bucket");
|
|
11
11
|
const get_auth_client_for_url_1 = require("./helpers/get-auth-client-for-url");
|
|
12
12
|
const get_cloudrun_endpoint_1 = require("./helpers/get-cloudrun-endpoint");
|
|
13
|
-
const internalRenderMediaOnCloudrunRaw = async ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, colorSpace, }) => {
|
|
13
|
+
const internalRenderMediaOnCloudrunRaw = async ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, colorSpace, downloadBehavior, }) => {
|
|
14
14
|
const actualCodec = (0, validate_gcp_codec_1.validateCloudrunCodec)(codec);
|
|
15
15
|
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
16
16
|
if (privacy)
|
|
@@ -62,6 +62,7 @@ const internalRenderMediaOnCloudrunRaw = async ({ cloudRunUrl, serviceName, regi
|
|
|
62
62
|
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
|
|
63
63
|
colorSpace: colorSpace !== null && colorSpace !== void 0 ? colorSpace : null,
|
|
64
64
|
clientVersion: version_1.VERSION,
|
|
65
|
+
downloadBehavior,
|
|
65
66
|
};
|
|
66
67
|
const client = await (0, get_auth_client_for_url_1.getAuthClientForUrl)(cloudRunEndpoint);
|
|
67
68
|
const postResponse = await client.request({
|
|
@@ -166,7 +167,7 @@ exports.internalRenderMediaOnCloudrun = pure_1.NoReactAPIs.wrapWithErrorHandling
|
|
|
166
167
|
* @param params.preferLossless Uses a lossless audio codec, if one is available for the codec. If you set audioCodec, it takes priority over preferLossless.
|
|
167
168
|
* @returns {Promise<RenderMediaOnCloudrunOutput>} See documentation for detailed structure
|
|
168
169
|
*/
|
|
169
|
-
const renderMediaOnCloudrun = ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, colorSpace, }) => {
|
|
170
|
+
const renderMediaOnCloudrun = ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, colorSpace, downloadBehavior, }) => {
|
|
170
171
|
return (0, exports.internalRenderMediaOnCloudrun)({
|
|
171
172
|
cloudRunUrl: cloudRunUrl !== null && cloudRunUrl !== void 0 ? cloudRunUrl : undefined,
|
|
172
173
|
serviceName: serviceName !== null && serviceName !== void 0 ? serviceName : undefined,
|
|
@@ -207,6 +208,9 @@ const renderMediaOnCloudrun = ({ cloudRunUrl, serviceName, region, serveUrl, com
|
|
|
207
208
|
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : undefined,
|
|
208
209
|
colorSpace: colorSpace !== null && colorSpace !== void 0 ? colorSpace : undefined,
|
|
209
210
|
indent: false,
|
|
211
|
+
downloadBehavior: downloadBehavior !== null && downloadBehavior !== void 0 ? downloadBehavior : {
|
|
212
|
+
type: 'play-in-browser',
|
|
213
|
+
},
|
|
210
214
|
});
|
|
211
215
|
};
|
|
212
216
|
exports.renderMediaOnCloudrun = renderMediaOnCloudrun;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ChromiumOptions, StillImageFormat, ToOptions } from '@remotion/renderer';
|
|
2
2
|
import { BrowserSafeApis } from '@remotion/renderer/client';
|
|
3
|
+
import type { DownloadBehavior } from '../functions/helpers/payloads';
|
|
3
4
|
import type { GcpRegion } from '../pricing/gcp-regions';
|
|
4
5
|
type MandatoryParameters = {
|
|
5
6
|
region: GcpRegion;
|
|
@@ -20,6 +21,7 @@ type OptionalParameters = {
|
|
|
20
21
|
forceWidth: number | null;
|
|
21
22
|
forceHeight: number | null;
|
|
22
23
|
indent: boolean;
|
|
24
|
+
downloadBehavior: DownloadBehavior;
|
|
23
25
|
} & ToOptions<typeof BrowserSafeApis.optionsMap.renderStillOnCloudRun>;
|
|
24
26
|
export type RenderStillOnCloudrunInput = Partial<OptionalParameters> & MandatoryParameters;
|
|
25
27
|
export declare const renderStillOnCloudrun: (options: RenderStillOnCloudrunInput) => Promise<{
|
|
@@ -34,7 +34,7 @@ const get_cloudrun_endpoint_1 = require("./helpers/get-cloudrun-endpoint");
|
|
|
34
34
|
* @param params.delayRenderTimeoutInMilliseconds A number describing how long the render may take to resolve all delayRender() calls before it times out.
|
|
35
35
|
* @returns {Promise<RenderStillOnCloudrunOutput>} See documentation for detailed structure
|
|
36
36
|
*/
|
|
37
|
-
const internalRenderStillOnCloudRun = async ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, forceBucketName, privacy, outName, imageFormat, envVariables, frame, jpegQuality, chromiumOptions, scale, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, offthreadVideoCacheSizeInBytes, }) => {
|
|
37
|
+
const internalRenderStillOnCloudRun = async ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, forceBucketName, privacy, outName, imageFormat, envVariables, frame, jpegQuality, chromiumOptions, scale, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, offthreadVideoCacheSizeInBytes, downloadBehavior, }) => {
|
|
38
38
|
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
39
39
|
if (privacy)
|
|
40
40
|
(0, validate_privacy_1.validatePrivacy)(privacy);
|
|
@@ -68,6 +68,7 @@ const internalRenderStillOnCloudRun = async ({ cloudRunUrl, serviceName, region,
|
|
|
68
68
|
delayRenderTimeoutInMilliseconds,
|
|
69
69
|
offthreadVideoCacheSizeInBytes,
|
|
70
70
|
clientVersion: version_1.VERSION,
|
|
71
|
+
downloadBehavior,
|
|
71
72
|
};
|
|
72
73
|
const client = await (0, get_auth_client_for_url_1.getAuthClientForUrl)(cloudRunEndpoint);
|
|
73
74
|
const postResponse = await client.request({
|
|
@@ -127,7 +128,7 @@ const internalRenderStillOnCloudRun = async ({ cloudRunUrl, serviceName, region,
|
|
|
127
128
|
};
|
|
128
129
|
const errorHandled = pure_1.NoReactAPIs.wrapWithErrorHandling(internalRenderStillOnCloudRun);
|
|
129
130
|
const renderStillOnCloudrun = (options) => {
|
|
130
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
131
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
131
132
|
return errorHandled({
|
|
132
133
|
chromiumOptions: (_a = options.chromiumOptions) !== null && _a !== void 0 ? _a : {},
|
|
133
134
|
cloudRunUrl: (_b = options.cloudRunUrl) !== null && _b !== void 0 ? _b : null,
|
|
@@ -150,6 +151,7 @@ const renderStillOnCloudrun = (options) => {
|
|
|
150
151
|
scale: (_r = options.scale) !== null && _r !== void 0 ? _r : 1,
|
|
151
152
|
serveUrl: options.serveUrl,
|
|
152
153
|
serviceName: (_s = options.serviceName) !== null && _s !== void 0 ? _s : null,
|
|
154
|
+
downloadBehavior: (_t = options.downloadBehavior) !== null && _t !== void 0 ? _t : { type: 'play-in-browser' },
|
|
153
155
|
});
|
|
154
156
|
};
|
|
155
157
|
exports.renderStillOnCloudrun = renderStillOnCloudrun;
|
|
@@ -231,6 +231,7 @@ ${downloadName ? ` Downloaded File = ${downloadName}` : ''}
|
|
|
231
231
|
offthreadVideoCacheSizeInBytes,
|
|
232
232
|
colorSpace,
|
|
233
233
|
indent: false,
|
|
234
|
+
downloadBehavior: { type: 'play-in-browser' },
|
|
234
235
|
});
|
|
235
236
|
if (res.type === 'crash') {
|
|
236
237
|
(0, cloudrun_crash_logs_1.displayCrashLogs)(res, logLevel);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDownloadBehaviorSetting = void 0;
|
|
4
|
+
const problematicCharacters = {
|
|
5
|
+
'%3A': ':',
|
|
6
|
+
'%2F': '/',
|
|
7
|
+
'%3F': '?',
|
|
8
|
+
'%23': '#',
|
|
9
|
+
'%5B': '[',
|
|
10
|
+
'%5D': ']',
|
|
11
|
+
'%40': '@',
|
|
12
|
+
'%21': '!',
|
|
13
|
+
'%24': '$',
|
|
14
|
+
'%26': '&',
|
|
15
|
+
'%27': "'",
|
|
16
|
+
'%28': '(',
|
|
17
|
+
'%29': ')',
|
|
18
|
+
'%2A': '*',
|
|
19
|
+
'%2B': '+',
|
|
20
|
+
'%2C': ',',
|
|
21
|
+
'%3B': ';',
|
|
22
|
+
};
|
|
23
|
+
const includesHexOfUnsafeChar = (path) => {
|
|
24
|
+
for (const key of Object.keys(problematicCharacters)) {
|
|
25
|
+
if (path.includes(key)) {
|
|
26
|
+
return { containsHex: true };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return { containsHex: false };
|
|
30
|
+
};
|
|
31
|
+
const getDownloadBehaviorSetting = (downloadBehavior) => {
|
|
32
|
+
if (downloadBehavior.type === 'play-in-browser') {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
if (downloadBehavior.fileName === null) {
|
|
36
|
+
return { contentDisposition: `attachment` };
|
|
37
|
+
}
|
|
38
|
+
const { containsHex } = includesHexOfUnsafeChar(downloadBehavior.fileName);
|
|
39
|
+
if (containsHex) {
|
|
40
|
+
return {
|
|
41
|
+
contentDisposition: `attachment; filename="${downloadBehavior.fileName}"`,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
contentDisposition: `attachment; filename="${encodeURIComponent(downloadBehavior.fileName)}"`,
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
exports.getDownloadBehaviorSetting = getDownloadBehaviorSetting;
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
declare const downloadBehavior: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"play-in-browser">;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
type: "play-in-browser";
|
|
6
|
+
}, {
|
|
7
|
+
type: "play-in-browser";
|
|
8
|
+
}>, z.ZodObject<{
|
|
9
|
+
type: z.ZodLiteral<"download">;
|
|
10
|
+
fileName: z.ZodNullable<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
type: "download";
|
|
13
|
+
fileName: string | null;
|
|
14
|
+
}, {
|
|
15
|
+
type: "download";
|
|
16
|
+
fileName: string | null;
|
|
17
|
+
}>]>;
|
|
18
|
+
export type DownloadBehavior = z.infer<typeof downloadBehavior>;
|
|
2
19
|
export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
3
20
|
type: z.ZodLiteral<"media">;
|
|
4
21
|
serveUrl: z.ZodString;
|
|
@@ -54,6 +71,22 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
54
71
|
offthreadVideoCacheSizeInBytes: z.ZodNullable<z.ZodNumber>;
|
|
55
72
|
colorSpace: z.ZodNullable<z.ZodEnum<["default", "bt709", "bt2020-ncl"]>>;
|
|
56
73
|
clientVersion: z.ZodString;
|
|
74
|
+
downloadBehavior: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
75
|
+
type: z.ZodLiteral<"play-in-browser">;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
type: "play-in-browser";
|
|
78
|
+
}, {
|
|
79
|
+
type: "play-in-browser";
|
|
80
|
+
}>, z.ZodObject<{
|
|
81
|
+
type: z.ZodLiteral<"download">;
|
|
82
|
+
fileName: z.ZodNullable<z.ZodString>;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
type: "download";
|
|
85
|
+
fileName: string | null;
|
|
86
|
+
}, {
|
|
87
|
+
type: "download";
|
|
88
|
+
fileName: string | null;
|
|
89
|
+
}>]>;
|
|
57
90
|
}, "strip", z.ZodTypeAny, {
|
|
58
91
|
type: "media";
|
|
59
92
|
serveUrl: string;
|
|
@@ -86,6 +119,12 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
86
119
|
offthreadVideoCacheSizeInBytes: number | null;
|
|
87
120
|
colorSpace: "default" | "bt709" | "bt2020-ncl" | null;
|
|
88
121
|
clientVersion: string;
|
|
122
|
+
downloadBehavior: {
|
|
123
|
+
type: "play-in-browser";
|
|
124
|
+
} | {
|
|
125
|
+
type: "download";
|
|
126
|
+
fileName: string | null;
|
|
127
|
+
};
|
|
89
128
|
forceHeight?: number | null | undefined;
|
|
90
129
|
forceWidth?: number | null | undefined;
|
|
91
130
|
chromiumOptions?: {
|
|
@@ -129,6 +168,12 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
129
168
|
offthreadVideoCacheSizeInBytes: number | null;
|
|
130
169
|
colorSpace: "default" | "bt709" | "bt2020-ncl" | null;
|
|
131
170
|
clientVersion: string;
|
|
171
|
+
downloadBehavior: {
|
|
172
|
+
type: "play-in-browser";
|
|
173
|
+
} | {
|
|
174
|
+
type: "download";
|
|
175
|
+
fileName: string | null;
|
|
176
|
+
};
|
|
132
177
|
forceHeight?: number | null | undefined;
|
|
133
178
|
forceWidth?: number | null | undefined;
|
|
134
179
|
chromiumOptions?: {
|
|
@@ -178,6 +223,22 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
178
223
|
logLevel: z.ZodEnum<["verbose", "info", "warn", "error"]>;
|
|
179
224
|
offthreadVideoCacheSizeInBytes: z.ZodNullable<z.ZodNumber>;
|
|
180
225
|
clientVersion: z.ZodString;
|
|
226
|
+
downloadBehavior: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
227
|
+
type: z.ZodLiteral<"play-in-browser">;
|
|
228
|
+
}, "strip", z.ZodTypeAny, {
|
|
229
|
+
type: "play-in-browser";
|
|
230
|
+
}, {
|
|
231
|
+
type: "play-in-browser";
|
|
232
|
+
}>, z.ZodObject<{
|
|
233
|
+
type: z.ZodLiteral<"download">;
|
|
234
|
+
fileName: z.ZodNullable<z.ZodString>;
|
|
235
|
+
}, "strip", z.ZodTypeAny, {
|
|
236
|
+
type: "download";
|
|
237
|
+
fileName: string | null;
|
|
238
|
+
}, {
|
|
239
|
+
type: "download";
|
|
240
|
+
fileName: string | null;
|
|
241
|
+
}>]>;
|
|
181
242
|
}, "strip", z.ZodTypeAny, {
|
|
182
243
|
type: "still";
|
|
183
244
|
serveUrl: string;
|
|
@@ -193,6 +254,12 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
193
254
|
delayRenderTimeoutInMilliseconds: number;
|
|
194
255
|
offthreadVideoCacheSizeInBytes: number | null;
|
|
195
256
|
clientVersion: string;
|
|
257
|
+
downloadBehavior: {
|
|
258
|
+
type: "play-in-browser";
|
|
259
|
+
} | {
|
|
260
|
+
type: "download";
|
|
261
|
+
fileName: string | null;
|
|
262
|
+
};
|
|
196
263
|
frame: number;
|
|
197
264
|
forceHeight?: number | null | undefined;
|
|
198
265
|
forceWidth?: number | null | undefined;
|
|
@@ -219,6 +286,12 @@ export declare const CloudRunPayload: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
219
286
|
delayRenderTimeoutInMilliseconds: number;
|
|
220
287
|
offthreadVideoCacheSizeInBytes: number | null;
|
|
221
288
|
clientVersion: string;
|
|
289
|
+
downloadBehavior: {
|
|
290
|
+
type: "play-in-browser";
|
|
291
|
+
} | {
|
|
292
|
+
type: "download";
|
|
293
|
+
fileName: string | null;
|
|
294
|
+
};
|
|
222
295
|
frame: number;
|
|
223
296
|
forceHeight?: number | null | undefined;
|
|
224
297
|
forceWidth?: number | null | undefined;
|
|
@@ -18,6 +18,15 @@ const chromiumOptions = zod_1.z.object({
|
|
|
18
18
|
userAgent: zod_1.z.string().optional().nullable(),
|
|
19
19
|
});
|
|
20
20
|
const logLevel = zod_1.z.enum(client_1.BrowserSafeApis.logLevels);
|
|
21
|
+
const downloadBehavior = zod_1.z.discriminatedUnion('type', [
|
|
22
|
+
zod_1.z.object({
|
|
23
|
+
type: zod_1.z.literal('play-in-browser'),
|
|
24
|
+
}),
|
|
25
|
+
zod_1.z.object({
|
|
26
|
+
type: zod_1.z.literal('download'),
|
|
27
|
+
fileName: zod_1.z.string().nullable(),
|
|
28
|
+
}),
|
|
29
|
+
]);
|
|
21
30
|
exports.CloudRunPayload = zod_1.z.discriminatedUnion('type', [
|
|
22
31
|
zod_1.z.object({
|
|
23
32
|
type: zod_1.z.literal('media'),
|
|
@@ -56,6 +65,7 @@ exports.CloudRunPayload = zod_1.z.discriminatedUnion('type', [
|
|
|
56
65
|
offthreadVideoCacheSizeInBytes: zod_1.z.number().nullable(),
|
|
57
66
|
colorSpace: zod_1.z.enum(client_1.BrowserSafeApis.validColorSpaces).nullable(),
|
|
58
67
|
clientVersion: zod_1.z.string(),
|
|
68
|
+
downloadBehavior,
|
|
59
69
|
}),
|
|
60
70
|
zod_1.z.object({
|
|
61
71
|
type: zod_1.z.literal('still'),
|
|
@@ -77,6 +87,7 @@ exports.CloudRunPayload = zod_1.z.discriminatedUnion('type', [
|
|
|
77
87
|
logLevel,
|
|
78
88
|
offthreadVideoCacheSizeInBytes: zod_1.z.number().nullable(),
|
|
79
89
|
clientVersion: zod_1.z.string(),
|
|
90
|
+
downloadBehavior,
|
|
80
91
|
}),
|
|
81
92
|
]);
|
|
82
93
|
const renderFailResponsePayload = zod_1.z.object({
|
|
@@ -7,6 +7,7 @@ const no_react_1 = require("remotion/no-react");
|
|
|
7
7
|
const version_1 = require("remotion/version");
|
|
8
8
|
const random_hash_1 = require("../shared/random-hash");
|
|
9
9
|
const get_composition_from_body_1 = require("./helpers/get-composition-from-body");
|
|
10
|
+
const get_download_behavior_setting_1 = require("./helpers/get-download-behavior-setting");
|
|
10
11
|
const write_cloudrun_error_1 = require("./helpers/write-cloudrun-error");
|
|
11
12
|
const renderMediaSingleThread = async (body, res) => {
|
|
12
13
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
@@ -38,6 +39,9 @@ const renderMediaSingleThread = async (body, res) => {
|
|
|
38
39
|
gl: (_b = (_a = body.chromiumOptions) === null || _a === void 0 ? void 0 : _a.gl) !== null && _b !== void 0 ? _b : 'swangle',
|
|
39
40
|
enableMultiProcessOnLinux: true,
|
|
40
41
|
};
|
|
42
|
+
const onArtifact = () => {
|
|
43
|
+
throw new Error('Emitting artifacts is not supported in Cloud Run');
|
|
44
|
+
};
|
|
41
45
|
await renderer_1.RenderInternals.internalRenderMedia({
|
|
42
46
|
composition: {
|
|
43
47
|
...composition,
|
|
@@ -100,6 +104,7 @@ const renderMediaSingleThread = async (body, res) => {
|
|
|
100
104
|
onBrowserDownload: () => {
|
|
101
105
|
throw new Error('Should not download a browser in Cloud Run');
|
|
102
106
|
},
|
|
107
|
+
onArtifact,
|
|
103
108
|
});
|
|
104
109
|
const storage = new storage_1.Storage();
|
|
105
110
|
const publicUpload = body.privacy === 'public' || !body.privacy;
|
|
@@ -108,6 +113,7 @@ const renderMediaSingleThread = async (body, res) => {
|
|
|
108
113
|
.upload(tempFilePath, {
|
|
109
114
|
destination: `renders/${renderId}/${(_m = body.outName) !== null && _m !== void 0 ? _m : defaultOutName}`,
|
|
110
115
|
predefinedAcl: publicUpload ? 'publicRead' : 'projectPrivate',
|
|
116
|
+
metadata: (0, get_download_behavior_setting_1.getDownloadBehaviorSetting)(body.downloadBehavior),
|
|
111
117
|
});
|
|
112
118
|
const uploadedFile = uploadedResponse[0];
|
|
113
119
|
const renderMetadata = await uploadedFile.getMetadata();
|
|
@@ -8,6 +8,7 @@ const version_1 = require("remotion/version");
|
|
|
8
8
|
const log_1 = require("../cli/log");
|
|
9
9
|
const random_hash_1 = require("../shared/random-hash");
|
|
10
10
|
const get_composition_from_body_1 = require("./helpers/get-composition-from-body");
|
|
11
|
+
const get_download_behavior_setting_1 = require("./helpers/get-download-behavior-setting");
|
|
11
12
|
const write_cloudrun_error_1 = require("./helpers/write-cloudrun-error");
|
|
12
13
|
const renderStillSingleThread = async (body, res) => {
|
|
13
14
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -68,6 +69,9 @@ const renderStillSingleThread = async (body, res) => {
|
|
|
68
69
|
onBrowserDownload: () => {
|
|
69
70
|
throw new Error('Should not download a browser in Cloud Run');
|
|
70
71
|
},
|
|
72
|
+
onArtifact: () => {
|
|
73
|
+
throw new Error('Emitting artifacts is not supported in Cloud Run');
|
|
74
|
+
},
|
|
71
75
|
});
|
|
72
76
|
log_1.Log.info({ indent: false, logLevel: body.logLevel }, 'Still rendered');
|
|
73
77
|
const storage = new storage_1.Storage();
|
|
@@ -77,6 +81,7 @@ const renderStillSingleThread = async (body, res) => {
|
|
|
77
81
|
.upload(tempFilePath, {
|
|
78
82
|
destination: `renders/${renderId}/${(_f = body.outName) !== null && _f !== void 0 ? _f : 'out.png'}`,
|
|
79
83
|
predefinedAcl: publicUpload ? 'publicRead' : 'projectPrivate',
|
|
84
|
+
metadata: (0, get_download_behavior_setting_1.getDownloadBehaviorSetting)(body.downloadBehavior),
|
|
80
85
|
});
|
|
81
86
|
log_1.Log.info({ indent: false, logLevel: body.logLevel }, 'Still uploaded');
|
|
82
87
|
const uploadedFile = uploadedResponse[0];
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type { GcpRegion } from './pricing/gcp-regions';
|
|
|
16
16
|
/**
|
|
17
17
|
* @deprecated Import this from `@remotion/cloudrun/client` instead
|
|
18
18
|
*/
|
|
19
|
-
declare const renderMediaOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, colorSpace, }: RenderMediaOnCloudrunInput) => Promise<{
|
|
19
|
+
declare const renderMediaOnCloudrun: ({ cloudRunUrl, serviceName, region, serveUrl, composition, inputProps, codec, forceBucketName, privacy, outName, updateRenderProgress, jpegQuality, audioCodec, audioBitrate, videoBitrate, encodingMaxRate, encodingBufferSize, proResProfile, x264Preset, crf, pixelFormat, imageFormat, scale, everyNthFrame, numberOfGifLoops, frameRange, envVariables, chromiumOptions, muted, forceWidth, forceHeight, logLevel, delayRenderTimeoutInMilliseconds, concurrency, enforceAudioTrack, preferLossless, offthreadVideoCacheSizeInBytes, colorSpace, downloadBehavior, }: RenderMediaOnCloudrunInput) => Promise<{
|
|
20
20
|
type: "success";
|
|
21
21
|
privacy: "public-read" | "project-private";
|
|
22
22
|
cloudStorageUri: string;
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/cloudrun",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.176",
|
|
4
4
|
"description": "GCP Cloud Run alternative to lambda rendering",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@google-cloud/artifact-registry": "^
|
|
8
|
-
"@google-cloud/functions-framework": "^3.
|
|
9
|
-
"@google-cloud/run": "^
|
|
7
|
+
"@google-cloud/artifact-registry": "^3.4.0",
|
|
8
|
+
"@google-cloud/functions-framework": "^3.4.0",
|
|
9
|
+
"@google-cloud/run": "^1.3.0",
|
|
10
10
|
"@google-cloud/storage": "^6.9.1",
|
|
11
|
-
"@google-cloud/resource-manager": "^
|
|
12
|
-
"@google-cloud/logging": "^
|
|
11
|
+
"@google-cloud/resource-manager": "^5.3.0",
|
|
12
|
+
"@google-cloud/logging": "^11.1.0",
|
|
13
13
|
"google-auth-library": "^8.7.0",
|
|
14
14
|
"zod": "3.22.3",
|
|
15
|
-
"@remotion/bundler": "4.0.
|
|
16
|
-
"@remotion/cli": "4.0.
|
|
17
|
-
"@remotion/renderer": "4.0.
|
|
18
|
-
"remotion": "4.0.
|
|
15
|
+
"@remotion/bundler": "4.0.176",
|
|
16
|
+
"@remotion/cli": "4.0.176",
|
|
17
|
+
"@remotion/renderer": "4.0.176",
|
|
18
|
+
"remotion": "4.0.176"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@jonny/eslint-config": "3.0.281",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"prettier-plugin-organize-imports": "^3.2.4",
|
|
27
27
|
"ts-node": "10.9.2",
|
|
28
28
|
"vitest": "0.31.1",
|
|
29
|
-
"@remotion/compositor-linux-x64-gnu": "4.0.
|
|
29
|
+
"@remotion/compositor-linux-x64-gnu": "4.0.176"
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
|
32
32
|
"./package.json": "./package.json",
|