aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-12-04 15:29:18 +0100
committerChocobozzz <me@florianbigard.com>2020-12-04 15:38:32 +0100
commite772bdf14c46701552491dc337a21325c34e1ec2 (patch)
treece50d56a3433306beeb8c4c0cd711636bac242ee /server/lib/job-queue/handlers
parent3851e732c4b1da0bc0c40a46ed5a89d93cdc5389 (diff)
downloadPeerTube-e772bdf14c46701552491dc337a21325c34e1ec2.tar.gz
PeerTube-e772bdf14c46701552491dc337a21325c34e1ec2.tar.zst
PeerTube-e772bdf14c46701552491dc337a21325c34e1ec2.zip
Load video in permanent live after last one ended
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r--server/lib/job-queue/handlers/video-live-ending.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts
index 4daf9249b..e10e306a7 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 { copy, pathExists, readdir, remove } from 'fs-extra' 2import { pathExists, readdir, remove } from 'fs-extra'
3import { join } from 'path' 3import { join } from 'path'
4import { getDurationFromVideoFile, getVideoFileResolution } from '@server/helpers/ffprobe-utils' 4import { ffprobePromise, getAudioStream, getAudioStreamCodec, getDurationFromVideoFile, getVideoFileResolution } from '@server/helpers/ffprobe-utils'
5import { VIDEO_LIVE } from '@server/initializers/constants' 5import { VIDEO_LIVE } from '@server/initializers/constants'
6import { LiveManager } from '@server/lib/live-manager'
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 { LiveManager } from '@server/lib/live-manager'
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
@@ -106,13 +106,17 @@ async function saveLive (video: MVideo, live: MVideoLive) {
106 const concatenatedTsFile = LiveManager.Instance.buildConcatenatedName(playlistFile) 106 const concatenatedTsFile = LiveManager.Instance.buildConcatenatedName(playlistFile)
107 const concatenatedTsFilePath = join(replayDirectory, concatenatedTsFile) 107 const concatenatedTsFilePath = join(replayDirectory, concatenatedTsFile)
108 108
109 const { videoFileResolution, isPortraitMode } = await getVideoFileResolution(concatenatedTsFilePath) 109 const probe = await ffprobePromise(concatenatedTsFilePath)
110 const { audioStream } = await getAudioStream(concatenatedTsFilePath, probe)
111
112 const { videoFileResolution, isPortraitMode } = await getVideoFileResolution(concatenatedTsFilePath, probe)
110 113
111 const outputPath = await generateHlsPlaylistFromTS({ 114 const outputPath = await generateHlsPlaylistFromTS({
112 video: videoWithFiles, 115 video: videoWithFiles,
113 concatenatedTsFilePath, 116 concatenatedTsFilePath,
114 resolution: videoFileResolution, 117 resolution: videoFileResolution,
115 isPortraitMode 118 isPortraitMode,
119 isAAC: audioStream?.codec_name === 'aac'
116 }) 120 })
117 121
118 if (!durationDone) { 122 if (!durationDone) {