🎥 Make videos programmatically with React
make optional props more obvious
Jonny Burgercf7390b16022
diff --git a/packages/docs/docs/offthreadvideo.mdx b/packages/docs/docs/offthreadvideo.mdxindex 765a5ee2cd..e926a40b95 100644--- a/packages/docs/docs/offthreadvideo.mdx+++ b/packages/docs/docs/offthreadvideo.mdx@@ -41,7 +41,11 @@ export const MyComposition = () => {## Props-### `startFrom`+### `src`++The URL of the video to be rendered. Can be a remote URL or a local file referenced with [`staticFile()`](/docs/staticfile).++### `startFrom?`Will remove a portion of the video at the beginning.@@ -69,18 +73,17 @@ export const MyComposition = () => {};```-### `endAt`+### `endAt?`Removes a portion of the video at the end. See [`startAt`](/docs/video#startfrom) for an explanation.-### `transparent`<AvailableFrom v="4.0.0" />+### `transparent?`<AvailableFrom v="4.0.0" />-_optional, boolean_If set to `true`, frames will be extracted as PNG, enabling transparency but also slowing down your render.If set to `false` (_default_), frames will be extracted as bitmap (BMP), which is faster.-### `volume`+### `volume?`Allows you to control the volume for the whole track or change it on a per-frame basis. Refer to the [using audio](/docs/using-audio#controlling-volume) guide to learn how to use it.@@ -125,13 +128,13 @@ On iOS Safari, it's not possible to granularly change the volume of a media tag.Only values `0` and `1` will be respected by the browser.:::-### `loopVolumeCurveBehavior`<AvailableFrom v="4.0.142" />+### `loopVolumeCurveBehavior?`<AvailableFrom v="4.0.142" />Controls the `frame` which is returned when using the [`volume`](#volume) callback function and wrapping `OffthreadVideo` in a [`<Loop>`](/docs/loop).Can be either `"repeat"` (default, start from 0 on each iteration) or `"extend"` (keep increasing frames).-### `style`+### `style?`You can pass any style you can pass to a native HTML element. Keep in mind that during rendering, `<OffthreadVideo>` renders an [`<Img>`](/docs/img) tag, but a `<video>` tag is used during preview.@@ -151,18 +154,16 @@ export const MyComposition = () => {};```-### `allowAmplificationDuringRender`<AvailableFrom v="3.3.17" />+### `allowAmplificationDuringRender?`<AvailableFrom v="3.3.17" />Make values for [`volume`](/docs/video#volume) greater than `1` result in amplification during renders.During Preview, the volume will be limited to `1`, since the browser cannot amplify audio.-### `name`<AvailableFrom v="4.0.71"/>--_optional_+### `name?`<AvailableFrom v="4.0.71"/>A name and that will be shown as the label of the sequence in the timeline of the Remotion Studio. This property is purely for helping you keep track of items in the timeline.-### `toneFrequency`<AvailableFrom v="4.0.47"/>+### `toneFrequency?`<AvailableFrom v="4.0.47"/>Adjust the pitch of the audio - will only be applied during rendering.@@ -170,11 +171,11 @@ Accepts a number between `0.01` and `2`, where `1` represents the original pitchA `toneFrequency` of 0.5 would lower the pitch by half, and a `toneFrequency` of `1.5` would increase the pitch by 50%.-### `onError`+### `onError?`Handle an error playing the video. From v3.3.89, if you pass an `onError` callback, then no exception will be thrown. Previously, the error could not be caught.-### `playbackRate`<AvailableFrom v="2.2.0" />+### `playbackRate?`<AvailableFrom v="2.2.0" />Controls the speed of the video. `1` is the default and means regular speed, `0.5` slows down the video so it's twice as long and `2` speeds up the video so it's twice as fast.@@ -193,7 +194,7 @@ export const MyComposition = () => {};```-### `muted`+### `muted?`You can drop the audio of the video by adding a `muted` prop:@@ -212,16 +213,16 @@ export const MyComposition = () => {};```-### `acceptableTimeShiftInSeconds`<AvailableFrom v="3.2.42" />+### `acceptableTimeShiftInSeconds?`<AvailableFrom v="3.2.42" />In the [Studio](/docs/terminology/studio) or in the [Remotion Player](/docs/player), Remotion will seek the video if it gets too much out of sync with Remotion's internal time - be it due to the video loading or the page being too slow to keep up in real-time. By default, a seek is triggered if `0.45` seconds of time shift is encountered. Using this prop, you can customize the threshold.-### `allowAmplificationDuringRender`<AvailableFrom v="3.3.17" />+### `allowAmplificationDuringRender?`<AvailableFrom v="3.3.17" />Make values for [`volume`](#volume) greater than `1` result in amplification during renders.During Preview, the volume will be limited to `1`, since the browser cannot amplify audio.-### `toneFrequency`<AvailableFrom v="4.0.47"/>+### `toneFrequency?`<AvailableFrom v="4.0.47"/>Adjust the pitch of the audio - will only be applied during rendering.@@ -229,11 +230,11 @@ Accepts a number between `0.01` and `2`, where `1` represents the original pitchA `toneFrequency` of 0.5 would lower the pitch by half, and a `toneFrequency` of `1.5` would increase the pitch by 50%.-### `pauseWhenBuffering`<AvailableFrom v="4.0.111"/>+### `pauseWhenBuffering?`<AvailableFrom v="4.0.111"/>If set to `true` and the video is loading, the Player will enter into the [native buffering state](/docs/player/buffer-state). The default is `false`, but will become `true` in Remotion 5.0.-### `toneMapped`<AvailableFrom v="4.0.117" />+### `toneMapped?`<AvailableFrom v="4.0.117" />Since Remotion 4.0.117, Remotion will adjust the colors of videos in different color spaces (such as HDR) when converting to RGB, to counteract color shifts.Since the browser is painting in sRGB, this is necessary to ensure that the colors are displayed correctly.@@ -242,32 +243,38 @@ Disabling tone mapping will speed up rendering, but may result in less vibrant cPrior to Remotion 4.0.117, tone mapping was always disabled, and the `toneMapped` prop was not available.-### `showInTimeline`<AvailableFrom v="4.0.122"/>+### `showInTimeline?`<AvailableFrom v="4.0.122"/>If set to `false`, no layer will be shown in the timeline of the Remotion Studio. The default is `true`.-### `delayRenderTimeoutInMilliseconds`<AvailableFrom v="4.0.150" />+### `delayRenderTimeoutInMilliseconds?`<AvailableFrom v="4.0.150" />Customize the [timeout](/docs/delay-render#modifying-the-timeout) of the [`delayRender()`](/docs/delay-render) call that this component makes.-### `delayRenderRetries`<AvailableFrom v="4.0.178" />+### `delayRenderRetries?`<AvailableFrom v="4.0.178" />Customize the [number of retries](/docs/delay-render#retrying) of the [`delayRender()`](/docs/delay-render) call that this component makes.-### `onAutoPlayError`<AvailableFrom v="4.0.187" />+### `onAutoPlayError?`<AvailableFrom v="4.0.187" />A callback function that gets called when the video fails to play due to autoplay restrictions.If you don't pass a callback, the video will be muted and be retried once.This prop is useful if you want to handle the error yourself, e.g. for pausing the Player.Read more here about [autoplay restrictions](/docs/player/autoplay).-### `onVideoFrame`<AvailableFrom v="4.0.190" />+### `onVideoFrame?`<AvailableFrom v="4.0.190" />A callback function that gets called when a frame is extracted from the video.Useful for [video manipulation](/docs/video-manipulation).The callback is called with a [`CanvasImageSource`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasImageSource) object.During preview, this is a `HTMLVideoElement` object, during rendering, it is an `HTMLImageElement`.+### `crossOrigin?`<AvailableFrom v="4.0.190" />++Corresponds to the [`crossOrigin`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attr-crossorigin) attribute of the `<video>` element.+One of `"anonymous"`, `"use-credentials"` or `undefined`.+Default: `"anonymous"` if `onVideoFrame` is specified, `undefined`, otherwise.+### ~~`imageFormat` <AvailableFrom v="3.0.22" />~~_removed in v4.0.0_diff --git a/packages/docs/docs/video.mdx b/packages/docs/docs/video.mdxindex 16edc294a4..dd10f3fe94 100644--- a/packages/docs/docs/video.mdx+++ b/packages/docs/docs/video.mdx@@ -45,7 +45,11 @@ export const MyComposition = () => {## Props-### `startFrom`+### `src`++The URL of the video to be rendered. Can be a remote URL or a local file referenced with [`staticFile()`](/docs/staticfile).++### `startFrom?`Will remove a portion of the video at the beginning.@@ -69,11 +73,11 @@ export const MyComposition = () => {};```-### `endAt`+### `endAt?`Removes a portion of the video at the end. See [`startFrom`](/docs/video#startfrom) for an explanation.-### `style`+### `style?`You can pass any style you can pass to a native `<video>` element. For example, set its size:@@ -93,7 +97,7 @@ export const MyComposition = () => {};```-### `volume`+### `volume?`Allows you to control the volume for the whole track or change it on a per-frame basis. Refer to the [using audio](/docs/using-audio#controlling-volume) guide to learn how to use it.@@ -133,19 +137,17 @@ On iOS Safari, it's not possible to granularly change the volume of a media tag.Only values `0` and `1` will be respected by the browser.:::-### `loopVolumeCurveBehavior`<AvailableFrom v="4.0.142" />+### `loopVolumeCurveBehavior?`<AvailableFrom v="4.0.142" />Controls the `frame` which is returned when using the [`volume`](#volume) callback function and adding the [`loop`](#loop) attribute.Can be either `"repeat"` (default, start from 0 on each iteration) or `"extend"` (keep increasing frames).-### `name`<AvailableFrom v="4.0.71"/>--_optional_+### `name?`<AvailableFrom v="4.0.71"/>A name and that will be shown as the label of the sequence in the timeline of the Remotion Studio. This property is purely for helping you keep track of items in the timeline.-### `playbackRate`<AvailableFrom v="2.2.0" />+### `playbackRate?`<AvailableFrom v="2.2.0" />Controls the speed of the video. `1` is the default and means regular speed, `0.5` slows down the video so it's twice as long and `2` speeds up the video so it's twice as fast.@@ -164,7 +166,7 @@ export const MyComposition = () => {};```-### `muted`+### `muted?`You can drop the audio of the video by adding a `muted` prop:@@ -185,7 +187,7 @@ export const MyComposition = () => {This has the benefit that Remotion will not have to download the video file during rendering in order to extract the audio from it.-### `loop`<AvailableFrom v="3.2.29" />+### `loop?`<AvailableFrom v="3.2.29" />Makes the video loop indefinitely.@@ -204,16 +206,16 @@ export const MyComposition = () => {};```-### `acceptableTimeShiftInSeconds`<AvailableFrom v="3.2.42" />+### `acceptableTimeShiftInSeconds?`<AvailableFrom v="3.2.42" />In the [Studio](/docs/terminology/studio) or in the [Remotion Player](/docs/player), Remotion will seek the video if it gets too much out of sync with Remotion's internal time - be it due to the video loading or the page being too slow to keep up in real-time. By default, a seek is triggered if `0.45` seconds of time shift is encountered. Using this prop, you can customize the threshold.-### `allowAmplificationDuringRender`<AvailableFrom v="3.3.17" />+### `allowAmplificationDuringRender?`<AvailableFrom v="3.3.17" />Make values for [`volume`](#volume) greater than `1` result in amplification during renders.During Preview, the volume will be limited to `1`, since the browser cannot amplify audio.-### `toneFrequency`<AvailableFrom v="4.0.47"/>+### `toneFrequency?`<AvailableFrom v="4.0.47"/>Adjust the pitch of the audio - will only be applied during rendering.@@ -221,40 +223,46 @@ Accepts a number between `0.01` and `2`, where `1` represents the original pitchA `toneFrequency` of 0.5 would lower the pitch by half, and a `toneFrequency` of `1.5` would increase the pitch by 50%.-### `onError`+### `onError?`Handle an error playing the video. From v3.3.89, if you pass an `onError` callback, then no exception will be thrown. Previously, the error could not be caught.-### `pauseWhenBuffering`<AvailableFrom v="4.0.100"/>+### `pauseWhenBuffering?`<AvailableFrom v="4.0.100"/>If set to `true` and the video is loading, the Player will enter into the [native buffering state](/docs/player/buffer-state). The default is `false`, but will become `true` in Remotion 5.0.-### `showInTimeline`<AvailableFrom v="4.0.122"/>+### `showInTimeline?`<AvailableFrom v="4.0.122"/>If set to `false`, no layer will be shown in the timeline of the Remotion Studio. The default is `true`.-### `delayRenderTimeoutInMilliseconds`<AvailableFrom v="4.0.140" />+### `delayRenderTimeoutInMilliseconds?`<AvailableFrom v="4.0.140" />Customize the [timeout](/docs/delay-render#modifying-the-timeout) of the [`delayRender()`](/docs/delay-render) call that this component makes.-### `delayRenderRetries`<AvailableFrom v="4.0.140" />+### `delayRenderRetries?`<AvailableFrom v="4.0.140" />Customize the [number of retries](/docs/delay-render#retrying) of the [`delayRender()`](/docs/delay-render) call that this component makes.-### `onAutoPlayError`<AvailableFrom v="4.0.187" />+### `onAutoPlayError?`<AvailableFrom v="4.0.187" />A callback function that gets called when the video fails to play due to autoplay restrictions.If you don't pass a callback, the video will be muted and be retried once.This prop is useful if you want to handle the error yourself, e.g. for pausing the Player.Read more here about [autoplay restrictions](/docs/player/autoplay).-### `onVideoFrame`<AvailableFrom v="4.0.190" />+### `onVideoFrame?`<AvailableFrom v="4.0.190" />A callback function that gets called when a frame is extracted from the video.Useful for [video manipulation](/docs/video-manipulation).The callback is called with a [`CanvasImageSource`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasImageSource) object.When you use the `<Video>` tag, it is always a `HTMLVideoElement` object.+### `crossOrigin?`<AvailableFrom v="4.0.190" />++Corresponds to the [`crossOrigin`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attr-crossorigin) attribute of the `<video>` element.+One of `"anonymous"`, `"use-credentials"` or `undefined`.+Default: `"anonymous"` if `onVideoFrame` is specified, `undefined`, otherwise.+## Speed up renders for video with silent audio