Replace static FFmpeg post-processing with Remotion-powered browser rendering: - Animated word-by-word subtitles (pop, karaoke, glow styles) with real-time preview - Hook overlays with entrance animations (spring, fade, slide-up) - Video effects layer (zoom, brightness, contrast, saturate) - Browser-side rendering via @remotion/web-renderer (WebCodecs) - Editable transcript text in subtitle modal - Layers accumulate across operations (subtitles + hook rendered together) - Gemini EffectsConfig endpoint for structured JSON instead of fragile FFmpeg strings - Render service (Node.js) as alternative server-side renderer - New API endpoints: /api/clip/transcript, /api/effects/generate, /api/render Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
61 lines
1.8 KiB
JavaScript
61 lines
1.8 KiB
JavaScript
import React, { useMemo } from 'react';
|
|
import { Player } from '@remotion/player';
|
|
import { ShortVideo } from '../remotion/compositions/ShortVideo';
|
|
|
|
/**
|
|
* Wraps Remotion's Player component for real-time preview in modals.
|
|
* Accepts the same ShortVideoProps interface as the Remotion composition.
|
|
*
|
|
* @param {object} props
|
|
* @param {string} props.videoUrl - URL to the base clip video
|
|
* @param {number} props.durationInSeconds - Video duration in seconds
|
|
* @param {object|null} props.subtitles - SubtitleConfig or null
|
|
* @param {object|null} props.hook - HookConfig or null
|
|
* @param {object|null} props.effects - EffectsConfig or null
|
|
* @param {string} [props.className] - Additional CSS classes
|
|
*/
|
|
export default function RemotionPreview({
|
|
videoUrl,
|
|
durationInSeconds = 30,
|
|
subtitles = null,
|
|
hook = null,
|
|
effects = null,
|
|
className = '',
|
|
}) {
|
|
const fps = 30;
|
|
const durationInFrames = Math.max(1, Math.round(durationInSeconds * fps));
|
|
|
|
const inputProps = useMemo(
|
|
() => ({
|
|
videoUrl,
|
|
durationInFrames,
|
|
fps,
|
|
width: 1080,
|
|
height: 1920,
|
|
subtitles,
|
|
hook,
|
|
effects,
|
|
}),
|
|
[videoUrl, durationInFrames, subtitles, hook, effects]
|
|
);
|
|
|
|
return (
|
|
<div className={`w-full h-full ${className}`}>
|
|
<Player
|
|
component={ShortVideo}
|
|
inputProps={inputProps}
|
|
durationInFrames={durationInFrames}
|
|
fps={fps}
|
|
compositionWidth={1080}
|
|
compositionHeight={1920}
|
|
style={{
|
|
width: '100%',
|
|
height: '100%',
|
|
}}
|
|
controls
|
|
autoPlay
|
|
loop
|
|
/>
|
|
</div>
|
|
);
|
|
}
|