fix: 修复视频定位与运行时依赖打包

This commit is contained in:
majun.jason
2026-08-04 21:00:13 +08:00
parent a0e8be0cdf
commit 66a6ee3e32
12 changed files with 481 additions and 28 deletions
+9 -3
View File
@@ -4,14 +4,20 @@ interface VideoBubbleProps {
md5?: string
newMd5?: string
rawMd5?: string
createTime?: number
duration?: number
width?: number
height?: number
}
export function VideoBubble({
md5,
newMd5,
rawMd5,
duration
createTime,
duration,
width,
height
}: VideoBubbleProps): React.ReactElement {
const hashes = useMemo(
() => [rawMd5, newMd5, md5].filter((value): value is string => Boolean(value)),
@@ -22,7 +28,7 @@ export function VideoBubble({
useEffect(() => {
let cancelled = false
window.api
.getVideo(hashes)
.getVideo(hashes, { createTime, duration, width, height })
.then((result) => {
if (!cancelled) setMedia(result.success ? result : { error: result.error })
})
@@ -32,7 +38,7 @@ export function VideoBubble({
return () => {
cancelled = true
}
}, [hashes])
}, [createTime, duration, hashes, height, width])
if (!media.url) {
return <div className="video-placeholder">{media.error || '视频加载中…'}</div>
@@ -81,7 +81,10 @@ export function MessageBubble({
md5={message.contentData.md5}
newMd5={message.contentData.newMd5}
rawMd5={message.contentData.rawMd5}
createTime={message.createTime}
duration={message.contentData.duration}
width={message.contentData.width}
height={message.contentData.height}
/>
) : isRichMedia && message.contentData ? (
<RichMessageBubble