From 4cbf8a54fcf11fb71ff935baee52c79a83f5035c Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Tue, 19 Nov 2024 12:57:19 +0800 Subject: [PATCH] fix: video media can not play in video view close #1645 --- .../src/modules/entry-column/Items/video-item.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/renderer/src/modules/entry-column/Items/video-item.tsx b/apps/renderer/src/modules/entry-column/Items/video-item.tsx index 3c7410ebb4..719205a787 100644 --- a/apps/renderer/src/modules/entry-column/Items/video-item.tsx +++ b/apps/renderer/src/modules/entry-column/Items/video-item.tsx @@ -9,6 +9,7 @@ import { AudioPlayer } from "~/atoms/player" import { m } from "~/components/common/Motion" import { RelativeTime } from "~/components/ui/datetime" import { Media } from "~/components/ui/media" +import { usePreviewMedia } from "~/components/ui/media/hooks" import type { ModalContentComponent } from "~/components/ui/modal" import { FixedModalCloseButton } from "~/components/ui/modal/components/close" import { PlainModal } from "~/components/ui/modal/stacked/custom-modal" @@ -35,6 +36,7 @@ export function VideoItem({ entryId, entryPreview, translation }: UniversalItemP [entry?.entries.url], ) const modalStack = useModalStack() + const previewMedia = usePreviewMedia() const ref = useRef(null) const [hovered, setHovered] = useState(false) @@ -74,6 +76,12 @@ export function VideoItem({ entryId, entryPreview, translation }: UniversalItemP CustomModalComponent: PlainModal, overlay: true, }) + } else { + const videoMediaList = + entry.entries.media?.filter((media) => media.type === "video") || [] + if (videoMediaList.length > 0) { + previewMedia(videoMediaList) + } } }} >