🎥 Make videos programmatically with React
volume
Jonny Burgered30c404519f
diff --git a/packages/docs/docs/audio.mdx b/packages/docs/docs/audio.mdxindex 7935f388f5..2635c42a91 100644--- a/packages/docs/docs/audio.mdx+++ b/packages/docs/docs/audio.mdx@@ -27,7 +27,7 @@ export const MyVideo = () => {### `volume?`-The component also accepts a `volume` props which allows you to control the volume of the audio in it's entirety or frame by frame. Read the page on [using audio](/docs/using-audio) to learn more.+Allows you to control the volume of the audio in it's entirety or frame by frame. Read the page on [using audio](/docs/using-audio) to learn more.```tsx twoslash title="Setting a static volume"import {AbsoluteFill, Audio, staticFile} from 'remotion';diff --git a/packages/docs/docs/media/audio.mdx b/packages/docs/docs/media/audio.mdxindex 3122c81f7e..f62b68919e 100644--- a/packages/docs/docs/media/audio.mdx+++ b/packages/docs/docs/media/audio.mdx@@ -4,6 +4,11 @@ title: '<Audio>'crumb: 'API - @remotion/media'---+:::note+This is documentation for the upcoming new `<Audio>` tag.+Not to be confused with the older [`<Audio>`](/docs/audio) tag from `remotion`.+:::+:::warning**Very experimental**: This component is in a very early stage and does not support some basic features such as volume or playback rate.The current focus is on correctness, not on performance.@@ -82,7 +87,34 @@ Removes a portion of the audio at the end (right side). See [`trimBefore`](#trim### `volume?`-**Currently not supported!**+Allows you to control the volume of the audio in it's entirety or frame by frame.+Read the page on [using audio](/docs/using-audio) to learn more.++```tsx twoslash title="Setting a static volume"+import {AbsoluteFill, staticFile} from 'remotion';+import {experimental_Audio as Audio} from '@remotion/media';++export const MyVideo = () => {+ return (+ <AbsoluteFill>+ <Audio volume={0.5} src={staticFile('background.mp3')} />+ </AbsoluteFill>+ );+};+```++```tsx twoslash title="Changing the volume over time"+import {AbsoluteFill, interpolate, staticFile} from 'remotion';+import {experimental_Audio as Audio} from '@remotion/media';++export const MyVideo = () => {+ return (+ <AbsoluteFill>+ <Audio volume={(f) => interpolate(f, [0, 30], [0, 1], {extrapolateLeft: 'clamp'})} src={staticFile('voice.mp3')} />+ </AbsoluteFill>+ );+};+```### `loopVolumeCurveBehavior?`diff --git a/packages/docs/docs/media/video.mdx b/packages/docs/docs/media/video.mdxindex 0309ba3541..c8ff8c405b 100644--- a/packages/docs/docs/media/video.mdx+++ b/packages/docs/docs/media/video.mdx@@ -4,6 +4,11 @@ title: '<Video>'crumb: 'API - @remotion/media'---+:::note+This is documentation for the upcoming new `<Video>` tag.+Not to be confused with the older [`<Video>`](/docs/video) tag from `remotion`.+:::+:::warning**Very experimental**: This component is in a very early stage and does not support some basic features such as volume or playback rate or CSS styling.The current focus is on correctness, not on performance.@@ -82,7 +87,36 @@ Removes a portion of the video at the end (right side). See [`trimBefore`](#trim### `volume?`-**Currently not supported!**+### `volume?`++Allows you to control the volume of the audio in it's entirety or frame by frame.+Read the page on [using audio](/docs/using-audio) to learn more.++```tsx twoslash title="Setting a static volume"+import {AbsoluteFill, staticFile} from 'remotion';+import {experimental_Video as Video} from '@remotion/media';++export const MyVideo = () => {+ return (+ <AbsoluteFill>+ <Video volume={0.5} src={staticFile('video.webm')} />+ </AbsoluteFill>+ );+};+```++```tsx twoslash title="Changing the volume over time"+import {AbsoluteFill, interpolate, staticFile} from 'remotion';+import {experimental_Video as Video} from '@remotion/media';++export const MyVideo = () => {+ return (+ <AbsoluteFill>+ <Video volume={(f) => interpolate(f, [0, 30], [0, 1], {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'})} src={'https://parser.media/video.mp4'} />+ </AbsoluteFill>+ );+};+```### `loopVolumeCurveBehavior?`diff --git a/packages/docs/docs/offthreadvideo.mdx b/packages/docs/docs/offthreadvideo.mdxindex 43f7f1a329..c5e84fcc73 100644--- a/packages/docs/docs/offthreadvideo.mdx+++ b/packages/docs/docs/offthreadvideo.mdx@@ -117,7 +117,7 @@ import {AbsoluteFill, interpolate, staticFile, OffthreadVideo} from 'remotion';export const MyComposition = () => {return (<AbsoluteFill>- <OffthreadVideo volume={(f) => interpolate(f, [0, 100], [0, 1], {extrapolateLeft: 'clamp'})} src={staticFile('video.webm')} />+ <OffthreadVideo volume={(f) => interpolate(f, [0, 100], [0, 1], {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'})} src={staticFile('video.webm')} /></AbsoluteFill>);};diff --git a/packages/docs/docs/video.mdx b/packages/docs/docs/video.mdxindex b7d9f5fe06..1d2c949ad0 100644--- a/packages/docs/docs/video.mdx+++ b/packages/docs/docs/video.mdx@@ -132,7 +132,7 @@ import {AbsoluteFill, interpolate, staticFile, Video} from 'remotion';export const MyComposition = () => {return (<AbsoluteFill>- <Video volume={(f) => interpolate(f, [0, 100], [0, 1], {extrapolateLeft: 'clamp'})} src={staticFile('video.webm')} />+ <Video volume={(f) => interpolate(f, [0, 100], [0, 1], {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'})} src={staticFile('video.webm')} /></AbsoluteFill>);};