Files
Pre_Seg_Server/工程分析/需求分析-20260429_232813.md

27 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 需求分析 — 视频帧显示链路修复
## 问题背景
用户报告三个关联问题:
1. 项目库中没有默认视频 `Data_MyVideo_1.mp4`
2. 点击默认视频进入分割工作区后,画面区域一片黑(无影像)
3. 导入新视频后进入工作区,同样看不到视频帧
## 根因分析
| 问题 | 根因 |
|------|------|
| 无默认项目 | 后端 lifespan 无自动种子逻辑;`server.ts` 硬编码项目但前端根本不请求 Express |
| 工作区黑屏 | `CanvasArea.tsx` 硬编码 Unsplash 外链,未从 store 读取帧;进入工作区不调用帧列表 API |
| 导入后黑屏 | 上传未关联 project_id上传后未触发 `/api/media/parse` 帧提取;后端 `/frames` 返回的是 MinIO 对象名而非可访问 URL |
## 需求拆解
| 编号 | 需求 | 优先级 |
|------|------|--------|
| R1 | 后端启动时自动检测并注册 `Data_MyVideo_1.mp4` 为默认项目 | P0 |
| R2 | 后端 `/api/projects/{id}/frames` 返回 presigned URL 而非对象名 | P0 |
| R3 | 后端 `ProjectOut` 增加 `frame_count` 供前端显示 | P1 |
| R4 | 前端 `VideoWorkspace` 进入时自动获取帧列表并写入 store | P0 |
| R5 | 前端 `CanvasArea` 从 store 读取当前帧 URL 并渲染 | P0 |
| R6 | 前端 `FrameTimeline` 从 store 读取真实帧数据,支持切换 | P0 |
| R7 | 前端 `ProjectLibrary` 上传流程:创建项目 → 带 project_id 上传 → 触发解析 | P0 |
| R8 | 后端 upload 接口支持无 project_id 时自动创建项目 | P1 |