X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fextra-utils%2Fvideos%2Flive.ts;h=c0384769bda247f4dc13ce8a38d70ac2c8879259;hb=d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb;hp=b0e499ce0be0a78f464282f4aa63b698e1f4943e;hpb=ba5a8d89bbf049e4afc41543bcc072cccdb02669;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/extra-utils/videos/live.ts b/shared/extra-utils/videos/live.ts index b0e499ce0..c0384769b 100644 --- a/shared/extra-utils/videos/live.ts +++ b/shared/extra-utils/videos/live.ts @@ -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 }