From aafe23f1c84cf49f83bf6fc98d9f1167aba4f031 Mon Sep 17 00:00:00 2001 From: mimimiku778 <0203.sub@gmail.com> Date: Fri, 10 Jul 2026 23:12:25 +0900 Subject: [PATCH] fix(obs): let uploadObjTalk carry the real audio/video duration uploadObjTalk hardcoded the obs `duration` param to "1919" for audio and video. LINE uses this param verbatim as the length shown in the client (it does not recompute it from the uploaded m4a/mp4), so every voice/video message was displayed as ~1.9s regardless of its real length. Add an optional `durationMs` argument and use it, keeping 1919 as the fallback so existing callers are unaffected. --- packages/linejs/base/obs/mod.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/linejs/base/obs/mod.ts b/packages/linejs/base/obs/mod.ts index a2e4e4f8..aeb89091 100644 --- a/packages/linejs/base/obs/mod.ts +++ b/packages/linejs/base/obs/mod.ts @@ -157,6 +157,7 @@ export class LineObs { data: Blob, oid?: string, filename?: string, + durationMs?: number, ): Promise<{ objId: string; objHash: string; @@ -195,7 +196,10 @@ export class LineObs { param.cat = "original"; param.type = "image"; } else if (type === "audio" || type === "video") { - param.duration = "1919"; // 810 + // LINE uses this obs param verbatim as the displayed length (it does not + // recompute it from the uploaded file), so a caller-supplied real duration + // must be honoured; keep the historical value as the fallback. + param.duration = (durationMs ?? 1919).toString(); } const toType: "talk" | "g2" = to[0] === "m" || to[0] === "t" ? "g2"