]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/videos/live.ts
Support short uuid for GET video/playlist
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / videos / live.ts
index b0e499ce0be0a78f464282f4aa63b698e1f4943e..c0384769bda247f4dc13ce8a38d70ac2c8879259 100644 (file)
@@ -119,7 +119,7 @@ async function testFfmpegStreamError (command: ffmpeg.FfmpegCommand, shouldHaveE
   let error: Error
 
   try {
-    await waitFfmpegUntilError(command, 25000)
+    await waitFfmpegUntilError(command, 35000)
   } catch (err) {
     error = err
   }
@@ -164,6 +164,23 @@ async function waitUntilLiveState (url: string, token: string, videoId: number |
   } while (video.state.id !== state)
 }
 
+async function waitUntilLiveSaved (url: string, token: string, videoId: number | string) {
+  let video: VideoDetails
+
+  do {
+    const res = await getVideoWithToken(url, token, videoId)
+    video = res.body
+
+    await wait(500)
+  } while (video.isLive === true && video.state.id !== VideoState.PUBLISHED)
+}
+
+async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) {
+  for (const server of servers) {
+    await waitUntilLivePublished(server.url, server.accessToken, videoId)
+  }
+}
+
 async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) {
   const basePath = buildServerDirectory(server, 'streaming-playlists')
   const hlsPath = join(basePath, 'hls', videoUUID)
@@ -203,6 +220,7 @@ async function getPlaylistsCount (server: ServerInfo, videoUUID: string) {
 export {
   getLive,
   getPlaylistsCount,
+  waitUntilLiveSaved,
   waitUntilLivePublished,
   updateLive,
   createLive,
@@ -214,6 +232,7 @@ export {
   sendRTMPStreamInVideo,
   waitUntilLiveEnded,
   waitFfmpegUntilError,
+  waitUntilLivePublishedOnAllServers,
   sendRTMPStream,
   testFfmpegStreamError
 }