Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Add Match current time duration preset

JonnyBurgere26adcb49fbd
diff --git a/packages/studio/src/components/InspectorPanel/CompositionMetadata.tsx b/packages/studio/src/components/InspectorPanel/CompositionMetadata.tsx
index 875475fb9a..44969fb6a6 100644
--- a/packages/studio/src/components/InspectorPanel/CompositionMetadata.tsx
+++ b/packages/studio/src/components/InspectorPanel/CompositionMetadata.tsx
@@ -22,6 +22,7 @@ import {
} from '../NewComposition/InputDragger';
import {showNotification} from '../Notifications/NotificationCenter';
import {updateCompositionMetadata} from '../RenderQueue/actions';
+import {getCurrentFrame} from '../Timeline/imperative-state';
import {timelineDurationRef} from '../Timeline/timeline-refs';
import {TimelineTickFormatContext} from '../Timeline/TimelineTickFormatProvider';
import {useResolvedStack} from '../Timeline/use-resolved-stack';
@@ -631,6 +632,7 @@ export const CompositionMetadata: React.FC<{
timelineDurationRef.current?.getDuration(
video.durationInFrames,
) ?? null;
+ const currentFrame = getCurrentFrame();
return [
{
@@ -652,6 +654,20 @@ export const CompositionMetadata: React.FC<{
subMenu: null,
quickSwitcherLabel: null,
},
+ {
+ type: 'item',
+ id: 'match-current-time',
+ label: `Match current time (${showFrames ? `${currentFrame} ${currentFrame === 1 ? 'frame' : 'frames'}` : renderFrame(currentFrame, video.fps)})`,
+ value: 'match-current-time',
+ disabled: currentFrame < 1,
+ onClick: () => {
+ saveMetadata({durationInFrames: currentFrame});
+ },
+ keyHint: null,
+ leftItem: null,
+ subMenu: null,
+ quickSwitcherLabel: null,
+ },
];
}}
/>