-
{formatTime(currentFrame)}
-
/
-
{formatTime(totalFrames)}
+
+ {formatTime(currentFrame)}
+ /
+ {formatTime(totalFrames)}
-
- Frame: {currentFrame} / {totalFrames}
+
+ Frame: {currentFrame} / {totalFrames}
);
diff --git a/MyApp.Client/components/editor/canvas/preview-canvas.tsx b/MyApp.Client/components/editor/canvas/preview-canvas.tsx
index 1cda616..7a10162 100644
--- a/MyApp.Client/components/editor/canvas/preview-canvas.tsx
+++ b/MyApp.Client/components/editor/canvas/preview-canvas.tsx
@@ -1,6 +1,6 @@
'use client';
-import { useEffect, useRef } from 'react';
+import { useCallback, useEffect, useRef } from 'react';
import { Player, PlayerRef } from '@remotion/player';
import { Project } from '@/lib/types/project';
import { useAssetStore } from '@/lib/stores/asset-store';
@@ -16,10 +16,11 @@ interface PreviewCanvasProps {
export function PreviewCanvas({ project }: PreviewCanvasProps) {
const playerRef = useRef
(null);
const { assets } = useAssetStore();
- const { isPlaying, fps, pause, play } = usePlaybackStore();
+ const { isPlaying, pause } = usePlaybackStore();
const { getTimeline, setCurrentFrame } = useTimelineStore();
const timeline = getTimeline();
+ // Sync player playback state
useEffect(() => {
if (!playerRef.current) return;
@@ -30,19 +31,28 @@ export function PreviewCanvas({ project }: PreviewCanvasProps) {
}
}, [isPlaying]);
- useEffect(() => {
- if (playerRef.current && timeline) {
- playerRef.current.seekTo(timeline.currentFrame);
- }
- }, [timeline?.currentFrame]);
+ // Handle frame updates from player
+ const handleFrameUpdate = useCallback(
+ (frame: number) => {
+ if (timeline && frame !== timeline.currentFrame) {
+ setCurrentFrame(frame);
+ }
+ },
+ [timeline, setCurrentFrame]
+ );
+
+ // Handle playback end
+ const handleEnded = useCallback(() => {
+ pause();
+ }, [pause]);
if (!timeline) return null;
return (
-
+
diff --git a/MyApp.Client/components/editor/editor-layout.tsx b/MyApp.Client/components/editor/editor-layout.tsx
index f03c500..209f629 100644
--- a/MyApp.Client/components/editor/editor-layout.tsx
+++ b/MyApp.Client/components/editor/editor-layout.tsx
@@ -12,12 +12,12 @@ interface EditorLayoutProps {
export function EditorLayout({ project }: EditorLayoutProps) {
return (
-
+
{/* Header */}
-
-
{project.name}
+
+
{project.name}
-
+
{project.settings.width}x{project.settings.height} • {project.settings.fps}fps
@@ -26,7 +26,7 @@ export function EditorLayout({ project }: EditorLayoutProps) {
{/* Main Content */}
{/* Left Sidebar - Asset Library */}
-
+
@@ -39,7 +39,7 @@ export function EditorLayout({ project }: EditorLayoutProps) {
{/* Timeline */}
-
diff --git a/MyApp.Client/components/editor/timeline/timeline-container.tsx b/MyApp.Client/components/editor/timeline/timeline-container.tsx
index 5fb72a2..f9bafc0 100644
--- a/MyApp.Client/components/editor/timeline/timeline-container.tsx
+++ b/MyApp.Client/components/editor/timeline/timeline-container.tsx
@@ -50,18 +50,18 @@ export function TimelineContainer({ project }: TimelineContainerProps) {
};
return (
-
+
{/* Toolbar */}
-
-