fix(canvas): 远程媒体 - 统一资源地址并校验视频缓存

This commit is contained in:
ddCat committed 2026-09-19 22:29:09 +08:00
1 parent cb68476e36
commit 04a1e19def
10 files changed
+83 -134

No files matched your search

+4 -5
View File
@@ -1,5 +1,4 @@
import { cacheResourceObjectUrl } from "@/services/resource-blob-cache";
import { resourceIdFromStorageKey } from "@/services/api/resources";
import { resourceFileUrl, resourceIdFromStorageKey } from "@/services/api/resources";
export type CanvasAudioSource = {
nodeId: string;
@@ -255,9 +254,9 @@ function sameSource(left: CanvasAudioSource, right: CanvasAudioSource) {
}
async function resolveAudioSource(source: CanvasAudioSource) {
if (source.storageKey && resourceIdFromStorageKey(source.storageKey)) {
const cached = await cacheResourceObjectUrl(source.storageKey).catch(() => "");
return cached || source.content;
if (source.storageKey) {
const resourceId = resourceIdFromStorageKey(source.storageKey);
if (resourceId) return resourceFileUrl(resourceId);
}
return source.content;
}