getSites()
获取您的 GCP 项目中 Cloud Storage 中的 Remotion 项目数组。
这些项目位于您的 Cloud Storage 存储桶的 sites/
子目录中。请记住 - 您应该每个区域只有一个 Remotion Cloud Run 存储桶,因此您不需要为此函数指定存储桶的名称。
示例
获取所有站点并记录有关它们的信息。
ts
import {getSites } from "@remotion/cloudrun";const {sites ,buckets } = awaitgetSites ("europe-west4");for (constsite ofsites ) {console .log (site .id ); // A unique ID for referring to that projectconsole .log (site .bucketName ); // In which bucket the site resides in.console .log (site .bucketRegion ); // In which region the bucket resides in.console .log (site .serveUrl ); // URL of the deployed site that you can pass to `renderMediaOnCloudRun()`}for (constbucket ofbuckets ) {console .log (bucket .name ); // The name of the Cloud Storage bucket.console .log (bucket .creationDate ); // A unix timestamp of when the site was created.console .log (bucket .region ); // 'europe-west4'}
ts
import {getSites } from "@remotion/cloudrun";const {sites ,buckets } = awaitgetSites ("europe-west4");for (constsite ofsites ) {console .log (site .id ); // A unique ID for referring to that projectconsole .log (site .bucketName ); // In which bucket the site resides in.console .log (site .bucketRegion ); // In which region the bucket resides in.console .log (site .serveUrl ); // URL of the deployed site that you can pass to `renderMediaOnCloudRun()`}for (constbucket ofbuckets ) {console .log (bucket .name ); // The name of the Cloud Storage bucket.console .log (bucket .creationDate ); // A unix timestamp of when the site was created.console .log (bucket .region ); // 'europe-west4'}
参数
一个具有以下属性的对象:
region
您要查询的 GCP 区域。或者,您可以传递 'all regions' 来返回所有区域中的站点。
ts
import {getSites } from "@remotion/cloudrun";const {sites ,buckets } = awaitgetSites ("all regions");
ts
import {getSites } from "@remotion/cloudrun";const {sites ,buckets } = awaitgetSites ("all regions");
返回值
解析为具有以下属性的对象的 Promise:
sites
您可以用于渲染的已部署 Remotion 项目数组。
每个项目包含以下属性:
id
该项目的唯一标识符。
bucketName
项目所在的存储桶。
bucketRegion
存储桶所在的区域。
serveUrl
部署站点的 URL。您可以将其传递给 renderMediaOnCloudRun()
以渲染视频或音频。
buckets
您帐户中所选区域中所有以 remotioncloudrun-
开头的存储桶数组。
info
您应该每个区域只有 1 个存储桶 用于所有 Remotion 项目。
每个项目包含以下属性:
region
存储桶所在的区域。
name
存储桶的名称。Cloud Storage 存储桶具有全局唯一的名称。
creationDate
存储桶首次创建时的 UNIX 时间戳。