A freshly imported video or image shows 0:00.0 on its Media card until it is placed on the timeline

未關閉 適合新手
#1,663 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
75/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
electron, react, typescript
領域
frontend

研究方向

從 src/components/ai-edition/v4/MediaStage.tsx 第 220 行附近開始,查看卡片上時長的渲染,然後閱讀 src/lib/ai-edition/store/useTimeline.ts 第 1528-1533 行處的註解,了解為什麼匯入不攜帶 durationSec。沿著匯入操作進入 store,並順著時間軸放置時所用的現有 probeAndCorrectClip 路徑,在匯入時用 history: false 呼叫同一個探測一次,對於其靜態影片已經具有已知長度的圖片則跳過。完成意味著匯入影片或 PNG 後,在任何時間軸放置之前,卡片上就會顯示正確的長度。

由索引模型根據 Issue 內容生成。

描述

bug

A video or image imported from the Media tab shows 0:00.0 on its card. The card only shows the real length once the asset has been placed on the timeline.

Steps

  1. Open a project, go to Media, then Import media.
  2. Pick a video (a 15 s H.264 MP4 here) or a PNG.
  3. The new card reads clipB.mp4 · 0:00.0 · 11 MB (or still.png · 0:00.0), and stays that way.
  4. Click the card, then Add to timeline. The clip has the right length, and only now does the card read 0:15.0 (0:05.0 for the image).

Expected: the card shows the asset's length as soon as the import finishes, as a recording's card does.

Seen on 2.4.0-rc.1, macOS 27.0.1 (Mac mini M1) and Ubuntu 24.04 GNOME Wayland. The cause below does not depend on the platform.

Why

The card renders formatSeconds(asset.durationSec ?? 0) (MediaStage.tsx#L220), and the import never sets durationSec, as the comment at useTimeline.ts#L1528-L1533 says. Only placing a clip starts the background probe (probeAndCorrectClip), which writes the duration back to the asset.

Fix direction

Probe the duration once at import, with the same probe and history: false. The card and the first placement then both have it. An image's still video is generated at import with a known length, so it needs no probe.

主要語言
TypeScript
星號
3.7k
分支
231
平均合併
1 天 8 小時
30 天內合併 PR
150

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

getopenscreen/openscreen 的其他 Issue

查看 getopenscreen/openscreen 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。