From 94d721efdc9a8c2cda612f49506a41adb6a06f1d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 19 Feb 2021 14:30:00 +0100 Subject: Fix stats tests --- shared/extra-utils/videos/live.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'shared') diff --git a/shared/extra-utils/videos/live.ts b/shared/extra-utils/videos/live.ts index b0e499ce0..df7370008 100644 --- a/shared/extra-utils/videos/live.ts +++ b/shared/extra-utils/videos/live.ts @@ -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, -- cgit v1.2.3