@@ -352,17 +352,22 @@ const nodeMedia = computed(() => {
352
352
const newOutputs = nodeOutputs .nodeOutputs [nodeOutputLocatorId .value ]
353
353
const node = lgraphNode .value
354
354
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
366
371
})
367
372
368
373
const nodeContainerRef = ref ()
0 commit comments