diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/models/server/job.model.ts | 3 | ||||
-rw-r--r-- | shared/models/videos/live/live-video-create.model.ts | 5 | ||||
-rw-r--r-- | shared/server-commands/videos/live-command.ts | 2 | ||||
-rw-r--r-- | shared/server-commands/videos/live.ts | 23 |
4 files changed, 27 insertions, 6 deletions
diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.ts index 92d1b5698..9370cf011 100644 --- a/shared/models/server/job.model.ts +++ b/shared/models/server/job.model.ts | |||
@@ -159,6 +159,9 @@ export type VideoTranscodingPayload = | |||
159 | 159 | ||
160 | export interface VideoLiveEndingPayload { | 160 | export interface VideoLiveEndingPayload { |
161 | videoId: number | 161 | videoId: number |
162 | publishedAt: string | ||
163 | |||
164 | replayDirectory?: string | ||
162 | } | 165 | } |
163 | 166 | ||
164 | export interface ActorKeysPayload { | 167 | export interface ActorKeysPayload { |
diff --git a/shared/models/videos/live/live-video-create.model.ts b/shared/models/videos/live/live-video-create.model.ts index 49ccaf45b..bd245dec5 100644 --- a/shared/models/videos/live/live-video-create.model.ts +++ b/shared/models/videos/live/live-video-create.model.ts | |||
@@ -1,8 +1,9 @@ | |||
1 | import { LiveVideoLatencyMode } from '.' | ||
2 | import { VideoCreate } from '../video-create.model' | 1 | import { VideoCreate } from '../video-create.model' |
2 | import { LiveVideoLatencyMode } from './live-video-latency-mode.enum' | ||
3 | 3 | ||
4 | export interface LiveVideoCreate extends VideoCreate { | 4 | export interface LiveVideoCreate extends VideoCreate { |
5 | saveReplay?: boolean | ||
6 | permanentLive?: boolean | 5 | permanentLive?: boolean |
7 | latencyMode?: LiveVideoLatencyMode | 6 | latencyMode?: LiveVideoLatencyMode |
7 | |||
8 | saveReplay?: boolean | ||
8 | } | 9 | } |
diff --git a/shared/server-commands/videos/live-command.ts b/shared/server-commands/videos/live-command.ts index f7816eca0..c24c7a5fc 100644 --- a/shared/server-commands/videos/live-command.ts +++ b/shared/server-commands/videos/live-command.ts | |||
@@ -117,7 +117,7 @@ export class LiveCommand extends AbstractCommand { | |||
117 | return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, 2, false) | 117 | return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, 2, false) |
118 | } | 118 | } |
119 | 119 | ||
120 | async waitUntilSaved (options: OverrideCommandOptions & { | 120 | async waitUntilReplacedByReplay (options: OverrideCommandOptions & { |
121 | videoId: number | string | 121 | videoId: number | string |
122 | }) { | 122 | }) { |
123 | let video: VideoDetails | 123 | let video: VideoDetails |
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 @@ | |||
1 | import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' | 1 | import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' |
2 | import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' | 2 | import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' |
3 | import { PeerTubeServer } from '../server/server' | 3 | import { PeerTubeServer } from '../server/server' |
4 | import { VideoDetails, VideoInclude } from '@shared/models' | ||
4 | 5 | ||
5 | function sendRTMPStream (options: { | 6 | function sendRTMPStream (options: { |
6 | rtmpBaseUrl: string | 7 | rtmpBaseUrl: string |
@@ -84,17 +85,33 @@ async function waitUntilLivePublishedOnAllServers (servers: PeerTubeServer[], vi | |||
84 | } | 85 | } |
85 | } | 86 | } |
86 | 87 | ||
87 | async function waitUntilLiveSavedOnAllServers (servers: PeerTubeServer[], videoId: string) { | 88 | async 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 | ||
94 | async function waitUntilLiveReplacedByReplayOnAllServers (servers: PeerTubeServer[], videoId: string) { | ||
95 | for (const server of servers) { | ||
96 | await server.live.waitUntilReplacedByReplay({ videoId }) | ||
97 | } | ||
98 | } | ||
99 | |||
100 | async 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 | |||
93 | export { | 106 | export { |
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 | } |