🎥 Make videos programmatically with React
Show loading indicator instead of text-rotation example during generation
ASchwad2cfbafbaa642
diff --git a/packages/template-code-generation/src/app/generate/page.tsx b/packages/template-code-generation/src/app/generate/page.tsxindex f795cd35d7..28f090109f 100644--- a/packages/template-code-generation/src/app/generate/page.tsx+++ b/packages/template-code-generation/src/app/generate/page.tsx@@ -133,6 +133,7 @@ function GeneratePageContent() {durationInFrames={durationInFrames}fps={fps}isCompiling={isCompiling}+ isStreaming={isStreaming}error={error}/></div>diff --git a/packages/template-code-generation/src/components/AnimationPlayer.tsx b/packages/template-code-generation/src/components/AnimationPlayer.tsxindex 689051def3..12a8816f4f 100644--- a/packages/template-code-generation/src/components/AnimationPlayer.tsx+++ b/packages/template-code-generation/src/components/AnimationPlayer.tsx@@ -23,6 +23,7 @@ interface AnimationPlayerProps {durationInFrames: number;fps: number;isCompiling: boolean;+ isStreaming: boolean;error: string | null;}@@ -31,8 +32,27 @@ export const AnimationPlayer: React.FC<AnimationPlayerProps> = ({durationInFrames,fps,isCompiling,+ isStreaming,error,}) => {+ if (isStreaming) {+ return (+ <div className="flex flex-3 flex-col items-center bg-[#0a0a0a] min-w-0">+ <div className="w-full max-w-[1200px]">+ <h2 className="text-sm font-medium text-[#888] mb-3">+ Video Preview+ </h2>+ <div className="w-full aspect-video flex flex-col justify-center items-center gap-4 bg-[#1a1a1a] rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)]">+ <div className="w-12 h-12 border-4 border-[#333] border-t-[#6366f1] rounded-full animate-spin" />+ <p className="text-[#888] text-sm">+ Waiting for code generation to finish...+ </p>+ </div>+ </div>+ </div>+ );+ }+if (isCompiling) {return (<div className="flex flex-3 flex-col items-center bg-[#0a0a0a] min-w-0">diff --git a/packages/template-code-generation/src/templates/text-rotation.ts b/packages/template-code-generation/src/templates/text-rotation.tsindex c3f5e2f5f6..5bd56676ca 100644--- a/packages/template-code-generation/src/templates/text-rotation.ts+++ b/packages/template-code-generation/src/templates/text-rotation.ts@@ -4,10 +4,9 @@ export const textRotationCode = `import { useCurrentFrame, useVideoConfig, Absolexport const MyAnimation = () => {const frame = useCurrentFrame();- const { fps } = useVideoConfig();// Text content - easily customizable- const WORDS = ["One sec please :)", "Getting started", "with your", "Code Generation"];+ const WORDS = ["This is a", "Text rotation example", "using Remotion!"];// Animation timingconst WORD_DURATION = 60; // frames per word