From 39eca0bc0a5ece276816101617f45852acdf0924 Mon Sep 17 00:00:00 2001 From: Simula_r <18093452+simula-r@users.noreply.github.com> Date: Thu, 2 Oct 2025 19:34:00 -0700 Subject: [PATCH] fix: save video preview (#5897) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Fix the save video preview by checking for video inputs. ## Screenshots (if applicable) https://github.com/user-attachments/assets/26a1fbb1-f54c-4a17-a59d-ce89b4e0c389 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5897-fix-save-video-preview-2816d73d365081b79a47e0da29e1fed6) by [Unito](https://www.unito.io) --- .../vueNodes/components/LGraphNode.vue | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/renderer/extensions/vueNodes/components/LGraphNode.vue b/src/renderer/extensions/vueNodes/components/LGraphNode.vue index 0e6acc461..103776243 100644 --- a/src/renderer/extensions/vueNodes/components/LGraphNode.vue +++ b/src/renderer/extensions/vueNodes/components/LGraphNode.vue @@ -352,17 +352,22 @@ const nodeMedia = computed(() => { const newOutputs = nodeOutputs.nodeOutputs[nodeOutputLocatorId.value] const node = lgraphNode.value - // Note: Despite the field name "images", videos are also included. - // The actual media type is determined by node.previewMediaType - // TODO: fix the backend to return videos using the vidoes key instead of the images key - if (node && newOutputs?.images?.length) { - const urls = nodeOutputs.getNodeImageUrls(node) - if (urls && urls.length > 0) { - const type = node.previewMediaType === 'video' ? 'video' : 'image' - return { type, urls } as const - } - } - return undefined + if (!node || !newOutputs?.images?.length) return undefined + + const urls = nodeOutputs.getNodeImageUrls(node) + if (!urls?.length) return undefined + + // Determine media type from previewMediaType or fallback to input slot types + // Note: Despite the field name "images", videos are also included in outputs + // TODO: fix the backend to return videos using the videos key instead of the images key + const hasVideoInput = node.inputs?.some((input) => input.type === 'VIDEO') + const type = + node.previewMediaType === 'video' || + (!node.previewMediaType && hasVideoInput) + ? 'video' + : 'image' + + return { type, urls } as const }) const nodeContainerRef = ref()