1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Correctly wait for live segment generation

This commit is contained in:
Chocobozzz 2023-05-11 11:25:33 +02:00
parent c106db1413
commit 81f14b9112
No known key found for this signature in database
GPG key ID: 583A612D890159BE
7 changed files with 26 additions and 19 deletions

View file

@ -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