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,