From 88c3cb65baf7e38a2d00de4e0f388261ef121f21 Mon Sep 17 00:00:00 2001 From: Konv Suu <2583695112@qq.com> Date: Fri, 28 Mar 2025 11:20:17 +0800 Subject: [PATCH] fix(desktop): handle duration_in_seconds correctly in timestamp (#3321) * fix(desktop): handle duration_in_seconds correctly in timestamp * update * test * test * clean --- .../src/modules/renderer/components/TimeStamp.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/renderer/src/modules/renderer/components/TimeStamp.tsx b/apps/desktop/src/renderer/src/modules/renderer/components/TimeStamp.tsx index bfd5d6087..f8618b19e 100644 --- a/apps/desktop/src/renderer/src/modules/renderer/components/TimeStamp.tsx +++ b/apps/desktop/src/renderer/src/modules/renderer/components/TimeStamp.tsx @@ -1,4 +1,5 @@ import { nextFrame } from "@follow/utils/dom" +import { formatTimeToSeconds } from "@follow/utils/utils" import { useContext } from "react" import { AudioPlayer } from "~/atoms/player" @@ -9,7 +10,13 @@ import { EntryInfoContext } from "../context" export const TimeStamp = (props: { time: string }) => { const { entryId } = useContext(EntryInfoContext) const entry = useEntry(entryId) - const mediaDuration = entry?.entries.attachments?.[0]?.duration_in_seconds + let mediaDuration = entry?.entries.attachments?.[0]?.duration_in_seconds + + if (mediaDuration && Number.isNaN(+mediaDuration)) { + // @ts-expect-error mediaDuration is string + mediaDuration = formatTimeToSeconds(mediaDuration) + } + const src = entry?.entries?.attachments?.[0]?.url if (!src) return {props.time}