aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/live/live-utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/live/live-utils.ts')
-rw-r--r--server/lib/live/live-utils.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/server/lib/live/live-utils.ts b/server/lib/live/live-utils.ts
index c0dec9829..3fb3ce1ce 100644
--- a/server/lib/live/live-utils.ts
+++ b/server/lib/live/live-utils.ts
@@ -1,8 +1,9 @@
1import { pathExists, readdir, remove } from 'fs-extra' 1import { pathExists, readdir, remove } from 'fs-extra'
2import { basename, join } from 'path' 2import { basename, join } from 'path'
3import { logger } from '@server/helpers/logger' 3import { logger } from '@server/helpers/logger'
4import { VIDEO_LIVE } from '@server/initializers/constants'
4import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideo } from '@server/types/models' 5import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideo } from '@server/types/models'
5import { VideoStorage } from '@shared/models' 6import { LiveVideoLatencyMode, VideoStorage } from '@shared/models'
6import { listHLSFileKeysOf, removeHLSFileObjectStorageByFullKey, removeHLSObjectStorage } from '../object-storage' 7import { listHLSFileKeysOf, removeHLSFileObjectStorageByFullKey, removeHLSObjectStorage } from '../object-storage'
7import { getLiveDirectory } from '../paths' 8import { getLiveDirectory } from '../paths'
8 9
@@ -37,10 +38,19 @@ async function cleanupTMPLiveFiles (video: MVideo, streamingPlaylist: MStreaming
37 await cleanupTMPLiveFilesFromFilesystem(video) 38 await cleanupTMPLiveFilesFromFilesystem(video)
38} 39}
39 40
41function getLiveSegmentTime (latencyMode: LiveVideoLatencyMode) {
42 if (latencyMode === LiveVideoLatencyMode.SMALL_LATENCY) {
43 return VIDEO_LIVE.SEGMENT_TIME_SECONDS.SMALL_LATENCY
44 }
45
46 return VIDEO_LIVE.SEGMENT_TIME_SECONDS.DEFAULT_LATENCY
47}
48
40export { 49export {
41 cleanupAndDestroyPermanentLive, 50 cleanupAndDestroyPermanentLive,
42 cleanupUnsavedNormalLive, 51 cleanupUnsavedNormalLive,
43 cleanupTMPLiveFiles, 52 cleanupTMPLiveFiles,
53 getLiveSegmentTime,
44 buildConcatenatedName 54 buildConcatenatedName
45} 55}
46 56