mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-25 01:04:06 +00:00
fix: detect video output from data in Nodes 2.0 (#8943)
## Summary - Fixes SaveWebM node showing "Error loading image" in Vue nodes mode - Extracts `isAnimatedOutput`/`isVideoOutput` utility functions from inline logic in `unsafeUpdatePreviews` so both the litegraph canvas renderer and Vue nodes renderer can detect video output directly from execution data - Uses output-based detection in `imagePreviewStore.isImageOutputs` to avoid applying image preview format conversion to video files ## Background In Vue nodes mode, `nodeMedia` relied on `node.previewMediaType` to determine if output is video. This property is only set via `onDrawBackground` → `unsafeUpdatePreviews` in the litegraph canvas path, which doesn't run in Vue nodes mode. This caused webm output to render via `<img>` instead of `<video>`. ## Before https://github.com/user-attachments/assets/36f8a033-0021-4351-8f82-d19e3faa80c2 ## After https://github.com/user-attachments/assets/6558d261-d70e-4968-9637-6c24532e23ac ## Test plan - [x] `pnpm typecheck` passes - [x] `pnpm lint` passes - [x] `pnpm test:unit` passes (4500 tests) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8943-fix-detect-video-output-from-data-in-Vue-nodes-mode-30a6d73d365081e98e91d6d1dcc88785) by [Unito](https://www.unito.io) --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
committed by
GitHub
parent
b47414a52f
commit
d3c0e331eb
@@ -56,8 +56,10 @@ import { useRightSidePanelStore } from '@/stores/workspace/rightSidePanelStore'
|
||||
import { useWidgetStore } from '@/stores/widgetStore'
|
||||
import { normalizeI18nKey } from '@/utils/formatUtil'
|
||||
import {
|
||||
isAnimatedOutput,
|
||||
isImageNode,
|
||||
isVideoNode,
|
||||
isVideoOutput,
|
||||
migrateWidgetsValues
|
||||
} from '@/utils/litegraphUtil'
|
||||
import { getOrderedInputSpecs } from '@/workbench/utils/nodeDefOrderingUtil'
|
||||
@@ -753,17 +755,9 @@ export const useLitegraphService = () => {
|
||||
if (isNewOutput) this.images = output.images
|
||||
|
||||
if (isNewOutput || isNewPreview) {
|
||||
this.animatedImages = output?.animated?.find(Boolean)
|
||||
this.animatedImages = isAnimatedOutput(output)
|
||||
|
||||
const isAnimatedWebp =
|
||||
this.animatedImages &&
|
||||
output?.images?.some((img) => img.filename?.includes('webp'))
|
||||
const isAnimatedPng =
|
||||
this.animatedImages &&
|
||||
output?.images?.some((img) => img.filename?.includes('png'))
|
||||
const isVideo =
|
||||
(this.animatedImages && !isAnimatedWebp && !isAnimatedPng) ||
|
||||
isVideoNode(this)
|
||||
const isVideo = isVideoOutput(output) || isVideoNode(this)
|
||||
if (isVideo) {
|
||||
useNodeVideo(this, callback).showPreview()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user