aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands/videos/live.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/server-commands/videos/live.ts')
-rw-r--r--shared/server-commands/videos/live.ts23
1 files changed, 20 insertions, 3 deletions
diff --git a/shared/server-commands/videos/live.ts b/shared/server-commands/videos/live.ts
index 7a7faa911..6f180b05f 100644
--- a/shared/server-commands/videos/live.ts
+++ b/shared/server-commands/videos/live.ts
@@ -1,6 +1,7 @@
1import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' 1import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg'
2import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' 2import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'
3import { PeerTubeServer } from '../server/server' 3import { PeerTubeServer } from '../server/server'
4import { VideoDetails, VideoInclude } from '@shared/models'
4 5
5function sendRTMPStream (options: { 6function sendRTMPStream (options: {
6 rtmpBaseUrl: string 7 rtmpBaseUrl: string
@@ -84,17 +85,33 @@ async function waitUntilLivePublishedOnAllServers (servers: PeerTubeServer[], vi
84 } 85 }
85} 86}
86 87
87async function waitUntilLiveSavedOnAllServers (servers: PeerTubeServer[], videoId: string) { 88async function waitUntilLiveWaitingOnAllServers (servers: PeerTubeServer[], videoId: string) {
88 for (const server of servers) { 89 for (const server of servers) {
89 await server.live.waitUntilSaved({ videoId }) 90 await server.live.waitUntilWaiting({ videoId })
90 } 91 }
91} 92}
92 93
94async function waitUntilLiveReplacedByReplayOnAllServers (servers: PeerTubeServer[], videoId: string) {
95 for (const server of servers) {
96 await server.live.waitUntilReplacedByReplay({ videoId })
97 }
98}
99
100async function findExternalSavedVideo (server: PeerTubeServer, liveDetails: VideoDetails) {
101 const { data } = await server.videos.list({ token: server.accessToken, sort: '-publishedAt', include: VideoInclude.BLACKLISTED })
102
103 return data.find(v => v.name === liveDetails.name + ' - ' + new Date(liveDetails.publishedAt).toLocaleString())
104}
105
93export { 106export {
94 sendRTMPStream, 107 sendRTMPStream,
95 waitFfmpegUntilError, 108 waitFfmpegUntilError,
96 testFfmpegStreamError, 109 testFfmpegStreamError,
97 stopFfmpeg, 110 stopFfmpeg,
111
98 waitUntilLivePublishedOnAllServers, 112 waitUntilLivePublishedOnAllServers,
99 waitUntilLiveSavedOnAllServers 113 waitUntilLiveReplacedByReplayOnAllServers,
114 waitUntilLiveWaitingOnAllServers,
115
116 findExternalSavedVideo
100} 117}