]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/server-commands/videos/live-command.ts
Merge branch 'release/4.2.0' into develop
[github/Chocobozzz/PeerTube.git] / shared / server-commands / videos / live-command.ts
index 2ff65881be3a108c95ab87d13937befa8a943428..3df47ed4d7d8f2799ae84293b71668711197541f 100644 (file)
@@ -154,13 +154,33 @@ export class LiveCommand extends AbstractCommand {
 
   waitUntilSegmentGeneration (options: OverrideCommandOptions & {
     videoUUID: string
-    resolution: number
+    playlistNumber: number
     segment: number
+    totalSessions?: number
   }) {
-    const { resolution, segment, videoUUID } = options
-    const segmentName = `${resolution}-00000${segment}.ts`
+    const { playlistNumber, segment, videoUUID, totalSessions = 1 } = options
+    const segmentName = `${playlistNumber}-00000${segment}.ts`
 
-    return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, 2, false)
+    return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, totalSessions * 2, false)
+  }
+
+  getSegment (options: OverrideCommandOptions & {
+    videoUUID: string
+    playlistNumber: number
+    segment: number
+  }) {
+    const { playlistNumber, segment, videoUUID } = options
+
+    const segmentName = `${playlistNumber}-00000${segment}.ts`
+    const url = `${this.server.url}/static/streaming-playlists/hls/${videoUUID}/${segmentName}`
+
+    return this.getRawRequest({
+      ...options,
+
+      url,
+      implicitToken: false,
+      defaultExpectedStatus: HttpStatusCode.OK_200
+    })
   }
 
   async waitUntilReplacedByReplay (options: OverrideCommandOptions & {