Skip to content

🎥 Make videos programmatically with React

remove maxDuration logic

Jonny Burger01a638708463
diff --git a/packages/core/src/audio/Audio.tsx b/packages/core/src/audio/Audio.tsx
index 6433fdff17..aa61cb0482 100644
--- a/packages/core/src/audio/Audio.tsx
+++ b/packages/core/src/audio/Audio.tsx
@@ -18,7 +18,6 @@ const AudioRefForwardingFunction: React.ForwardRefRenderFunction<
const audioContext = useContext(SharedAudioContext);
const {startFrom, endAt, ...otherProps} = props;
const {loop, ...propsOtherThanLoop} = props;
- const {maxDuration, ...propsOtherThanMaxDuration} = props;
const {fps} = useVideoConfig();
const [durations, setDurations] = useReducer(durationReducer, {});
@@ -42,7 +41,6 @@ const AudioRefForwardingFunction: React.ForwardRefRenderFunction<
const startFromFrameNo = startFrom ?? 0;
const endAtFrameNo = endAt ?? Infinity;
- const audioDuration = endAtFrameNo - startFromFrameNo;
return (
<Sequence
layout="none"
@@ -50,16 +48,13 @@ const AudioRefForwardingFunction: React.ForwardRefRenderFunction<
showInTimeline={false}
durationInFrames={endAtFrameNo}
>
- <Audio {...otherProps} ref={ref} maxDuration={audioDuration} />
+ <Audio {...otherProps} ref={ref} />
</Sequence>
);
}
if (loop && props.src && durations[props.src as string] !== undefined) {
- const duration = Math.min(
- Math.floor(durations[props.src as string] * fps),
- maxDuration ?? Infinity
- );
+ const duration = Math.floor(durations[props.src as string] * fps);
return (
<Loop durationInFrames={duration}>
<Audio {...propsOtherThanLoop} ref={ref} />
@@ -73,7 +68,7 @@ const AudioRefForwardingFunction: React.ForwardRefRenderFunction<
return (
<AudioForRendering
onDuration={onDuration}
- {...propsOtherThanMaxDuration}
+ {...props}
ref={ref}
onError={onError}
/>
@@ -85,7 +80,7 @@ const AudioRefForwardingFunction: React.ForwardRefRenderFunction<
shouldPreMountAudioTags={
audioContext !== null && audioContext.numberOfAudioTags > 0
}
- {...propsOtherThanMaxDuration}
+ {...props}
ref={ref}
onError={onError}
onDuration={onDuration}
diff --git a/packages/core/src/audio/props.ts b/packages/core/src/audio/props.ts
index 9da710c87b..6f0b4a7225 100644
--- a/packages/core/src/audio/props.ts
+++ b/packages/core/src/audio/props.ts
@@ -3,7 +3,6 @@ import type {VolumeProp} from '../volume-prop';
export type RemotionMainAudioProps = {
startFrom?: number;
endAt?: number;
- maxDuration?: number;
};
export type RemotionAudioProps = Omit<