Skip to content

🎥 Make videos programmatically with React

Elements: Rename oscilloscope `audioSrc` prop to `src`

Jonny Burgere6b1e00acf3f
diff --git a/packages/docs/elements/audio/oscilloscope/audio-oscilloscope.tsx b/packages/docs/elements/audio/oscilloscope/audio-oscilloscope.tsx
index 114ca43423..d30ff5f826 100644
--- a/packages/docs/elements/audio/oscilloscope/audio-oscilloscope.tsx
+++ b/packages/docs/elements/audio/oscilloscope/audio-oscilloscope.tsx
@@ -15,19 +15,20 @@ import {
type AudioOscilloscopeProps = InteractiveTransformProps & {
readonly amplitude?: number;
- readonly audioSrc?: string;
+ readonly src?: string;
readonly lineColor?: string;
readonly lineWidth?: number;
readonly windowInSeconds?: number;
};
const audioOscilloscopeSchema = {
- audioSrc: {
+ src: {
type: 'asset',
assetType: 'audio',
default:
'https://remotion.media/elements/remotion-made-this-picture-move.mp3',
- description: 'Audio source',
+ description: 'Source',
+ keyframable: false,
},
lineColor: {
type: 'color',
@@ -65,7 +66,7 @@ const audioOscilloscopeSchema = {
const AudioOscilloscopeInner: React.FC<AudioOscilloscopeProps> = ({
amplitude = 2,
- audioSrc = 'https://remotion.media/elements/remotion-made-this-picture-move.mp3',
+ src = 'https://remotion.media/elements/remotion-made-this-picture-move.mp3',
lineColor = '#2563eb',
lineWidth = 6,
style,
@@ -76,7 +77,7 @@ const AudioOscilloscopeInner: React.FC<AudioOscilloscopeProps> = ({
const {audioData, dataOffsetInSeconds} = useWindowedAudioData({
fps,
frame,
- src: audioSrc,
+ src,
windowInSeconds: 10,
});
const waveform = audioData
@@ -109,7 +110,7 @@ const AudioOscilloscopeInner: React.FC<AudioOscilloscopeProps> = ({
...style,
}}
>
- <Audio showInTimeline={false} src={audioSrc} />
+ <Audio showInTimeline={false} src={src} />
<svg height={300} viewBox="0 0 900 300" width={900}>
<line
x1={0}
diff --git a/packages/docs/elements/audio/oscilloscope/initial-props.ts b/packages/docs/elements/audio/oscilloscope/initial-props.ts
index f9fbb1e730..e4a493e853 100644
--- a/packages/docs/elements/audio/oscilloscope/initial-props.ts
+++ b/packages/docs/elements/audio/oscilloscope/initial-props.ts
@@ -9,5 +9,5 @@ export const audioOscilloscopeAudio = {
} as const satisfies ElementAsset;
export const audioOscilloscopeInitialProps = {
- audioSrc: audioOscilloscopeAudio.url,
+ src: audioOscilloscopeAudio.url,
} satisfies ComponentProps<typeof AudioOscilloscope>;
diff --git a/packages/docs/src/components/Elements/element-definitions.ts b/packages/docs/src/components/Elements/element-definitions.ts
index 839bd4244a..d260052c4b 100644
--- a/packages/docs/src/components/Elements/element-definitions.ts
+++ b/packages/docs/src/components/Elements/element-definitions.ts
@@ -135,7 +135,7 @@ const elementImplementations = [
slug: 'audio/oscilloscope',
assets: [audioOscilloscopeAudio],
installationProps: {
- audioSrc: staticFileRef(audioOscilloscopeAudio.path),
+ src: staticFileRef(audioOscilloscopeAudio.path),
} as ElementInitialProps,
component: AudioOscilloscope,
contributors: [{username: 'samohovets', contribution: 'Author'}],
diff --git a/packages/example/src/oscilloscope.element.tsx b/packages/example/src/oscilloscope.element.tsx
index 9fc9398cfa..23a08f85be 100644
--- a/packages/example/src/oscilloscope.element.tsx
+++ b/packages/example/src/oscilloscope.element.tsx
@@ -15,19 +15,20 @@ import {
type AudioOscilloscopeProps = InteractiveTransformProps & {
readonly amplitude?: number;
- readonly audioSrc?: string;
+ readonly src?: string;
readonly lineColor?: string;
readonly lineWidth?: number;
readonly windowInSeconds?: number;
};
const audioOscilloscopeSchema = {
- audioSrc: {
+ src: {
type: 'asset',
assetType: 'audio',
default:
'https://remotion.media/elements/remotion-made-this-picture-move.mp3',
- description: 'Audio source',
+ description: 'Source',
+ keyframable: false,
},
lineColor: {
type: 'color',
@@ -65,7 +66,7 @@ const audioOscilloscopeSchema = {
const AudioOscilloscopeContent: React.FC<AudioOscilloscopeProps> = ({
amplitude = 2,
- audioSrc = 'https://remotion.media/elements/remotion-made-this-picture-move.mp3',
+ src = 'https://remotion.media/elements/remotion-made-this-picture-move.mp3',
lineColor = '#55e6ff',
lineWidth = 6,
style,
@@ -76,7 +77,7 @@ const AudioOscilloscopeContent: React.FC<AudioOscilloscopeProps> = ({
const {audioData, dataOffsetInSeconds} = useWindowedAudioData({
fps,
frame,
- src: audioSrc,
+ src,
windowInSeconds: 10,
});
const waveform = audioData
@@ -109,7 +110,7 @@ const AudioOscilloscopeContent: React.FC<AudioOscilloscopeProps> = ({
...style,
}}
>
- <Audio showInTimeline={false} src={audioSrc} />
+ <Audio showInTimeline={false} src={src} />
<svg height={300} viewBox="0 0 900 300" width={900}>
<line
x1={0}