feat(asset): 素材悬浮预览支持视频播放 (#1240)
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 57s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 1m9s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 3m37s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 3m44s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 3m44s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 6m35s
CI/CD Pipeline / Build Staging API Image (push) Successful in 6m46s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m13s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 38s
CI/CD Pipeline / Staging E2E Tests (push) Successful in 1m24s
CI/CD Pipeline / Integration Tests (push) Successful in 4m8s
CI/CD Pipeline / Unit Tests (push) Successful in 11m20s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m26s
CI/CD Pipeline / Canary Release to Production (push) Failing after 1024h34m53s
CI/CD Pipeline / Deploy Production (push) Failing after 1024h34m55s
CI/CD Pipeline / CI Gate (push) Failing after 1024h34m55s
CI/CD Pipeline / Build Production Web Image (push) Failing after 1024h34m56s
CI/CD Pipeline / Build Production API Image (push) Failing after 1024h34m56s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 1024h46m15s
CI/CD Pipeline / PR Build API Image (push) Failing after 1024h46m17s
CI/CD Pipeline / Frontend Lint (push) Failing after 1024h46m18s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 1024h46m20s
CI/CD Pipeline / Production Browser E2E (push) Failing after 1025h8m10s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 1025h8m12s
CI/CD Pipeline / PR Build Web Image (push) Failing after 1025h19m32s

Co-authored-by: xiaoxia <dev@xiaoxiajianji.com>
Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
This commit was merged in pull request #1240.
This commit is contained in:
2026-08-04 22:41:00 +08:00
committed by auto-approve-bot
parent 004de97394
commit ffebaa7249
4 changed files with 15 additions and 2 deletions
@@ -18,6 +18,7 @@ const mapAssetToMediaAsset = (asset: AssetItem): MediaAsset => {
id: asset.id,
name: asset.name,
type: inferMediaType(asset.mime_type || ""),
source_url: asset.file_url,
thumbnail_url: asset.thumbnail_url,
duration: asset.duration ?? metaDuration,
size: asset.file_size ?? undefined,
@@ -424,6 +424,8 @@ export interface MediaAsset {
id: string
name: string
type: "video" | "image" | "audio"
/** 源文件 URL(视频/原图),用于悬浮预览播放 */
source_url?: string
/** 缩略图 URL */
thumbnail_url?: string
/** 时长(秒),仅 video/audio */
@@ -456,7 +456,8 @@
margin-bottom: 8px;
}
.as-preview-overlay-thumb img {
.as-preview-overlay-thumb img,
.as-preview-overlay-thumb video {
width: 100%;
height: 100%;
object-fit: cover;
@@ -12,7 +12,16 @@ const PreviewOverlay: React.FC<PreviewOverlayProps> = ({ asset, position }) => {
return (
<div className="as-preview-overlay" style={{ left: position.x, top: position.y }}>
<div className="as-preview-overlay-thumb">
{asset.thumbnail_url ? (
{asset.type === "video" && asset.source_url ? (
<video
src={asset.source_url}
autoPlay
muted
loop
playsInline
poster={asset.thumbnail_url}
/>
) : asset.thumbnail_url ? (
<img src={asset.thumbnail_url} alt={asset.name} />
) : (
<span className="as-preview-overlay-thumb-icon">{MATERIAL_TYPE_ICONS[asset.type]}</span>