Skip to content

fix(studio): single-frame export uses wrong content, ignores duration setting#55

Open
walliai666 wants to merge 1 commit into
nexu-io:mainfrom
walliai666:fix/single-frame-export-duration-and-content
Open

fix(studio): single-frame export uses wrong content, ignores duration setting#55
walliai666 wants to merge 1 commit into
nexu-io:mainfrom
walliai666:fix/single-frame-export-duration-and-content

Conversation

@walliai666

@walliai666 walliai666 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

fix(studio): single-frame export uses wrong content, ignores duration setting

  1. Wrong content: exportMp4 always rendered the template's original
    source HTML, ignoring the agent-generated preview saved to
    lastPreviewHtmlPath. Now uses lastPreviewHtmlPath when present.

  2. Duration ignored: exportMp4 hardcoded duration: 'auto', causing
    the adapter to fall back to the animation's natural length (~4s)
    instead of the user's setting. durationTargetSec was defined in
    UserPreferences but never written or read.

    • studio-server now persists collected.duration to
      preferences.durationTargetSec at generate time (covers both
      single-frame and multi-frame paths).
    • exportMp4 reads durationTargetSec and passes it as
      durationMode: 'explicit' so the adapter honors it as a hard cap.
  3. UI showed render time not video duration: the "MP4 已导出 · Xs"
    badge was displaying elapsed_ms (wall-clock render time) instead
    of the actual video length. export_done SSE event now carries
    duration_sec; the studio UI uses that instead.

Resolves #50
Resolves #51

@lefarcen

Copy link
Copy Markdown
Contributor

Hey @walliai-chenlb! 👋

Nice work tracking down three distinct bugs in the same export path — the lastPreviewHtmlPath oversight, the hardcoded 'auto' duration, and the misleading badge all make sense together once you see the flow. The PR description is clear and well-scoped.

I've assigned @Siri-Ray for code review. In the meantime, this PR is linked to #50 which reports the same duration issue — good alignment.

… setting

1. Wrong content: exportMp4 always rendered the template's original
   source HTML, ignoring the agent-generated preview saved to
   lastPreviewHtmlPath. Now uses lastPreviewHtmlPath when present.

2. Duration ignored: exportMp4 hardcoded `duration: 'auto'`, causing
   the adapter to fall back to the animation's natural length (~4s)
   instead of the user's setting. durationTargetSec was defined in
   UserPreferences but never written or read.
   - studio-server now persists collected.duration to
     preferences.durationTargetSec at generate time (covers both
     single-frame and multi-frame paths).
   - exportMp4 reads durationTargetSec and passes it as
     durationMode: 'explicit' so the adapter honors it as a hard cap.

3. UI showed render time not video duration: the "MP4 已导出 · Xs"
   badge was displaying elapsed_ms (wall-clock render time) instead
   of the actual video length. export_done SSE event now carries
   duration_sec; the studio UI uses that instead.
@walliai666 walliai666 force-pushed the fix/single-frame-export-duration-and-content branch from 0471f48 to 0ec429d Compare June 15, 2026 09:47
@walliai666

Copy link
Copy Markdown
Contributor Author

@lefarcen Thanks for the feedback and for linking this PR to #50!

I noticed there isn't currently a reviewer assigned on the PR, so just wanted to check whether the assignment to @Siri-Ray went through.

Also, just a small note: this PR addresses both #50 and #51.

I'll wait for the review and address any feedback once it's available. Thanks!

@lefarcen

Copy link
Copy Markdown
Contributor

Hey @walliai-chenlb — yes, the review request to @Siri-Ray is live on the PR. Thanks for flagging that #51 is in scope too; that’s helpful context here.

@Siri-Ray could you take a look when you have a chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk/medium Medium risk size/S Size S (20-99 LOC) type/bugfix Bug fix

Projects

None yet

2 participants