From b792d4d33a08f771ed8cd073ab4c1e66b7467507 Mon Sep 17 00:00:00 2001 From: Timothy Yin Date: Mon, 10 Feb 2025 14:48:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9C=AC=E5=9C=B0=E5=AD=97=E5=B9=95?= =?UTF-8?q?=E5=90=88=E6=88=90=E8=A7=86=E9=A2=91=E5=8F=AA=E6=9C=89=2010=20?= =?UTF-8?q?=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composables/useVideoSubtitleEmbedding.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/composables/useVideoSubtitleEmbedding.ts b/composables/useVideoSubtitleEmbedding.ts index 26be3c2..d1f0d5f 100644 --- a/composables/useVideoSubtitleEmbedding.ts +++ b/composables/useVideoSubtitleEmbedding.ts @@ -39,10 +39,9 @@ export const useVideoSubtitleEmbedding = async ( }; } - const videoSprite = new OffscreenSprite( - new MP4Clip((await fetch(videoUrl)).body!) - ); - videoSprite.time = { duration: 10e6, offset: 0 }; + const videoClip = new MP4Clip((await fetch(videoUrl)).body!) + const videoSprite = new OffscreenSprite(videoClip) + videoSprite.time = { duration: videoClip.meta.duration, offset: 0 } await videoSprite.ready; const srtSprite = new OffscreenSprite( @@ -62,7 +61,7 @@ export const useVideoSubtitleEmbedding = async ( }) ); await srtSprite.ready; - srtSprite.time = { duration: 10e6, offset: 0 }; + srtSprite.time = { duration: videoClip.meta.duration, offset: 0 } const combinator = new Combinator({ width: 1920,