From bb4ba6d94c5051fdd665ebe63fffcc105778b8be Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 3 Dec 2020 14:10:54 +0100 Subject: Add permanent live support --- shared/extra-utils/videos/live.ts | 10 ++++++++++ shared/models/activitypub/objects/video-torrent-object.ts | 1 + shared/models/videos/live/live-video-create.model.ts | 1 + shared/models/videos/live/live-video-update.model.ts | 1 + shared/models/videos/live/live-video.model.ts | 1 + 5 files changed, 14 insertions(+) (limited to 'shared') diff --git a/shared/extra-utils/videos/live.ts b/shared/extra-utils/videos/live.ts index 346134969..522beb8bc 100644 --- a/shared/extra-utils/videos/live.ts +++ b/shared/extra-utils/videos/live.ts @@ -177,10 +177,20 @@ async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resoluti expect(files).to.contain('segments-sha256.json') } +async function getPlaylistsCount (server: ServerInfo, videoUUID: string) { + const basePath = buildServerDirectory(server, 'streaming-playlists') + const hlsPath = join(basePath, 'hls', videoUUID) + + const files = await readdir(hlsPath) + + return files.filter(f => f.endsWith('.m3u8')).length +} + // --------------------------------------------------------------------------- export { getLive, + getPlaylistsCount, waitUntilLivePublished, updateLive, waitUntilLiveStarts, diff --git a/shared/models/activitypub/objects/video-torrent-object.ts b/shared/models/activitypub/objects/video-torrent-object.ts index d99d273c3..6d18e93d5 100644 --- a/shared/models/activitypub/objects/video-torrent-object.ts +++ b/shared/models/activitypub/objects/video-torrent-object.ts @@ -24,6 +24,7 @@ export interface VideoObject { isLiveBroadcast: boolean liveSaveReplay: boolean + permanentLive: boolean commentsEnabled: boolean downloadEnabled: boolean diff --git a/shared/models/videos/live/live-video-create.model.ts b/shared/models/videos/live/live-video-create.model.ts index 1ef4b70dd..caa7acc17 100644 --- a/shared/models/videos/live/live-video-create.model.ts +++ b/shared/models/videos/live/live-video-create.model.ts @@ -2,4 +2,5 @@ import { VideoCreate } from '../video-create.model' export interface LiveVideoCreate extends VideoCreate { saveReplay?: boolean + permanentLive?: boolean } diff --git a/shared/models/videos/live/live-video-update.model.ts b/shared/models/videos/live/live-video-update.model.ts index 0f0f67d06..a39c44797 100644 --- a/shared/models/videos/live/live-video-update.model.ts +++ b/shared/models/videos/live/live-video-update.model.ts @@ -1,3 +1,4 @@ export interface LiveVideoUpdate { + permanentLive?: boolean saveReplay?: boolean } diff --git a/shared/models/videos/live/live-video.model.ts b/shared/models/videos/live/live-video.model.ts index a3f8275e3..d6e9a50d1 100644 --- a/shared/models/videos/live/live-video.model.ts +++ b/shared/models/videos/live/live-video.model.ts @@ -2,4 +2,5 @@ export interface LiveVideo { rtmpUrl: string streamKey: string saveReplay: boolean + permanentLive: boolean } -- cgit v1.2.3