perf(canvas): 画布媒体 - 优化媒体加载、播放器与节点交互 (#357)

Merge origin/main at 2b7375f and retain canvas media performance, player layout, and interaction updates.

Co-authored-by: ddCat <2695092045@qq.com>
This commit is contained in:
wurendao007andddCat authored and GitHub committed 2026-08-31 09:00:37 +08:00
1 parent 16e9de9fd9
commit c891497df9
58 files changed
+2662 -207

No files matched your search

+30
View File
@@ -1,6 +1,7 @@
const LIBTV_PROJECT_UUID_PATTERN = /^[a-f0-9]{32}$/i;
const LIBTV_RESOURCE_HOST = "libtv-res.liblib.art";
const LIBTV_PREVIEW_WIDTH = 960;
const LIBTV_VIDEO_PREVIEW_WIDTH = 400;
export function parseLibTVProjectUUID(value: string) {
const trimmed = value.trim();
@@ -34,3 +35,32 @@ export function buildLibTVImagePreviewUrl(rawUrl: string) {
return rawUrl;
}
}
export function buildLibTVVideoPreviewUrl(rawUrl: string) {
try {
const url = new URL(rawUrl);
if (url.protocol !== "https:" || url.hostname !== LIBTV_RESOURCE_HOST) return "";
if (!url.searchParams.has("x-oss-process")) {
url.searchParams.set("x-oss-process", `video/snapshot,t_0,f_jpg,w_${LIBTV_VIDEO_PREVIEW_WIDTH},m_fast,ar_auto`);
}
return url.toString();
} catch {
return "";
}
}
/**
* Restores the playable LibTV asset URL when a snapshot transform was
* persisted as the node's content by an older importer. The OSS transform
* belongs only on previewContent; VideoPlayer must receive the original MP4.
*/
export function buildLibTVVideoSourceUrl(rawUrl: string) {
try {
const url = new URL(rawUrl);
if (url.protocol !== "https:" || url.hostname !== LIBTV_RESOURCE_HOST) return rawUrl;
url.searchParams.delete("x-oss-process");
return url.toString();
} catch {
return rawUrl;
}
}