diff options
Diffstat (limited to 'server/lib/live/live-utils.ts')
-rw-r--r-- | server/lib/live/live-utils.ts | 12 |
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 @@ | |||
1 | import { pathExists, readdir, remove } from 'fs-extra' | 1 | import { pathExists, readdir, remove } from 'fs-extra' |
2 | import { basename, join } from 'path' | 2 | import { basename, join } from 'path' |
3 | import { logger } from '@server/helpers/logger' | 3 | import { logger } from '@server/helpers/logger' |
4 | import { VIDEO_LIVE } from '@server/initializers/constants' | ||
4 | import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideo } from '@server/types/models' | 5 | import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideo } from '@server/types/models' |
5 | import { VideoStorage } from '@shared/models' | 6 | import { LiveVideoLatencyMode, VideoStorage } from '@shared/models' |
6 | import { listHLSFileKeysOf, removeHLSFileObjectStorageByFullKey, removeHLSObjectStorage } from '../object-storage' | 7 | import { listHLSFileKeysOf, removeHLSFileObjectStorageByFullKey, removeHLSObjectStorage } from '../object-storage' |
7 | import { getLiveDirectory } from '../paths' | 8 | import { 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 | ||
41 | function 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 | |||
40 | export { | 49 | export { |
41 | cleanupAndDestroyPermanentLive, | 50 | cleanupAndDestroyPermanentLive, |
42 | cleanupUnsavedNormalLive, | 51 | cleanupUnsavedNormalLive, |
43 | cleanupTMPLiveFiles, | 52 | cleanupTMPLiveFiles, |
53 | getLiveSegmentTime, | ||
44 | buildConcatenatedName | 54 | buildConcatenatedName |
45 | } | 55 | } |
46 | 56 | ||