refactor: 视频提取进度实时更新卡片,不再刷日志面板

- 主进程通过 video:progress IPC 推送当前帧数
- 前端监听进度事件,直接更新视频芯片的 meta 文本
- 日志面板只保留开始和完成两条记录
This commit is contained in:
thzxx
2026-06-18 11:45:31 +08:00
parent 52c0c3aff5
commit abd3dfde72
4 changed files with 38 additions and 15 deletions
+7 -1
View File
@@ -127,6 +127,12 @@ contextBridge.exposeInMainWorld('metonaDesktop', {
},
video: {
extractFrames: (filePath: string, options?: { maxFrames?: number; maxWidth?: number; maxSize?: number }) =>
ipcRenderer.invoke('video:extractFrames', filePath, options)
ipcRenderer.invoke('video:extractFrames', filePath, options),
onProgress: (callback: (data: { current: number }) => void) => {
ipcRenderer.on('video:progress', (_: unknown, data: { current: number }) => callback(data));
},
removeProgressListener: () => {
ipcRenderer.removeAllListeners('video:progress');
}
}
});