Skip to content

Commit

Permalink
Revert "Clean up prop destructuring"
Browse files Browse the repository at this point in the history
This reverts commit 9881f40.
  • Loading branch information
gdaunton committed Oct 4, 2024
1 parent 9881f40 commit 800155a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 36 deletions.
58 changes: 23 additions & 35 deletions packages/core/src/video/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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 (
Expand All @@ -80,19 +84,15 @@ const VideoForwardingFunction: React.ForwardRefRenderFunction<
name={name}
>
<Video
{...loopedVideoProps}
{...propsOtherThanLoop}
ref={ref}
_remotionInternalNativeLoopPassed
/>
</Loop>
);
}

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;
Expand All @@ -105,44 +105,32 @@ const VideoForwardingFunction: React.ForwardRefRenderFunction<
durationInFrames={endAtFrameNo}
name={name}
>
<Video {...sequencedVideoProps} ref={ref} />
<Video
pauseWhenBuffering={pauseWhenBuffering ?? false}
{...otherProps}
ref={ref}
/>
</Sequence>
);
}

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
Expand All @@ -154,7 +142,7 @@ const VideoForwardingFunction: React.ForwardRefRenderFunction<
}
_remotionDebugSeeking={_remotionDebugSeeking ?? false}
showInTimeline={showInTimeline ?? true}
crossOrigin={crossOrigin ?? undefined}
onAutoPlayError={onAutoPlayError ?? undefined}
/>
);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/video/VideoForPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down

0 comments on commit 800155a

Please sign in to comment.