Skip to content

🎥 Make videos programmatically with React

Revert "Clean up prop destructuring"

gdaunton800155a49fed
diff --git a/packages/core/src/video/Video.tsx b/packages/core/src/video/Video.tsx
index 618b529da8..e7aa0a62f3 100644
--- a/packages/core/src/video/Video.tsx
+++ b/packages/core/src/video/Video.tsx
@@ -25,6 +25,18 @@ const VideoForwardingFunction: React.ForwardRefRenderFunction<
readonly stack?: string;
}
> = (props, ref) => {
+ const {
+ startFrom,
+ endAt,
+ name,
+ pauseWhenBuffering,
+ stack,
+ _remotionInternalNativeLoopPassed,
+ showInTimeline,
+ onAutoPlayError,
+ ...otherProps
+ } = props;
+ const {loop, _remotionDebugSeeking, ...propsOtherThanLoop} = props;
const {fps} = useVideoConfig();
const environment = getRemotionEnvironment();
@@ -57,15 +69,7 @@ const VideoForwardingFunction: React.ForwardRefRenderFunction<
durations[getAbsoluteSrc(preloadedSrc)] ??
durations[getAbsoluteSrc(props.src)];
- if (props.loop && durationFetched !== undefined) {
- const {
- startFrom,
- endAt,
- name,
- loop: __omitLoop,
- _remotionDebugSeeking: __omitRemotionDebugSeeking,
- ...loopedVideoProps
- } = props;
+ if (loop && durationFetched !== undefined) {
const mediaDuration = durationFetched * fps;
return (
@@ -80,7 +84,7 @@ const VideoForwardingFunction: React.ForwardRefRenderFunction<
name={name}
>
<Video
- {...loopedVideoProps}
+ {...propsOtherThanLoop}
ref={ref}
_remotionInternalNativeLoopPassed
/>
@@ -88,11 +92,7 @@ const VideoForwardingFunction: React.ForwardRefRenderFunction<
);
}
- if (
- typeof props.startFrom !== 'undefined' ||
- typeof props.endAt !== 'undefined'
- ) {
- const {startFrom, endAt, name, ...sequencedVideoProps} = props;
+ if (typeof startFrom !== 'undefined' || typeof endAt !== 'undefined') {
validateStartFromProps(startFrom, endAt);
const startFromFrameNo = startFrom ?? 0;
@@ -105,7 +105,11 @@ const VideoForwardingFunction: React.ForwardRefRenderFunction<
durationInFrames={endAtFrameNo}
name={name}
>
- <Video {...sequencedVideoProps} ref={ref} />
+ <Video
+ pauseWhenBuffering={pauseWhenBuffering ?? false}
+ {...otherProps}
+ ref={ref}
+ />
</Sequence>
);
}
@@ -113,36 +117,20 @@ const VideoForwardingFunction: React.ForwardRefRenderFunction<
validateMediaProps(props, 'Video');
if (environment.isRendering) {
- const {
- startFrom: __omitStartFrom,
- endAt: __omitEndAt,
- pauseWhenBuffering: __omitPauseWhenBuffering,
- ...renderedVideoProps
- } = props;
return (
<VideoForRendering
onDuration={onDuration}
onVideoFrame={onVideoFrame ?? null}
- {...renderedVideoProps}
+ {...otherProps}
ref={ref}
/>
);
}
- const {
- crossOrigin,
- pauseWhenBuffering,
- showInTimeline,
- stack,
- _remotionInternalNativeLoopPassed,
- _remotionDebugSeeking,
- ...videoForPreviewProps
- } = props;
-
return (
<VideoForPreview
onlyWarnForMediaSeekingError={false}
- {...videoForPreviewProps}
+ {...otherProps}
ref={ref}
onVideoFrame={null}
// Proposal: Make this default to true in v5
@@ -154,7 +142,7 @@ const VideoForwardingFunction: React.ForwardRefRenderFunction<
}
_remotionDebugSeeking={_remotionDebugSeeking ?? false}
showInTimeline={showInTimeline ?? true}
- crossOrigin={crossOrigin ?? undefined}
+ onAutoPlayError={onAutoPlayError ?? undefined}
/>
);
};
diff --git a/packages/core/src/video/VideoForPreview.tsx b/packages/core/src/video/VideoForPreview.tsx
index 181c094b89..b372b5c948 100644
--- a/packages/core/src/video/VideoForPreview.tsx
+++ b/packages/core/src/video/VideoForPreview.tsx
@@ -36,7 +36,7 @@ type VideoForPreviewProps = RemotionVideoProps & {
readonly _remotionDebugSeeking: boolean;
readonly showInTimeline: boolean;
readonly onVideoFrame: null | OnVideoFrame;
- readonly crossOrigin: '' | 'anonymous' | 'use-credentials' | undefined;
+ readonly crossOrigin?: '' | 'anonymous' | 'use-credentials';
};
const VideoForDevelopmentRefForwardingFunction: React.ForwardRefRenderFunction<