1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Add ability to save replay of permanent lives

This commit is contained in:
Chocobozzz 2022-04-21 09:06:52 +02:00
parent 2024a3b933
commit 4ec52d04dc
No known key found for this signature in database
GPG key ID: 583A612D890159BE
20 changed files with 426 additions and 175 deletions

View file

@ -117,7 +117,7 @@ export class LiveCommand extends AbstractCommand {
return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, 2, false)
}
async waitUntilSaved (options: OverrideCommandOptions & {
async waitUntilReplacedByReplay (options: OverrideCommandOptions & {
videoId: number | string
}) {
let video: VideoDetails

View file

@ -1,6 +1,7 @@
import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg'
import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'
import { PeerTubeServer } from '../server/server'
import { VideoDetails, VideoInclude } from '@shared/models'
function sendRTMPStream (options: {
rtmpBaseUrl: string
@ -84,17 +85,33 @@ async function waitUntilLivePublishedOnAllServers (servers: PeerTubeServer[], vi
}
}
async function waitUntilLiveSavedOnAllServers (servers: PeerTubeServer[], videoId: string) {
async function waitUntilLiveWaitingOnAllServers (servers: PeerTubeServer[], videoId: string) {
for (const server of servers) {
await server.live.waitUntilSaved({ videoId })
await server.live.waitUntilWaiting({ videoId })
}
}
async function waitUntilLiveReplacedByReplayOnAllServers (servers: PeerTubeServer[], videoId: string) {
for (const server of servers) {
await server.live.waitUntilReplacedByReplay({ videoId })
}
}
async function findExternalSavedVideo (server: PeerTubeServer, liveDetails: VideoDetails) {
const { data } = await server.videos.list({ token: server.accessToken, sort: '-publishedAt', include: VideoInclude.BLACKLISTED })
return data.find(v => v.name === liveDetails.name + ' - ' + new Date(liveDetails.publishedAt).toLocaleString())
}
export {
sendRTMPStream,
waitFfmpegUntilError,
testFfmpegStreamError,
stopFfmpeg,
waitUntilLivePublishedOnAllServers,
waitUntilLiveSavedOnAllServers
waitUntilLiveReplacedByReplayOnAllServers,
waitUntilLiveWaitingOnAllServers,
findExternalSavedVideo
}