aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-11 11:25:33 +0200
committerChocobozzz <me@florianbigard.com>2023-05-11 11:41:43 +0200
commit81f14b911211be065448e92bcc253f470c5ff2a9 (patch)
treebd0ff9fc61ee4fb86ce222e7831747aa6c90752e /shared/server-commands
parentc106db14136f1701a8b1eab8d7152395225e55e4 (diff)
downloadPeerTube-81f14b911211be065448e92bcc253f470c5ff2a9.tar.gz
PeerTube-81f14b911211be065448e92bcc253f470c5ff2a9.tar.zst
PeerTube-81f14b911211be065448e92bcc253f470c5ff2a9.zip
Correctly wait for live segment generation
Diffstat (limited to 'shared/server-commands')
-rw-r--r--shared/server-commands/videos/live-command.ts7
1 files changed, 6 insertions, 1 deletions
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 {
213 213
214 while (error) { 214 while (error) {
215 try { 215 try {
216 // Check fragment exists
216 await this.getRawRequest({ 217 await this.getRawRequest({
217 ...options, 218 ...options,
218 219
@@ -224,12 +225,16 @@ export class LiveCommand extends AbstractCommand {
224 const video = await server.videos.get({ id: videoUUID }) 225 const video = await server.videos.get({ id: videoUUID })
225 const hlsPlaylist = video.streamingPlaylists[0] 226 const hlsPlaylist = video.streamingPlaylists[0]
226 227
228 // Check SHA generation
227 const shaBody = await server.streamingPlaylists.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url, withRetry: objectStorage }) 229 const shaBody = await server.streamingPlaylists.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url, withRetry: objectStorage })
228
229 if (!shaBody[segmentName]) { 230 if (!shaBody[segmentName]) {
230 throw new Error('Segment SHA does not exist') 231 throw new Error('Segment SHA does not exist')
231 } 232 }
232 233
234 // Check fragment is in m3u8 playlist
235 const subPlaylist = await server.streamingPlaylists.get({ url: `${baseUrl}/${video.uuid}/${playlistNumber}.m3u8` })
236 if (!subPlaylist.includes(segmentName)) throw new Error('Fragment does not exist in playlist')
237
233 error = false 238 error = false
234 } catch { 239 } catch {
235 error = true 240 error = true