🎥 Make videos programmatically with React
rename downloadvideo to downloadmedia
Jonny Burger7e955ce6e8bd
diff --git a/packages/docs/docs/lambda/changelog.md b/packages/docs/docs/lambda/changelog.mdindex 5157f3957a..541fc69a1b 100644--- a/packages/docs/docs/lambda/changelog.md+++ b/packages/docs/docs/lambda/changelog.md@@ -10,6 +10,12 @@ Keep track of changes to the APIs of Remotion Lambda here.[Upgrading](/docs/lambda/upgrading)+## Unreleased++- Visiting a Serve URL in the browser shows a FAQ+- Vast improvements to documentation, CLI documentation complete+- `downloadVideo()` was renamed to `downloadMedia()`+## December 15th, 2021 (2)Version hash: `3.0.0-lambda.236+b35e791d5`diff --git a/packages/docs/docs/lambda/downloadmedia.md b/packages/docs/docs/lambda/downloadmedia.mdnew file mode 100644index 0000000000..480ad84996--- /dev/null+++ b/packages/docs/docs/lambda/downloadmedia.md@@ -0,0 +1,69 @@+---+id: downloadmedia+title: downloadMedia()+slug: /lambda/downloadmedia+---++Downloads a rendered video, audio or still to your local disk.++```ts twoslash+// @module: ESNext+// @target: ESNext+import { downloadMedia } from "@remotion/lambda";++const { outputPath, sizeInBytes } = await downloadMedia({+ bucketName: "remotionlambda-r42fs9fk",+ region: "us-east-1",+ renderId: "8hfxlw",+ outPath: "out.mp4",+ onProgress: ({ totalSize, downloaded, progress }) => {+ console.log(+ `Download progress: ${totalSize}/${downloaded} bytes (${(+ progress * 100+ ).toFixed(0)}%)`+ );+ },+});++console.log(outputPath); // "/Users/yourname/remotion-project/out.mp4"+console.log(sizeInBytes); // 21249541+```++## Arguments++An object with the following properties:++### `region`++The [AWS region](/docs/lambda/region-selection) in which the render has performed.++### `bucketName`++The bucket name in which you the render was stored. This should be the same variable you used for `renderVideoOnLambda()`.++### `renderId`++The ID of the render. You can retrieve this ID by calling [`renderVideoOnLambda()`](/docs/lambda/rendervideoonlambda) or [`renderStillOnLambda()`](/docs/lambda/renderstillonlambda).++### `outPath`++Where the video should be saved. Pass an absolute path, or it will be resolved relative to your current working directory.++## Return value++Returns a promise resolving to an object with the following properties:++### `outputPath`++The absolute path of where the file got saved.++### `sizeInBytes`++The size of the file in bytes.++### `onProgress`++## See also++- [renderVideoOnLambda()](/docs/lambda/rendervideoonlambda)+- [renderStillOnLambda()](/docs/lambda/renderstillonlambda)diff --git a/packages/docs/docs/lambda/downloadvideo.md b/packages/docs/docs/lambda/downloadvideo.mdindex d9e17bef0f..332cc761a6 100644--- a/packages/docs/docs/lambda/downloadvideo.md+++ b/packages/docs/docs/lambda/downloadvideo.md@@ -1,69 +1,10 @@---id: downloadvideotitle: downloadVideo()-slug: /lambda/downloadvideo----Downloads a rendered video to your local disk.+import Redirect from '../../components/Redirect';-```ts twoslash-// @module: ESNext-// @target: ESNext-import { downloadVideo } from "@remotion/lambda";+This page has moved. Redirecting...-const { outputPath, sizeInBytes } = await downloadVideo({- bucketName: "remotionlambda-r42fs9fk",- region: "us-east-1",- renderId: "8hfxlw",- outPath: "out.mp4",- onProgress: ({ totalSize, downloaded, progress }) => {- console.log(- `Download progress: ${totalSize}/${downloaded} bytes (${(- progress * 100- ).toFixed(0)}%)`- );- },-});--console.log(outputPath); // "/Users/yourname/remotion-project/out.mp4"-console.log(sizeInBytes); // 21249541-```--## Arguments--An object with the following properties:--### `region`--The [AWS region](/docs/lambda/region-selection) in which the render has performed.--### `bucketName`--The bucket name in which you the video was stored. This should be the same variable you used for `renderVideoOnLambda()`.--### `renderId`--The ID of the render. You can retrieve this ID by calling [`renderVideoOnLambda()`](/docs/lambda/rendervideoonlambda) or [`renderStillOnLambda()`](/docs/lambda/renderstillonlambda).--### `outPath`--Where the video should be saved. Pass an absolute path, or it will be resolved relative to your current working directory.--## Return value--Returns a promise resolving to an object with the following properties:--### `outputPath`--The absolute path of where the file got saved.--### `sizeInBytes`--The size of the file in bytes.--### `onProgress`--## See also--- [renderVideoOnLambda()](/docs/lambda/rendervideoonlambda)-- [renderStillOnLambda()](/docs/lambda/renderstillonlambda)+<Redirect redirect="/docs/lambda/downloadmedia"/>diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex ecdf89cdb3..524847fd94 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -76,7 +76,7 @@ module.exports = {"lambda/deletesite","lambda/deploysite","lambda/getsites",- "lambda/downloadvideo",+ "lambda/downloadmedia","lambda/getuserpolicy","lambda/getrolepolicy","lambda/getorcreatebucket",diff --git a/packages/lambda/src/api/download-video.ts b/packages/lambda/src/api/download-video.tsindex 897fe3e25d..7e9c073fc8 100644--- a/packages/lambda/src/api/download-video.ts+++ b/packages/lambda/src/api/download-video.ts@@ -10,7 +10,7 @@ import {import {AwsRegion} from '../pricing/aws-regions';import {getAccountId} from '../shared/get-account-id';-type DownloadVideoInput = {+type DownloadMediaInput = {region: AwsRegion;bucketName: string;renderId: string;@@ -18,14 +18,14 @@ type DownloadVideoInput = {onProgress?: LambdaReadFileProgress;};-type DownloadVideoOutput = {+type DownloadMediaOutput = {outputPath: string;sizeInBytes: number;};-export const downloadVideo = async (- input: DownloadVideoInput-): Promise<DownloadVideoOutput> => {+export const downloadMedia = async (+ input: DownloadMediaInput+): Promise<DownloadMediaOutput> => {const expectedBucketOwner = await getAccountId({region: input.region,});@@ -65,3 +65,8 @@ export const downloadVideo = async (sizeInBytes,};};++/**+ * @deprecated Renamed to downloadMedia()+ */+export const downloadVideo = downloadMedia;diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.tsindex d28c1bfb1c..6fefc026ba 100644--- a/packages/lambda/src/cli/commands/render/render.ts+++ b/packages/lambda/src/cli/commands/render/render.ts@@ -1,5 +1,5 @@import {CliInternals} from '@remotion/cli';-import {downloadVideo} from '../../../api/download-video';+import {downloadMedia} from '../../../api/download-video';import {getRenderProgress} from '../../../api/get-render-progress';import {renderVideoOnLambda} from '../../../api/render-video-on-lambda';import {@@ -153,7 +153,7 @@ export const renderCommand = async (args: string[]) => {);if (outName) {const downloadStart = Date.now();- const {outputPath, sizeInBytes} = await downloadVideo({+ const {outputPath, sizeInBytes} = await downloadMedia({bucketName: res.bucketName,outPath: outName,region: getAwsRegion(),diff --git a/packages/lambda/src/cli/commands/still.ts b/packages/lambda/src/cli/commands/still.tsindex 6e33f2a1bb..eea8c34d6c 100644--- a/packages/lambda/src/cli/commands/still.ts+++ b/packages/lambda/src/cli/commands/still.ts@@ -1,6 +1,6 @@import {CliInternals} from '@remotion/cli';import {StillImageFormat} from 'remotion';-import {downloadVideo} from '../..';+import {downloadMedia} from '../..';import {renderStillOnLambda} from '../../api/render-still-on-lambda';import {BINARY_NAME,@@ -92,7 +92,7 @@ export const stillCommand = async (args: string[]) => {if (outName) {Log.info('Finished rendering. Downloading...');- const {outputPath, sizeInBytes} = await downloadVideo({+ const {outputPath, sizeInBytes} = await downloadMedia({bucketName: res.bucketName,outPath: outName,region: getAwsRegion(),diff --git a/packages/lambda/src/index.ts b/packages/lambda/src/index.tsindex a5392e6a18..b2c85497ee 100644--- a/packages/lambda/src/index.ts+++ b/packages/lambda/src/index.ts@@ -10,7 +10,7 @@ import {DeploySiteInput,DeploySiteReturnType,} from './api/deploy-site';-import {downloadVideo} from './api/download-video';+import {downloadMedia, downloadVideo} from './api/download-video';import {getFunctionInfo} from './api/get-function-info';import {getFunctions} from './api/get-functions';import {getOrCreateBucket} from './api/get-or-create-bucket';@@ -23,16 +23,17 @@ import {} from './api/iam-validation/suggested-policy';import {renderStillOnLambda} from './api/render-still-on-lambda';import {renderVideoOnLambda} from './api/render-video-on-lambda';+import {LambdaLSInput, LambdaLsReturnType} from './functions/helpers/io';import {LambdaInternals} from './internals';import {AwsRegion} from './pricing/aws-regions';-import type {RenderProgress} from './shared/constants';import {estimatePrice} from './pricing/calculate-price';-import {LambdaLSInput, LambdaLsReturnType} from './functions/helpers/io';+import type {RenderProgress} from './shared/constants';export {deleteSite,deployFunction,deploySite,+ downloadMedia,downloadVideo,getFunctions,getUserPolicy,