aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/live.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos/live.ts')
-rw-r--r--server/controllers/api/videos/live.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts
index 49cabb6f3..c6f038079 100644
--- a/server/controllers/api/videos/live.ts
+++ b/server/controllers/api/videos/live.ts
@@ -1,4 +1,5 @@
1import express from 'express' 1import express from 'express'
2import { exists } from '@server/helpers/custom-validators/misc'
2import { createReqFiles } from '@server/helpers/express-utils' 3import { createReqFiles } from '@server/helpers/express-utils'
3import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' 4import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants'
4import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' 5import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'
@@ -9,7 +10,7 @@ import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator
9import { VideoLiveModel } from '@server/models/video/video-live' 10import { VideoLiveModel } from '@server/models/video/video-live'
10import { MVideoDetails, MVideoFullLight } from '@server/types/models' 11import { MVideoDetails, MVideoFullLight } from '@server/types/models'
11import { buildUUID, uuidToShort } from '@shared/extra-utils' 12import { buildUUID, uuidToShort } from '@shared/extra-utils'
12import { HttpStatusCode, LiveVideoCreate, LiveVideoUpdate, VideoState } from '@shared/models' 13import { HttpStatusCode, LiveVideoCreate, LiveVideoLatencyMode, LiveVideoUpdate, VideoState } from '@shared/models'
13import { logger } from '../../../helpers/logger' 14import { logger } from '../../../helpers/logger'
14import { sequelizeTypescript } from '../../../initializers/database' 15import { sequelizeTypescript } from '../../../initializers/database'
15import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail' 16import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail'
@@ -60,8 +61,9 @@ async function updateLiveVideo (req: express.Request, res: express.Response) {
60 const video = res.locals.videoAll 61 const video = res.locals.videoAll
61 const videoLive = res.locals.videoLive 62 const videoLive = res.locals.videoLive
62 63
63 videoLive.saveReplay = body.saveReplay || false 64 if (exists(body.saveReplay)) videoLive.saveReplay = body.saveReplay
64 videoLive.permanentLive = body.permanentLive || false 65 if (exists(body.permanentLive)) videoLive.permanentLive = body.permanentLive
66 if (exists(body.latencyMode)) videoLive.latencyMode = body.latencyMode
65 67
66 video.VideoLive = await videoLive.save() 68 video.VideoLive = await videoLive.save()
67 69
@@ -87,6 +89,7 @@ async function addLiveVideo (req: express.Request, res: express.Response) {
87 const videoLive = new VideoLiveModel() 89 const videoLive = new VideoLiveModel()
88 videoLive.saveReplay = videoInfo.saveReplay || false 90 videoLive.saveReplay = videoInfo.saveReplay || false
89 videoLive.permanentLive = videoInfo.permanentLive || false 91 videoLive.permanentLive = videoInfo.permanentLive || false
92 videoLive.latencyMode = videoInfo.latencyMode || LiveVideoLatencyMode.DEFAULT
90 videoLive.streamKey = buildUUID() 93 videoLive.streamKey = buildUUID()
91 94
92 const [ thumbnailModel, previewModel ] = await buildVideoThumbnailsFromReq({ 95 const [ thumbnailModel, previewModel ] = await buildVideoThumbnailsFromReq({