From 81f14b911211be065448e92bcc253f470c5ff2a9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 11 May 2023 11:25:33 +0200 Subject: Correctly wait for live segment generation --- shared/server-commands/videos/live-command.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'shared/server-commands') diff --git a/shared/server-commands/videos/live-command.ts b/shared/server-commands/videos/live-command.ts index 2e4bc10b5..73f4eefd3 100644 --- a/shared/server-commands/videos/live-command.ts +++ b/shared/server-commands/videos/live-command.ts @@ -213,6 +213,7 @@ export class LiveCommand extends AbstractCommand { while (error) { try { + // Check fragment exists await this.getRawRequest({ ...options, @@ -224,12 +225,16 @@ export class LiveCommand extends AbstractCommand { const video = await server.videos.get({ id: videoUUID }) const hlsPlaylist = video.streamingPlaylists[0] + // Check SHA generation const shaBody = await server.streamingPlaylists.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url, withRetry: objectStorage }) - if (!shaBody[segmentName]) { throw new Error('Segment SHA does not exist') } + // Check fragment is in m3u8 playlist + const subPlaylist = await server.streamingPlaylists.get({ url: `${baseUrl}/${video.uuid}/${playlistNumber}.m3u8` }) + if (!subPlaylist.includes(segmentName)) throw new Error('Fragment does not exist in playlist') + error = false } catch { error = true -- cgit v1.2.3