Skip to main content

getCompositionsOnLambda()

v3.3.2

获取 Lambda 函数内部的组合。

🌐 Gets the compositions inside a Lambda function.

请注意,你也可以使用 getCompositions() 获取托管在 Lambda 上的网站的组成。同样,你也可以使用 getCompositionsOnLambda() 从未托管在 AWS Lambda 上的服务 URL 获取组成。

🌐 Note that you can also get the compositions of a site that is hosted on Lambda using getCompositions(). Vice versa, you can also get the compositions from a serve URL that is not hosted on AWS Lambda using getCompositionsOnLambda().

如果机器无法运行 Chrome,你应该使用 getCompositionsOnLambda(),而不是 getCompositions()

🌐 You should use getCompositionsOnLambda() if you cannot use getCompositions() because the machine cannot run Chrome.

示例

🌐 Example

import {getCompositionsOnLambda} from '@remotion/lambda/client';

const compositions = await getCompositionsOnLambda({
  region: 'us-east-1',
  functionName: 'remotion-render-bds9aab',
  serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
  inputProps: {},
});

console.log(compositions); // See below for an example value
note

最好从 @remotion/lambda/client 导入这个函数,以避免 在无服务器函数中 出现问题。

参数

🌐 Arguments

一个具有以下属性的对象:

🌐 An object with the following properties:

functionName

已部署的 Lambda 函数的名称,应使用该函数获取组合列表。使用 deployFunction() 创建一个新函数,使用 getFunctions() 获取当前已部署的 Lambda 函数。

🌐 The name of the deployed Lambda function that should be used to ge the list of compositions. Use deployFunction() to create a new function and getFunctions() to obtain currently deployed Lambdas.

region

你的 Lambda 函数部署在哪个区域。

🌐 In which region your Lambda function is deployed.

serveUrl

指向 Remotion 项目的 URL。使用 deploySite() 来部署 Remotion 项目。

🌐 A URL pointing to a Remotion project. Use deploySite() to deploy a Remotion project.

inputProps

传递给所选视频组合的输入属性。
必须是一个 JSON 对象。
可以从根组件使用 getInputProps() 读取属性。
你可以使用 calculateMetadata() 转换输入属性。

envVariables?

renderMedia() -> envVariables。默认值:{}

🌐 See renderMedia() -> envVariables. Default: {}.

timeoutInMilliseconds?

一个数字,描述函数在超时之前评估组合列表可能需要的毫秒数。超时。默认值:30000

🌐 A number describing how long the function may take in milliseconds to evaluate the list of compositions before it times out. Default: 30000

chromiumOptions?

允许你设置某些 Chromium / Google Chrome 标志。见:Chromium 标志

🌐 Allows you to set certain Chromium / Google Chrome flags. See: Chromium flags.

disableWebSecurity

boolean - 默认 false

🌐 boolean - default false

这将尤其会禁用 CORS 以及其他安全功能。

🌐 This will most notably disable CORS among other security features.

ignoreCertificateErrors

boolean - 默认 false

🌐 boolean - default false

导致无效的 SSL 证书(例如自签名证书)被忽略。

🌐 Results in invalid SSL certificates, such as self-signed ones, being ignored.

gl

Changelog
  • From Remotion v2.6.7 until v3.0.7, the default for Remotion Lambda was swiftshader, but from v3.0.8 the default is swangle (Swiftshader on Angle) since Chrome 101 added support for it.
  • From Remotion v2.4.3 until v2.6.6, the default was angle, however it turns out to have a small memory leak that could crash long Remotion renders.

Select the OpenGL renderer backend for Chromium.
Accepted values:

  • "angle"
  • "egl"
  • "swiftshader"
  • "swangle"
  • "vulkan" (from Remotion v4.0.41)
  • "angle-egl" (from Remotion v4.0.51)

The default is null, letting Chrome decide, except on Lambda where the default is "swangle"

userAgentv3.3.83

允许你设置 headless Chrome 浏览器使用的自定义用户代理。

🌐 Lets you set a custom user agent that the headless Chrome browser assumes.

darkMode?v4.0.381

Whether Chromium should pretend to be in dark mode by emulating the media feature 'prefers-color-scheme: dark'. Default is false.

forceBucketName?v3.3.42

指定要使用的特定存储桶名称。这不推荐,最好让 Remotion 自动发现正确的存储桶。

🌐 Specify a specific bucket name to be used. This is not recommended, instead let Remotion discover the right bucket automatically.

logLevel?

One of trace, verbose, info, warn, error.
Determines how much info is being logged to the console.

Default info.

可以通过此函数返回的 CloudWatch URL 查看日志。

🌐 Logs can be read through the CloudWatch URL that this function returns.

mediaCacheSizeInBytes?v4.0.352

Specify the maximum size of the cache that <Video> and <Audio> from @remotion/media may use combined, in bytes.
The default is half of the available system memory when the render starts.

offthreadVideoCacheSizeInBytes?v4.0.23

From v4.0, Remotion has a cache for <OffthreadVideo> frames. The default is null, corresponding to half of the system memory available when the render starts.
This option allows to override the size of the cache. The higher it is, the faster the render will be, but the more memory will be used.
The used value will be printed when running in verbose mode.
Default: null

offthreadVideoThreads?v4.0.261

The number of threads that<OffthreadVideo> can start to extract frames. The default is 2. Increase carefully, as too many threads may cause instability.

dumpBrowserLogs?

在 v4.0 中被弃用,取而代之的是 logLevel

🌐 Deprecated in v4.0 in favor of logLevel.

返回值

🌐 Return value

返回一个解析为可用组合数组的承诺。示例值:

🌐 Returns a promise that resolves to an array of available compositions. Example value:

[
  {
    id: 'HelloWorld',
    width: 1920,
    height: 1080,
    fps: 30,
    durationInFrames: 120,
    defaultProps: {
      title: 'Hello World',
    },
  },
  {
    id: 'Title',
    width: 1080,
    height: 1080,
    fps: 30,
    durationInFrames: 90,
    defaultProps: undefined,
  },
];