feat: 视频素材缩略图改为可播放video预览
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 24s
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m12s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m32s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 2m1s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 1m36s
AI Code Review / AI Code Review (pull_request) Failing after 2m16s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 1m53s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 1m58s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m26s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m37s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 4m43s
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 5s

- 视频素材(isVideo+file_url)使用video标签自动循环播放
- 无file_url时fallback到thumbnail_url静态图
- 非视频素材保持原有img/fallback逻辑
This commit is contained in:
2026-08-06 17:11:55 +08:00
parent 8507729ca9
commit c411b732bd
@@ -34,7 +34,6 @@ const ManualMaterialList: React.FC<ManualMaterialListProps> = ({
const checked = selectedMaterials.includes(m.id)
const isVideo = m.mime_type?.startsWith("video/") ?? false
// thumbnail_url 是静态截图,可直接用于 <img>
// file_url 是视频/音频文件本身,<img> 无法渲染,不能作为 src 回退
const thumbSrc = m.thumbnail_url || undefined
return (
<label
@@ -73,7 +72,20 @@ const ManualMaterialList: React.FC<ManualMaterialListProps> = ({
justifyContent: "center",
}}
>
{thumbSrc ? (
{isVideo && m.file_url ? (
<video
src={m.file_url}
muted
loop
playsInline
autoPlay
style={{
width: "100%",
height: "100%",
objectFit: "cover",
}}
/>
) : thumbSrc ? (
<img
src={thumbSrc}
alt={m.name}
@@ -90,13 +102,14 @@ const ManualMaterialList: React.FC<ManualMaterialListProps> = ({
}}
/>
) : null}
{!thumbSrc && (
<span style={{ fontSize: 20, opacity: 0.5, display: "flex" }}>
{isVideo ? "🎬" : "🎵"}
</span>
{!thumbSrc && !isVideo && (
<span style={{ fontSize: 20, opacity: 0.5, display: "flex" }}>🎵</span>
)}
{!thumbSrc && isVideo && !m.file_url && (
<span style={{ fontSize: 20, opacity: 0.5, display: "flex" }}>🎬</span>
)}
{/* img onError 时显示的 fallback(初始隐藏) */}
{thumbSrc && (
{thumbSrc && !(isVideo && m.file_url) && (
<span style={{ fontSize: 20, opacity: 0.5, display: "none" }}>
{isVideo ? "🎬" : "🎵"}
</span>