Skip to content

Commit bb7532d

Browse files
AmirMohammad CheraghaliAmirMohammad Cheraghali
authored andcommitted
fix(studio): Sync session playback with video export
- Fixed issue where exported video was a static image - Updated handleExportVideo to trigger recorder.play() during capture - Ensured timeline seeks to start before recording
1 parent d626126 commit bb7532d

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/App.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,13 +1511,31 @@ function App() {
15111511
const settings = recorder.session.metadata.settings;
15121512
const fps = settings?.fps || 30;
15131513

1514-
const blob = await viewer.recordMovie(duration, {
1514+
// 1. Reset timeline to start
1515+
recorder.seek(0);
1516+
await new Promise(r => setTimeout(r, 100)); // Wait for seek to apply
1517+
1518+
// 2. Start Recording (Async) - wraps the recording duration
1519+
const recordingPromise = viewer.recordMovie(duration, {
15151520
watermark,
15161521
overlays,
15171522
transitions,
15181523
fps // Pass FPS
15191524
} as any);
15201525

1526+
// 3. Start Playback (Concurrent)
1527+
// Delay slightly to ensure MediaRecorder is active
1528+
setTimeout(() => {
1529+
recorder.play();
1530+
}, 50);
1531+
1532+
// 4. Wait for recording to finish
1533+
const blob = await recordingPromise;
1534+
1535+
// 5. Stop playback
1536+
recorder.pause();
1537+
1538+
15211539
// Prompt download
15221540
const ext = settings?.exportFormat === 'gif' ? 'gif' : 'webm';
15231541
const url = URL.createObjectURL(blob);

0 commit comments

Comments
 (0)