Skip to content

Commit 39eca0b

Browse files
authored
fix: save video preview (#5897)
## 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)
1 parent 2970692 commit 39eca0b

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/renderer/extensions/vueNodes/components/LGraphNode.vue

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -352,17 +352,22 @@ const nodeMedia = computed(() => {
352352
const newOutputs = nodeOutputs.nodeOutputs[nodeOutputLocatorId.value]
353353
const node = lgraphNode.value
354354
355-
// Note: Despite the field name "images", videos are also included.
356-
// The actual media type is determined by node.previewMediaType
357-
// TODO: fix the backend to return videos using the vidoes key instead of the images key
358-
if (node && newOutputs?.images?.length) {
359-
const urls = nodeOutputs.getNodeImageUrls(node)
360-
if (urls && urls.length > 0) {
361-
const type = node.previewMediaType === 'video' ? 'video' : 'image'
362-
return { type, urls } as const
363-
}
364-
}
365-
return undefined
355+
if (!node || !newOutputs?.images?.length) return undefined
356+
357+
const urls = nodeOutputs.getNodeImageUrls(node)
358+
if (!urls?.length) return undefined
359+
360+
// Determine media type from previewMediaType or fallback to input slot types
361+
// Note: Despite the field name "images", videos are also included in outputs
362+
// TODO: fix the backend to return videos using the videos key instead of the images key
363+
const hasVideoInput = node.inputs?.some((input) => input.type === 'VIDEO')
364+
const type =
365+
node.previewMediaType === 'video' ||
366+
(!node.previewMediaType && hasVideoInput)
367+
? 'video'
368+
: 'image'
369+
370+
return { type, urls } as const
366371
})
367372
368373
const nodeContainerRef = ref()

0 commit comments

Comments
 (0)