🐛 fix(video_subtitle_embedding): 确保视频和字幕嵌入准备就绪

This commit is contained in:
2025-01-11 16:53:34 +08:00
parent becab7b07c
commit 32398b6fa9
2 changed files with 1360 additions and 945 deletions

View File

@@ -43,6 +43,7 @@ export const useVideoSubtitleEmbedding = async (
new MP4Clip((await fetch(videoUrl)).body!) new MP4Clip((await fetch(videoUrl)).body!)
); );
videoSprite.time = { duration: 10e6, offset: 0 }; videoSprite.time = { duration: 10e6, offset: 0 };
await videoSprite.ready;
const srtSprite = new OffscreenSprite( const srtSprite = new OffscreenSprite(
new EmbedSubtitlesClip(await (await fetch(srtUrl)).text(), { new EmbedSubtitlesClip(await (await fetch(srtUrl)).text(), {
@@ -60,6 +61,7 @@ export const useVideoSubtitleEmbedding = async (
...options, ...options,
}) })
); );
await srtSprite.ready;
srtSprite.time = { duration: 10e6, offset: 0 }; srtSprite.time = { duration: 10e6, offset: 0 };
const combinator = new Combinator({ const combinator = new Combinator({

2303
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff