]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/videos/live.ts
Fix stats tests
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / videos / live.ts
index b0e499ce0be0a78f464282f4aa63b698e1f4943e..df73700081cd8be3adbbf18caa9d380fc2788fe7 100644 (file)
@@ -164,6 +164,17 @@ 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 checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) {
   const basePath = buildServerDirectory(server, 'streaming-playlists')
   const hlsPath = join(basePath, 'hls', videoUUID)
@@ -203,6 +214,7 @@ async function getPlaylistsCount (server: ServerInfo, videoUUID: string) {
 export {
   getLive,
   getPlaylistsCount,
+  waitUntilLiveSaved,
   waitUntilLivePublished,
   updateLive,
   createLive,