aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/lib/job-queue/handlers/video-live-ending.ts13
-rw-r--r--server/lib/live-manager.ts14
2 files changed, 14 insertions, 13 deletions
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts
index 0d2bcaa28..6e1076d8f 100644
--- a/server/lib/job-queue/handlers/video-live-ending.ts
+++ b/server/lib/job-queue/handlers/video-live-ending.ts
@@ -1,8 +1,9 @@
1import * as Bull from 'bull' 1import * as Bull from 'bull'
2import { move, readdir, remove } from 'fs-extra' 2import { copy, readdir, remove } from 'fs-extra'
3import { join } from 'path' 3import { join } from 'path'
4import { hlsPlaylistToFragmentedMP4 } from '@server/helpers/ffmpeg-utils' 4import { hlsPlaylistToFragmentedMP4 } from '@server/helpers/ffmpeg-utils'
5import { getDurationFromVideoFile, getVideoFileResolution } from '@server/helpers/ffprobe-utils' 5import { getDurationFromVideoFile, getVideoFileResolution } from '@server/helpers/ffprobe-utils'
6import { VIDEO_LIVE } from '@server/initializers/constants'
6import { generateVideoMiniature } from '@server/lib/thumbnail' 7import { generateVideoMiniature } from '@server/lib/thumbnail'
7import { publishAndFederateIfNeeded } from '@server/lib/video' 8import { publishAndFederateIfNeeded } from '@server/lib/video'
8import { getHLSDirectory } from '@server/lib/video-paths' 9import { getHLSDirectory } from '@server/lib/video-paths'
@@ -14,7 +15,6 @@ import { VideoStreamingPlaylistModel } from '@server/models/video/video-streamin
14import { MStreamingPlaylist, MVideo, MVideoLive } from '@server/types/models' 15import { MStreamingPlaylist, MVideo, MVideoLive } from '@server/types/models'
15import { ThumbnailType, VideoLiveEndingPayload, VideoState } from '@shared/models' 16import { ThumbnailType, VideoLiveEndingPayload, VideoState } from '@shared/models'
16import { logger } from '../../../helpers/logger' 17import { logger } from '../../../helpers/logger'
17import { VIDEO_LIVE } from '@server/initializers/constants'
18 18
19async function processVideoLiveEnding (job: Bull.Job) { 19async function processVideoLiveEnding (job: Bull.Job) {
20 const payload = job.data as VideoLiveEndingPayload 20 const payload = job.data as VideoLiveEndingPayload
@@ -61,11 +61,12 @@ async function saveLive (video: MVideo, live: MVideoLive) {
61 const playlistFiles: string[] = [] 61 const playlistFiles: string[] = []
62 62
63 for (const file of rootFiles) { 63 for (const file of rootFiles) {
64 if (file.endsWith('.m3u8') !== true) continue 64 // Move remaining files in the replay directory
65 65 if (file.endsWith('.ts') || file.endsWith('.m3u8')) {
66 await move(join(hlsDirectory, file), join(replayDirectory, file)) 66 await copy(join(hlsDirectory, file), join(replayDirectory, file))
67 }
67 68
68 if (file !== 'master.m3u8') { 69 if (file.endsWith('.m3u8') && file !== 'master.m3u8') {
69 playlistFiles.push(file) 70 playlistFiles.push(file)
70 } 71 }
71 } 72 }
diff --git a/server/lib/live-manager.ts b/server/lib/live-manager.ts
index 690e2ce55..4f45ce530 100644
--- a/server/lib/live-manager.ts
+++ b/server/lib/live-manager.ts
@@ -378,13 +378,13 @@ class LiveManager {
378 // Wait latest segments generation, and close watchers 378 // Wait latest segments generation, and close watchers
379 379
380 Promise.all([ tsWatcher.close(), masterWatcher.close() ]) 380 Promise.all([ tsWatcher.close(), masterWatcher.close() ])
381 .then(() => { 381 .then(() => {
382 // Process remaining segments hash 382 // Process remaining segments hash
383 for (const key of Object.keys(segmentsToProcessPerPlaylist)) { 383 for (const key of Object.keys(segmentsToProcessPerPlaylist)) {
384 processSegments(segmentsToProcessPerPlaylist[key]) 384 processSegments(segmentsToProcessPerPlaylist[key])
385 } 385 }
386 }) 386 })
387 .catch(err => logger.error('Cannot close watchers of %s or process remaining hash segments.', outPath, { err })) 387 .catch(err => logger.error('Cannot close watchers of %s or process remaining hash segments.', outPath, { err }))
388 388
389 this.onEndTransmuxing(videoLive.Video.id) 389 this.onEndTransmuxing(videoLive.Video.id)
390 .catch(err => logger.error('Error in closed transmuxing.', { err })) 390 .catch(err => logger.error('Error in closed transmuxing.', { err }))