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:
parent
c106db1413
commit
81f14b9112
7 changed files with 26 additions and 19 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue